Z-Stick S2 (DSA02203) Controller is offline in OH4

Hi All,

I’m openhab user for many years. Last ~ 3 yrs I was using OH2 without major issues. Unfortunately, my Beagle Bone Black, on which the hab was running is dead. Therefore, I decided to utilise my Synology 220+.
However, attaching Z-Stick S2 (DSA02203) dongle was not straight forward process, even the device is listed in the supported items for OH4.

Anyway, I managed to make it visible in Synology OS (using this guide)

# ll /dev/ttyUSB0
crw-rw---- 1 root root 188, 0 Aug 29 20:23 /dev/ttyUSB0
# dmesg | grep USB0
[   60.893958] usb 1-2: cp210x converter now attached to ttyUSB0

I can also see it via Docker ssh.

# ls -al /dev/ttyUSB0
crw-rw---- 1 root root 188, 0 Aug 30 06:10 /dev/ttyUSB0
# dmesg | grep USB0
[   60.893958] usb 1-2: cp210x converter now attached to ttyUSB0

Karaf console has the following log items

13:33:55.659 [DEBUG] [ng.zwave.internal.ZWaveConfigProvider] - No bridgeUID found in getConfigDescription thing:zwave:serial_zstick:04e9a6bc96
13:33:57.056 [DEBUG] [zwave.discovery.ZWaveDiscoveryService] - Creating ZWave discovery service for zwave:serial_zstick:04e9a6bc96 with scan time of 60
13:33:57.057 [DEBUG] [zwave.discovery.ZWaveDiscoveryService] - ZWave discovery: Active zwave:serial_zstick:04e9a6bc96
13:33:57.058 [INFO ] [.zwave.handler.ZWaveControllerHandler] - Attempting to add listener when controller is null
13:33:57.067 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'zwave:serial_zstick:04e9a6bc96' changed from UNINITIALIZED (DISABLED) to INITIALIZING
13:33:57.073 [DEBUG] [ding.zwave.handler.ZWaveSerialHandler] - Initializing ZWave serial controller.
13:33:57.075 [DEBUG] [.zwave.handler.ZWaveControllerHandler] - Initializing ZWave Controller zwave:serial_zstick:04e9a6bc96.
13:33:57.078 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'zwave:serial_zstick:04e9a6bc96' changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE): Controller is offline

the thing status also keep showing

Status: OFFLINE
**BRIDGE_OFFLINE**
Controller is offline

Bindings also looks fine

openhab-core-io-transport-serial-javacomm         │ 4.0.2            │ x        │ Started     │ distro-4.0.2             │
openhab-transport-serial                          │ 4.0.2            │          │ Started     │ distro-4.0.2             │ Serial Transport
openhab.tp-serial-javacomm                        │ 4.0.2            │          │ Started     │ distro-4.0.2             │
openhab.tp-serial-rxtx                            │ 4.0.2            │          │ Started     │ distro-4.0.2             │
openhab-binding-zwave                             │ 4.0.2            │ x        │ Started     │ openhab-addons-4.0.2     │ Z-Wave Binding

So, does anyone have idea what I’m missing or how to troubleshoot the issue? … Yes I went trough the rest of the articles with similar issues.

Thanks

You should put the binding into debug level logging and see what sort of problems may be encountering.

But all thinks considered, you’ve hacked your Synology to get USB support in the first place. Just because you see the device file doesn’t mean it’s actually working. You are pretty far off from anything supportable by the contributors to this forum.

Looking at the openHAB installation docs for Synology: https://www.openhab.org/docs/installation/synology.html, the device file’s permissions need to be modified so that the group is dialout instead of root and the openhab user needs to be a member of that group.

It also indicates those instructions work on DSM 7 so are you sure you need that serial drivers hack in the first place? Maybe the OH docs are out of date?

I definitely know though that if the user running openHAB isn’t in the root group, which it shouldn’t be and certainly is no by default, it’s not going to have permission to read the serial device, given you current configuration.

Thank you @rlkoshak,

Looks like the permissions you pointed out were changed after reboot. As I did initially set them according to the guide I just miss the change.

Now I have my Z-stick operational. Hope the below will help others looking how to make it work because the docs for running OH on Synology are not valid for DSM7.2

To make it work on Synology 220+ DSM7.2

  1. Download CP2102 USB to UART Driver: geminilake/dsm-7.2/cp210x.ko to Synology /lib/modules

  2. Create Synology Boot-up Scheduled Task

    #!/bin/sh
    chmod 760 /var/lock
    insmod /lib/modules/cp210x.ko > /dev/null 2>&1
    chown root:dialout /dev/ttyUSB0
    chmod g+rw /dev/ttyUSB0
    

    :warning: now I need to figure out the right /var/lock permissions, but they will be also reset on reboot.

    This will result in Synology notification, like Security risks detected on NAS02. Please go to Security Advisor for more information. Details

  3. Set /dev/ttyUSB0 permissions inside the openhab container - OH Docs

    root@openhab:/openhab# chown openhab:openhab /dev/ttyUSB0
    root@openhab:/openhab# chmod o+rw /dev/ttyUSB0
    root@openhab:/openhab# ls -al /dev/ttyUSB0
    crw-rw---- 1 openhab openhab 188, 0 Sep  5 09:54 /dev/ttyUSB0
    

    To automate this follow Executing shell scripts before openHAB is started article.

    3.1 Create /etc/cont-init.d, e.g. in /docker folder.

    3.2 Create usbConf.sh script and save it under /etc/cont-init.d

    #!/bin/bash
    chown openhab:openhab /dev/ttyUSB0
    chmod g+rw /dev/ttyUSB0
    

    3.3. Add a volume mount to the exported container .json file

       "volume_bindings" : [
       ...
       {
          "host_volume_file" : "/docker/etc/cont-init.d",
          "is_directory" : true,
          "mount_point" : "/etc/cont-init.d",
          "type" : "r"
       }
       ...
    

There are not many who are running OH on Synology. If the docs are incomplete or incorrect and you know how to fix them we would love if you’d give that a go. There’s a link at the bottom of the page which will take you straight to where you can propose the edits. See [Wiki] How to contribute to the openHAB Documentation for a way more detailed tutorial than you need.

Sure, I’ll do once I manage to validate the mandatory steps and permissions.

Done.

1 Like

Update DS to Version: 7.2.1-69057 Update 3, 4

:white_check_mark: The good news is that cp210x.ko still works with

  • DS v7.2.1-69057 Update 3
  • DSM 7.2.1-69057 Update 4

:warning: The update will delete the usb driver.

Therefore, after the update finishes, before starting OH,

  1. Download USB to UART Driver to /lib/modules.
  2. Execute #2 from the above post to avoid reboot.
1 Like