Hi All,
finally I solved the problem of the USB devices (like Z-Wawe sticks) on Synology platform
I found lot of articles and lot of solutions, so I decided to make a definitive guide:
Problems:
- Permsssion : Synology install tty devices with root permission and openHab connot use them
- Name: the name of the device is changed every time so you can have ttyUSB0 or ttyUSB1, etc with the necessity to modify the controller configuration every time the USB i reinserted or the server rebooted
to solve the problem the key is udev and its magic!
- ssh in the Synology
- cd /lib/udev/rules.d (where udev rules are stored)
- sudo vi 99-openhab.rules (create a new rule .rules is mandatory)
- in the new file enter this two rules:
4.1 DRIVERS==“cp210x”, ATTRS{interface}==“Standard Com Port”, SYMLINK+=“ttyUSB4”,OWNER:=“openhab”,GROUP:=“users”, MODE:=“0666”
4.2 DRIVERS==“cp210x”, ATTRS{interface}==“HubZ Z-Wave Com Port”, SYMLINK+=“ttyUSB3”,OWNER:=“openhab”,GROUP:=“users”, MODE:=“0666”
DRIVER and ATTRS are used to identify the device to map, you can check your device information using the udevadm info -a /dev/ttyUSB0 on the device to map to find the correct rules
the key point is to use as a SYNLINK a ttyUSBx name because if you use a dfferent one, openHab do not include it in the list of available ports. I found lot of article on haw to add a new name to the list, but I was unable to find the right place to add the setting in synology
- sudo udevadm control --reload
- disconnect and riconnect the device
- check the results ls -la /dev, you sould find the original USB port whit openhab:user and two synlink to ttyUSB3 and ttyUSB4.
- in the controller configuration you will find the new ttyUSB3 and ttyUSB4 ports.
Every Synology update you need to recreate the 99-openhab.rules file, so keep a copy somewhere!
Hope this helps some one!
regards
.