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

Updated: I’ve cleaned this up after giving it another go with “2.1.0.004-SNAPSHOT-DSM6

Hi,
I’m using this post as a record of my migration from using a micasaverde VERA 2 as a controller in a very simple Z-wave network. It has been pretty much successful so far.

  • My home network consists of only 6 Z-wave devices and I’ve also fiddled with other OpenHAB 2 bindings:

  • 1 un - Aeon Labs/AEOTEC Z-Stick Gen5 USB Z-Wave Controller

  • 3 un - Fibaro Rollerblind controllers FGR221 (no power sensors)

  • 2 un - Fibaro Rollerblind controllers FGRM222 (newer versions)

  • The first step was to add the Z-Stick to my original network and then move the Z-wave network (controller shift) from the Vera to the Z-Stick. I later checked with desktop software (zensys, etc) that it appeared to be ok, and after that removed the Vera altogether from the network

  • While preparing to make OpenHAB 2 actually run on the Synology NAS, I determined that I was necessary to:

  • Create folders /volume1/public/OpenHAB2/addons and /volume1/public/OpenHAB2/conf (not configurations)

  • Create dialout and uucp user groups to the DSM and adding the openhab2 user as a member of those two groups

  • Solve the “Serial Error: Port /dev/ttyACM0 does not exist” Z-Wave binding issue with ssh’ing:

sudo chmod 777 /dev/ttyACM0
  • Notice that when you disconnect your USB stick from the NAS it will reconnect in the next “slot”, so the port will most likely now be /dev/ttyACM1. You can either a) change the serial port in the thing properties within OpenHAB 2 or b) unplug it and maybe it will reconnect on the other port. To check you can just issue ls /dev/ttyACM0 to check if it exists or not. Side note: this issue also happened with Domoticz, it’s probably difficult to get it working automatically.

  • I found that the script I had here before doesn’t make any difference now. If it doesn’t work after you check you’re using the right port, just restart the OpenHAB 2 package.

  • At this time I had OpenHAB2 running on yournas:8080/start/index:

  • After adding the Z-Wave binding I was able to add the Z-Stick controller as a new Things and quickly after that I had 5 other Things detected

  • Note that before adding Items you should have edited each _thing´_s name so that the channel id will be more legible. That will be useful later on, for more complex tinkering.

  • The other thing to consider is that unlike previous OpenHAB 2 versions, channels are no longer created automatically (although you can switch that under PaperUI > Configuration > System > Item Linking > Simple Mode. I prefer to leave unmarked as you can be more selective on which items you actually add to the system.

  • The Z-Stick was not accurately detected: it shows up as Z-Wave Serial Controller, it has 5 fields with a Value label, a couple of those have numbers floating around and the other 3 do not have any info. But it does work.

  • The network doesn’t respond to networks with the same reliability of Domoticz. With Domoticz everything just worked, unless an update broke it. With OpenHAB 2 what happens is that there are some instances where the commands aren’t issued, up to a point where a restart is necessary.

  • The Z-Wave Fibaro Roller Shutter modules were for the most part detected. I finally was able to reset one that was being stubborn and wouldn’t run, although it isn’t working as it should (more on this below). Here’s my network diagram (from HABmin > Tools )

  • Additional OpenHAB2 Bindings / Services / Etc I’m using:

  • YahooWeather (for local weather temperature, humidity and pressure information)

  • Astro Binding (for getting sunset/sunrise time)

  • Network Binding (to detect my Mobile Phone when connected to my Wi-Fi network)

  • HomeKit (installed but I’ve yet to understand exactly what to do with it to make it work)

  • HABmin and Panels UI

Except for HomeKit and UI’s, all these others are to be used in the future, as soon as I understand how to use them in blockly instructions.

Hope this helps someone.


(22 March 2017) Currently I have two issues to tackle:

  • 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, 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):


(27 March 2017) I went back to Domoticz, for the time being. OpenHAB2 is no way as stable as Domoticz is and not as easy to use when it comes to creating scenes / groups. I was losing connectivity from time to time (days), and that alone is enough to put it aside for now.

1 Like

Pretty much solved here:

just wanted to say thanks for listing the steps simply to get a Z-Stick working with a Synology NAS and openHAB2.

I found a lot of confusing threads on how to configure it, only yours provided everything I needed to get it setup in under 5 minutes. Tis a Christmas miracle.

1 Like

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