Sonoff Zigbee USB ttyUSB0 becomes ttyUSB1 when I plug in another USB serial device (esp8266) and breaks both ESPHome and Zigbee2MQTT

I noticed today my Zigbee2MQTT stops working when I plug in an ESPHome device to upload new firmware to it.

When I set up the Sonoff Zigbee stick, it was recognised as ttyUSB0. So I entered that in the Zigbee2MQTT addon config page.

It worked perfectly, until today I plugged in a ESPHome device to update it’s firmware. The firmware uploading would keep failing and it said something about multiple devices on ttyUSB0. Then I noticed in the list of devices to choose from (in ESPHome addon), it said the ESPHome device was ttyUSB0, and the Sonoff stick had become ttyUSB1.

I then went into the Zigbee2MQTT addon to change the serial port in the config. That is when I noticed the addon was not running. It had stopped. After changing the port to ttyUSB1, I could start Zigbee2MQTT again and also the ESPHome firmware uploading worked again.

Then, when I unplugged the ESPHome device, the Sonoff stick became ttyUSB0 again, which again made the Zigbee2MQTT addon stop. Changing it’s serial port back to ttyUSB0 fixed it again.

So the main question basically is:
How do I give the Sonoff USB Stick a fixed serial port, so it doesn’t change when I plug in another USB serial device?

In case it’s relevant: I run HAOS in a VM on Proxmox. And I passthrough the connected USB devices to the HAOS VM.

Thanks in advance!

Use the ‘by-id’ string found in HA’s “all hardware” for the stick…

Example:

/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_2cc5f45bfe3aec119e269e957a0af07f-if00-port0

2 Likes

Thanks!
Zigbee2MQTT works with the “byid” path. I’ll try tomorrow if it keeps working after plugging in the ESPHome device as well.
Thanks again!

I don’t have a map serial. can you help me out ?

What HA all hardware show?

I have HA running in docker on my synology, the only thing I can see on the hardware tab are 2 charts

On the page with the 2 charts, there is a button with 3 dots in the top right corner. Click that, and then “all hardware”. There you can find the string to use instead of /dev/ttyusbX


I have no dots there …

Then I assume the “all hardware” page is only available in HAOS. If you run it in docker, I think you should look for that string somewhere in your host OS. A good place to start would be where you passed through the USB dongle to your docker container. But I have no experience with that, so I probably can’t be much more help unfortunately.

What does the docker command or docker compose file you use for HA look like?