Skip to content

Solution for changing usb ports with multiple com ports #288

@wijnsema

Description

@wijnsema

If you have, like me, more the one usb com port connected to you Raspberry Pi you might find that the device names (e.g. /dev/ttyUSB0) can change at any moment.

I had my two devices changing twice on 3 reboots!

To solve this you need to create SYMLINK to your devices based on product id's and vendor id's and in your container(s) use this symlink to address your usb com port.

A step by step instruction can be found here:
https://www.freva.com/2019/06/20/assign-fixed-usb-port-names-to-your-raspberry-pi/

In my specific case I used

SUBSYSTEM=="tty", ATTRS{idProduct}=="7523", ATTRS{idVendor}=="1a86", SYMLINK+="ttyUSB_DEVICE1"
SUBSYSTEM=="tty", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", SYMLINK+="ttyUSB_DEVICE2"

to create virtual devices ttyUSB_DEVICE1and ttyUSB_DEVICE2.

In your docker-compose.yml or compose-override.yml you now specify the port like this:

  zigbee2mqtt:
    devices:
    - /dev/ttyUSB_DEVICE1:/dev/ttyUSB0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions