CC2531 keeps disconnecting

I have been struggling with my CC2531 disconnecting
I’m running Ubuntu 18.04.03 LTS, with hassio and zigbee2mqtt docker

The core of the issue is /dev/ttyACM0 keeps disappearing from Linux after some time
It has gotten better since I modified GRUB power saving settings (The green light on the CC2531 stays on now at least)

If i do
dmesg | grep -i usb

We can see after a significant amount of time, usb 8-2: USB disconnect, device number 2, is logged

[ 2.856256] usb 8-2: New USB device found, idVendor=0451, idProduct=16a8
[ 2.856264] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2.856268] usb 8-2: Product: TI CC2531 USB CDC
[ 2.856271] usb 8-2: Manufacturer: Texas Instruments
[ 2.856274] usb 8-2: SerialNumber: __0X00124B00193663EA
[ 39.981260] cdc_acm 8-2:1.0: ttyACM0: USB ACM device
[ 39.991713] usbcore: registered new interface driver cdc_acm
[ 39.991719] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 40.146635] usbcore: registered new interface driver btusb
[72507.360645] usb 8-2: USB disconnect, device number 2

If I reboot Ubuntu, then /dev/ttyACM0 comes back, and zigbee2mqtt can see my 1 device

Has anyone come across this issue ?
Given the price difference between z-wave of the Xiaomi sensors/plugs, I was hoping to build out a Zigbee network

Another issue is hassio is not automatically adding devices that zigbee2mqtt is finding (config looks correct for them to be auto added), my 1 device was previously working but had to rediscover it due to all the troubleshooting on the disconnecting issue

Is Zigbee with the CC2531 just unreliable compared to z-wave ? (I have no z-wave yet, as only just starting on my HA journey)
I

I use Zigbee2MQTT with that stick, not on Hass.io, and it’s fine.

Then it looks like MQTT discovery isn’t correct configured on both Home Assistant and Zigbee2MQTT

Random disconnect issues may be because you’ve got the modemmanager package installed in Ubuntu. If so, you should remove that.

Thanks Tinkerer

I have removed modemmanager (Not sure how you could tell, as dmesg still looks the same?)

[ 2.640092] usb 5-3: new full-speed USB device number 2 using ohci-pci
[ 2.676075] usb 8-2: new full-speed USB device number 2 using xhci_hcd
[ 2.836368] usb 5-3: New USB device found, idVendor=0cf3, idProduct=3005
[ 2.836375] usb 5-3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.856218] usb 8-2: New USB device found, idVendor=0451, idProduct=16a8
[ 2.856226] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2.856229] usb 8-2: Product: TI CC2531 USB CDC
[ 2.856232] usb 8-2: Manufacturer: Texas Instruments
[ 2.856235] usb 8-2: SerialNumber: __0X00124B00193663EA
[ 39.970147] cdc_acm 8-2:1.0: ttyACM0: USB ACM device
[ 40.013060] usbcore: registered new interface driver cdc_acm
[ 40.013065] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 40.196311] usbcore: registered new interface driver btusb

I’m currently getting data from my Xiaomi plug in the logs

zigbee2mqtt:info 8/26/2019, 6:29:50 PM MQTT publish: topic ‘zigbee2mqtt/0x00158d0002372d72’, payload ‘{“power”:0,“linkquality”:92,“state”:“OFF”,“voltage”:224.4,“consumption”:1.36,“temperature”:26}’
zigbee2mqtt:info 8/26/2019, 6:29:52 PM MQTT publish: topic ‘zigbee2mqtt/0x00158d0002372d72’, payload ‘{“power”:0,“linkquality”:68,“state”:“ON”,“voltage”:224.4,“consumption”:1.36,“temperature”:26}’

With the mqtt discovery
Zigbee2MQTT does connect to Mosquitto (I can see that in the logs)

configuration.xml
mqtt:
broker: core-mosquitto # This will have to be your mqtt broker
discovery: true
birth_message:
topic: ‘hass/status’
payload: ‘online’
will_message:
topic: ‘hass/status’
payload: ‘offline’

Zigbee2MQTT configuration
{
“data_path”: “/share/zigbee2mqtt”,
“devices”: “devices.yaml”,
“groups”: “groups.yaml”,
“homeassistant”: true,
“permit_join”: false,
“mqtt”: {
“base_topic”: “zigbee2mqtt”,
“server”: “mqtt://core-mosquitto”,
“user”: “%username%”,
“password”: “%password%”
},
“serial”: {
“port”: “/dev/ttyACM0”
},
“advanced”: {
“pan_id”: 6754,
“channel”: 11,
“network_key”: [
data here
],
“availability_blacklist”: []
},
“ban”: [],
“whitelist”: [],
“queue”: {}
}

Mosquitto log showing connections
1566808028: New connection from 172.30.33.2 on port 1883.
[INFO] found %username% on local database
1566808029: New client connected from 172.30.33.2 as mqttjs_37713093 (p2, c1, k60, u’%username%’).
1566808035: New connection from 172.30.32.1 on port 1883.
1566808035: New client connected from 172.30.32.1 as auto-1089EDA

Please see the sticky post for things like how to format code/logs correctly.

Random failures of Z-Wave or Zigbee :wink: What happens is that modemmanager (and some other software) also interacts with the USB stick. This causes problems for the software using it, which is why it’s highlighted in various parts of the HA docs as being something you should remove/disable.