Setting up openHAB 2 on Synology + Z-Wave (beginner here)

I’ve been trying to configure openhab2 on my synology server as well. I don’t use Z-Wave, but use another serial interface to communicate with sensors. This post is very promising as I couldn’t figure out how to access the serial port.

I’m familiar with adding openhab to the dialout group in linux, but what is the uucp group? Do I simply need to add the groups or is there additional configuration?

I just added the groups to the Synology user database, nothing special about it.

I rewrote the original post so that it can be of some use to someone else using OpenHAB 2 on a Synology, using the latest SPK released on github (2.1.0.004-SNAPSHOT-DSM6 on openhab/openhab-syno-spk). In any case I still have some questions that may be simple for non-beginners, if someone can help I’d be thankful:

  • I have no idea on how to create a control/switch for a group of items other than adding a button on the Panels UI. I find this is necessary so that I actually have an item that can be detected by i.e. mobile apps or even in the “Basic UI”. Groups and scenes are concepts kind of different from of other platforms and the documentation is not straightforward. I understand how to add devices to a Group (create a Group item and edit each Item by adding it to that Group), but not how to actually have something like a “switch channel” associated with that Group.

  • Node 5 (FGRM222 Roller Shutter) is isolated as seen in the network diagram below, and after many trials to heal the network and the node itself, it still doesn’t route to any neighbour other than the controller (Node 7):

  • I actually had to move the USB Z-Stick (temporarily) closer to it in order to successfully remove and add it from the network, and most importantly, make OpenHAB2 recognise and fully initialise it.

  • The network is physically similar to the drawing although nodes 3 and 6 are the ones closer to node 5.

  • All the nodes are at similar distances from the Z-Stick controller on its usual location, although there are some additional walls between that position and node 5.

  • Here’s my network diagram:

  • And here’s a schematic of the physical layout (black lines are walls):

Wait, so did you connect the AEOTEC Z-Stick USB Z-Wave Controller to the USB port on the Synology NAS?

Thanks a lot - this post helped to get the Z-wave uzb1 stick running on the synology NAS. Especially the ssh assignment was important

I guess it is kinda late, but as this thread is coming up among the first ones on a Google search with Z-Wave and Synology, I wanted to add that this information finally helped me getting the stick working after reboot (chmod 777 /dev/ttyACM0 always worked only until next reboot):

Sorry, had notifications disabled. Yes, I do, currently on OpenHab 2.3.0

I’m doing the same with a script, but I also added the script to a scheduled task in DSM so that I can run the it manually from DSM UI - i.e. triggering it manually without rebooting.

Using:

/bin/sh /usr/local/etc/rc.d/S98openhabzwave.sh start

Here’s the script I run, just once, on the Synology for the USB port.

# UDEV rules directly echoed to the target file
echo 'ACTION=="add", KERNEL=="ttyACM[0-9]*", MODE="0660", OWNER="openhab", GROUP="dialout"' >> /lib/udev/rules.d/99-aeon-z-stick.rules
chmod 755 /lib/udev/rules.d/99-aeon-z-stick.rules
# Start up script directly echoed to the target file
echo -e '#!/bin/sh\nstart_modules(){\n\techo ls -l /dev/tty[AU]* >> /volume1/public/zwavelog.txt\n\tchown -R root.uucp /run/lock\n\tchmod -R g+w /run/lock\n\tchown -R root.uucp /var/lock\n\tchmod -R g+w /var/lock\n}\nstop_modules(){\n\techo "do nothing"\n}\ncase "$1" in\n\tstart)\n\t\tstart_modules\n\t;;\n\tstop)\n\t\tstop_modules\n\t;;\n\t*)\n\t\techo "usage: $0 { start | stop }" >&2\n\texit 1\n\t;;\nesac\nexit 0' >> /usr/local/etc/rc.d/S98openhabzwave.sh
chmod 755 /usr/local/etc/rc.d/S98openhabzwave.sh
# Set owner of device once
chown openhab /dev/ttyACM0
reboot

