USB address changes HASSIO

Hey i have two devices connected to the USB port RS485 converter and an Arduino .

Sometimes the address of the USB devices is changed causing the automation not to work…

i was working with hassbian and did not had any issue like this before…

any soultion?

yes, you need to create a symlink and refer to this instead of /dev/ttyusb*.

edit the /etc/udev/rules.d/10-local.rules to contain:

ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="my_uart"
You can check for the variables of your device by running

udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)
There is a more in depth guide you can read on http://www.reactivated.net/writing_udev_rules.html

Can you please elaborate step by step?

Action should be added for each device?
what do you mean by “my_uart”
how can this be verified…?

will this work for HASSIO?

Sorry just realised that the below has been left on draft :open_mouth:
as per previous message above, check for the variables of your device by running

udevadm info -a -p  $(udevadm info -q path -n /dev/ttyUSB0)

Yes it should work for hassio but you’ll need to run the commands via SSH

this command is not working for HASSIO

changed to Hasbian and have ssh…
can someone please provide full example?

Hi, I have a similar (not yet critical with only one USB attached, it doesn’t change if not touched) problem myself, maybe someone did work it out with hassio (Raspberry PI) ?

Also an out of topic question to @poratnir - how do you communicate with this “USB port RS485 converter” in hassio ? And which one do you have ?

Using USB to ttl converter insulated

this one works as well

I am using din version

Can you advise for the exact command to add?

I am back using hassbian so should work there…

For an RFXTrx433 USB Transceiver, this is how it works:

  1. run this in a terminal:
    udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)

  2. You need to locate the place where it gives you the correct value for your device, ATTRS{manufacturer} and/or ATTRS{product} and take not of the ATTRS{idVendor} ATTRS{idProduct} and ATTRS{serial}:
    image

  3. edit the following file with your preferred editor: edit the /etc/udev/rules.d/99-usb-serial.rules and add this line:
    ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A1XETWB5", SYMLINK+="RFXTrx433"

  4. Replace the values in ATTRS{idVendor} ATTRS{idProduct} and ATTRS{serial} with the ones you found in previous step, replace RFXTrx433 with a name that makes sense to you .

  5. now type:
    ls /dev/serial/by-id/
    (You may have to reboot your machine if nothing shows up).
    image

  6. In your config, instead of providing e.g. /dev/ttsUSB0 you can provide this:
    /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1XETWB5-if00-port0
    (replace usb-RFXCOM_RFXtrx433_A1XETWB5-if00-port0 with the name of the device found in previous step)

Now it does not matter which USB port your device is connected to, it will always be found.

Hope this helps

how can verify it is working ?

i assume the command shows me all units connected

if you follow the guide that I wrote, you should see at least 1 entry when typing ls /dev/serial/by-id/
that’s how you verify that it works.
then in the application that needs access to your USB device, you enter the address that starts with ls /dev/serial/by-id/ instead of /dev/ttsUSB0 and it should work

the file is not exist just create new one?

what file?
if you mean 99-usb-serial.rules then yes try to create one

so what to put on HA settings?

image

rfxtrx:
  device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1XETWB5-if00-port0

so this is not working …
perhaps can you clarify if the address in HA need to be replaced ?

if so for what?

Thanks seems to work
/dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_0133D18C-if00-port0

2 Likes