Please start a new thread with this issue and hopefully the developers of hass.io can explain how the entities are created so I can add it to the startup script in Synology.
I have seen my mistake when I have re-read the full thread Now it is working. But if you create the links, it will work until your NAS reboot (until the udev process restart).
In order to make it more persistent you have to create a file (udev rules). I have created the file /lib/udev/rules.d/59-usb-serial.rules
I have added the 2 lines for my zwave USB key and for my RFX433 USB device:
Great! My idea is to modify the startup script in the hassio package to create the symlinks automatically when the hassio package starts. The thing is that as you said, we need to understand what hassio are expecting. Please investigate more…
I can confirm that after configuring my udev on the Synology everything is working like a charm. Certificate are managed through my Synology and I am using the Synology reverse proxy. I have also configured the firewall to allow the Hassio network container. I think there is also something to do in the Synology package to propose during the installation.
I will try to see how to configure this udev file to add it automatically. If this can help.
Great job @fredrike ! I don’t need to adapt or create container any more for home assistant on my Synology which has a better performance compared to my rpi2.
@fredrike, if you want to automatically create the symlinks via udev, it looks like the info required to create that ‘by-id’ string can be pulled from /proc/bus/usb/devices on the NAS
So which is best, using your script as base to generate /lib/udev/rules.d/59-usb-serial.rules and restart udev or manually create symlinks (in that case what is the device name eg. /dev/ttyUSB1)?
The script that @MizterB was not working for me (100%), only /dev/ACMx was working, my /dev/USBx was not “discovered”.
Here is a fixed version:
#!/bin/bash
for tty_path in $(find /sys/bus/usb/devices/usb*/ -name tty); do
tty_iface_path=`dirname $tty_path`
serial_device_path=`dirname $tty_iface_path`
prefix=usb
if test -f "$serial_device_path/idVendor"; then
idVendor=`cat $serial_device_path/idVendor`
product=`cat $serial_device_path/product`
idProduct=`cat $serial_device_path/idProduct`
serial=`cat $serial_device_path/serial`
bInterfaceNumber=`cat $tty_iface_path/bInterfaceNumber`
echo SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"$idVendor\", ATTRS{idProduct}==\"$idProduct\", SYMLINK+=\"serial/by-id/$prefix-$idVendor\_$product\_$serial-if$bInterfaceNumber\"
else
bInterfaceNumber=`cat $serial_device_path/bInterfaceNumber`
# We need to go up 1 level to get information
serial_device_path=`dirname $serial_device_path`
idVendor=`cat $serial_device_path/idVendor`
product=`cat $serial_device_path/product`
idProduct=`cat $serial_device_path/idProduct`
serial=`cat $serial_device_path/serial`
manufacturer=`cat $serial_device_path/manufacturer`
echo SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"$idVendor\", ATTRS{idProduct}==\"$idProduct\", SYMLINK+=\"serial/by-id/$prefix-$manufacturer\_$product\_$serial-if$bInterfaceNumber-port0\"
fi
done
#!/bin/bash
fix_usb_devices () {
RULES_FILE="/lib/udev/rules.d/59-usb-serial.rules"
for tty_path in $(find /sys/bus/usb/devices/usb*/ -name tty); do
tty_iface_path=`dirname $tty_path`
serial_device_path=`dirname $tty_iface_path`
prefix=usb
if test -f "$serial_device_path/idVendor"; then
bInterfaceNumber=`cat $tty_iface_path/bInterfaceNumber`
else
bInterfaceNumber=`cat $serial_device_path/bInterfaceNumber`
# We need to go up 1 level to get information
serial_device_path=`dirname $serial_device_path`
fi
idVendor=`cat $serial_device_path/idVendor`
product=`cat $serial_device_path/product`
idProduct=`cat $serial_device_path/idProduct`
serial=`cat $serial_device_path/serial`
manufacturer=`cat $serial_device_path/manufacturer`
symLink="${prefix}-${idVendor}\_${product}\_${serial}-if${bInterfaceNumber}"
line="SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"${idVendor}\", ATTRS{idProduct}==\"${idProduct}\", SYMLINK+=\"serial/by-id/${symLink}\""
echo $line
grep -s $symLink $RULES_FILE >/dev/null || \
echo ${line} >> $RULES_FILE
done
udevadm control --reload
}
fix_usb_devices