I have 2 Synology’s in a HA pair (active/passive) with mirrored Aeotec zWave controllers in each.

Best, Jay

1 Like

Thanks. I ran this once and now my Aetec zwave controller is working in OpenHAB.
Do I need to run this after each DSM update?
Is it possible that the device name changes across reboots?

You can use Task Scheduler in DSM to make it run the script on boot. Mine is pointing to “/bin/sh /usr/local/etc/rc.d/S98openhabzwave.sh start”.
This will survive DSM updates.
I have it running every few hours just so that if I happen to unplug the USB stick it will eventually find it again.

Nope; I’ve only ran it once over the last 7 months.

Best, Jay

I tried to modify it to include my RFXCOM USB transceiver, but I still have to manually run the ‘chown openhab /dev/ttyUSB0’ after rebooting. Strange.

# UDEV rules directly echoed to the target file
echo 'ACTION=="add", KERNEL=="tty(ACM|USB)[0-9]*", MODE="0660", OWNER="openhab", GROUP="dialout"' >> /lib/udev/rules.d/99-aeon-z-stick.rules
chmod 755 /lib/udev/rules.d/99-aeon-z-stick.rules
# Start up script directly echoed to the target file
echo -e '#!/bin/sh\nstart_modules(){\n\techo ls -l /dev/tty[AU]* >> /volume1/public/zwavelog.txt\n\tchown -R root.uucp /run/lock\n\tchmod -R g+w /run/lock\n\tchown -R root.uucp /var/lock\n\tchmod -R g+w /var/lock\n}\nstop_modules(){\n\techo "do nothing"\n}\ncase "$1" in\n\tstart)\n\t\tstart_modules\n\t;;\n\tstop)\n\t\tstop_modules\n\t;;\n\t*)\n\t\techo "usage: $0 { start | stop }" >&2\n\texit 1\n\t;;\nesac\nexit 0' >> /usr/local/etc/rc.d/S98openhabzwave.sh
chmod 755 /usr/local/etc/rc.d/S98openhabzwave.sh
# Set owner of device once
chown openhab /dev/ttyACM0
chown openhab /dev/ttyUSB0
reboot

I see your posting on the GitHub OH2.4 SPK area also; I haven’t read the instructions on the GitHub page until now and it mentions stuff that appplies to the USB port which may apply to your Synology? I didn’t have to do this because I only have the OH 2.3 version installed which is part of the Synology library installed. I’m waiting for upgrade instructions from the developer in order to get mine to 2.4 also.

For usage of serial devices you need to check if openhab user has the appropriate rights to access the device in /dev and to create lock files in /run/lock

To do so the installer tries to add the openhab user to the groups dialout and uucp . But these groups are not present on all synology diskstations.

/run/lock for instance is created as this on a ds214play:

drwxr-xr-x 5 root root 160 Dec 9 20:11 lock

and /dev/ttyUSB0 is per default also created for root only:

crw------- 1 root root 188, 0 Dec 4 12:55 /dev/ttyUSB0

Best, Jay

This is the script I’m using, if it helps:

start_modules(){
echo ls -l /dev/ttyA* >> /volume1/smarthome/openHAB/zwavelog.txt
chown -R root.uucp /run/lock
chmod -R g+w /run/lock
chown -R root.uucp /var/lock
chmod -R g+w /var/lock
synogroup --add tty openhab
synogroup --add dialout openhab
chmod 0777 /dev/ttyA*
chown openhab /dev/ttyA*
}
stop_modules(){
echo "do nothing"
}
case "$1" in
start)
start_modules
;;
stop)
stop_modules
;;
*)
echo "usage: $0 { start | stop }" >&2
exit 1
;;
esac
exit 0

Hello, I’m new here, but i have the same problem with my USB Z-wave stick. I have the DSM version “DSM 6.2.1-23824 Update 4”.

I have done everything like mentioned above, but i can’t generate the both files, because i have no access to this folder. I get following answer “-sh: /lib/udev/rules.d/99-aeon-z-stick.rules: Permission denied”

What can I do, to generate this files?

are you using elevated permissions? Issue sudo -i

I have done it, but i’m not sure if it working well. I have no response that everything was done, and it is not working. Please find below my script:

root@Server:~# echo 'ACTION=="add", KERNEL=="ttyACM[0-9]*", MODE="0660",  OWNER="openhab", GROUP="dialout"' >> /lib/udev/rules.d/99-aeon-z-stick.rules
root@Server:~# chmod 755 /lib/udev/rules.d/99-aeon-z-stick.rules
root@Server:~# echo -e '#!/bin/sh\nstart_modules(){\n\techo ls -l /dev/tty[AU]* >> /volume1/public/zwavelog.txt\n\tchown -R root.uucp /run/lock\n\tchmod -R g+w /run/lock\n\tchown -R root.uucp /var/lock\n\tchmod -R g+w /var/lock\n}\nstop_modules(){\n\techo "do nothing"\n}\ncase "$1" in\n\tstart)\n\t\tstart_modules\n\t;;\n\tstop)\n\t\tstop_modules\n\t;;\n\t*)\n\t\techo "usage: $0 { start | stop }" >&2\n\texit 1\n\t;;\nesac\nexit 0' >> /usr/local/etc/rc.d/S98openhabzwave.sh
root@Server:~# chmod 755 /usr/local/etc/rc.d/S98openhabzwave.sh
root@Server:~# chown openhab /dev/ttyACM0
root@Server:~# reboot

Broadcast message from XXX@Server
    (/dev/pts/15) at 22:22 ...

The system is going down for reboot NOW!

Is this correct, that there is no confirmation from the server?

Hey, its me again.

I have test again some things and can’t find the failure. I have added the user “openhab” and “openhab2” to group “tty”, “dialout” and “uucp”. I have red different users and groups in the internet, so i have made everything.

I have checkt the both files which should be crated:

root@Server:~# tail -n 1 /lib/udev/rules.d/99-aeon-z-stick.rules
ACTION=="add", KERNEL=="ttyACM[0-9]*", MODE="0660", OWNER="openhab", GROUP="dialout"

and

root@Server:~# tail -n 1 /usr/local/etc/rc.d/S98openhabzwave.sh
start_modules(){echo ls -l /dev/tty* >> /volume1/public/tmp/zwavelog.txtchown -R root.uucp /run/lockchmod -R g+w /run/lockchown -R root.uucp /var/lockchmod -R g+w    /var/lock}stop_modules(){echo “do nothing”}case “$1” instart)start_modules;;stop)stop_modules;;*)echo    “usage: $0 { start | stop }” >&2exit 1;;esacexit 0

I have also set the rights for both files with “chmod 755 …”.

After that I have bought a new Z-Wave-Sticks and have tested it with the “Aeotec Z-Stick Gen5” and “Z-wave.me ZMEEUZB”, but it will not work. I get following message: “Status: OFFLINE - COMMUNICATION_ERROR Serial Error: Port /dev/ttyACM0 does not exist”.

Has anyone an idea what’s going wrong at my Synology?

Hello,

I have again tested some things and need your help by interpretation. At the moment I’m working with obenHAB version 2.3.0.005, because Version 2.4 and 2.2 will not start. I can install them, but when i want to start it in the package manager it doesn’t work. Is there maybe another problem? I have installed it in the Smarthome folder and the public folder, but there are no difference.

I have again testet the script and I’think the script is working, at least I get no failures when I start it with /bin/sh /usr/local/etc/rc.d/S98openhabzwave.sh start

I can find than the zwavelog.txt with the content “ls -l /dev/ttyACM0” and when I use “ls -l /dev/ttyA*” I get folowing result:

crwxrwxrwx 1 openhab dialout 166, 0 Feb  6 18:02 /dev/ttyACM0

Can someone say me, if this is correct or has an idea what is going wrong?