Synology DiskStation

I installed OpenHab 2.3
How can I install:
Node-red?
Paper Log View?

sorry, i don’t use either of those two.

Has anybody implemented delayed RULES logic (below) in their openhab2.service due to more than 1 startup rule firing when starting up OH2?

If so, Synology doesn’t have “systemctl” nor can I find the “openhab2.service” file.

Running OH2.3, latest build for OH.

Any help would be grateful!

Best, Jay

My prefered variant

This is the most simple alternative, but just works with linux and systemd (e.g. openhabian). Thanks to @ptweety for this variant.

Simply create the file `/etc/systemd/system/openhab2.service.d/override.conf. This overrides the standard startup script where applicable.

If you are on stretch-based openhabian, you may use sudo systemctl edit openhab2.service , otherwise you have to use sudo nano /etc/systemd/system/openhab2.service.d/override.conf

[Service]
ExecStartPre=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.rules" -exec /usr/bin/rename.ul .rules .rules_away {} \\;'
ExecStartPre=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.script" -exec /usr/bin/rename.ul .script .script_away {} \\;'
ExecStartPost=/bin/sleep 240
ExecStartPost=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.script_away" -exec /usr/bin/rename.ul .script_away .script {} \\;'
ExecStartPost=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.rules_away" -exec /usr/bin/rename.ul .rules_away .rules {} \\;'
TimeoutStartSec=360

That’s it.

Is there a package for the new release for OH 2.4.0 for synology?
And the fix for the USB permisssions?

i’ve moved to a docker container myself

Do you find the socket container update process is easier?

Any issues with usb ports etc?

Seems to be a ok. You have to hand edit the config and I can help you with that. It was a lot easier than I thought it would be, even making my own docker that includes curl and nano and python for speedtest

Hello,
I’m also interested in updating in the Nas Synology DS216J with OH 2.4.0, I have no idea how to do it.
Can you post as you did?

I installed OH 2.3.0 with 2.3.0.005

Sure, I’ll try to include as much as I remember. You’ll have to adjust for your individual setup, so pay attention.
First, if you don’t already have docker, install it. Then, in docker, click on registry and in the seach box type openhab.


It’ll download and then appear in the “image” section of docker. Give it some time to fully download.
While that’s taking place, lets talk about folders and such. Hopefully your folders live in the public share. If not, this is where you’ll adjust what happens next.
If you do use public, your openhab configuration lives in /volume1/public/openHAB
you’ll need to map /volume1/public/openHAB/addons userdata and conf to their respective folders under /openhab - more on this is a second

Once fully downloaded, select it and click “launch.” Give it a name and click “Advanced Settings” and then the Volume tab. Ignore the localtime and timezone entries for now, focus on userdata, addons, and conf.
If you know what I’m doing there, great. If not, don’t worry about it right now.
Make yours look like this:
image

Next, click on the “Ports” tab. It’s going to get a little hairy here. Depending on what ports you have in use elsewhere on your system you may need to at the very least set these to something else while you transition and then you can change them back. Once you’re comfortable that it’s working you can uninstall the synology OH package and eventually set your ports back.

Also, now is a good time to mention you should have an “openhab” user and “openhab” group created through the control panel. If you created them through ssh and they’re not visible through control panel, fine. Make a note of the openhab UID and GID. (you can find these in /etc/paswd and /etc/group find openhab and look for the first number:
image
mine is 1028 - > UID for openhab)

Back to docker, click on the “Environment” tab. Change the highlighted settings to your environment:
Ignore the device one, i don’t think that does anything - we’ll get to that later
image

Then click “Apply” and “Next” but uncheck the box for running the container and finally click “Apply.”

Now your container should be almost ready to go.
Next we hand edit the container file to make life a little easier.
Still in the docker app click on the “Container” tab on the left side and select the container you just created.
Click “Settings” then “Export” and download the config to your local computer


Open the json file that you just downloaded in your favorite editor (notepad++ ?)
Now is the time we add the z-wave stick if you have it. At the top of the file, make yours look like this, adjusting for your own system:
image

   "devices" : [
      {
         "CgroupPermissions" : "rwm",
         "PathInContainer" : "/dev/ttyACM0",
         "PathOnHost" : "/dev/ttyACM0"
      }
   ],

You also need to add localtime and timezone which is either a pain or not really possible through the UI.
Find in your json file the section that looks like this:
image
That’s not exactly right in the picture but it’s corrected here in the text for you:

      {
         "host_volume_file" : "/etc/timezone",
         "mount_point" : "/etc/timezone",
         "type" : "ro"
      },
      {
         "host_volume_file" : "/etc/localtime",
         "mount_point" : "/etc/localtime",
         "type" : "ro"
      },

Save the file. Back on the synology using “File Station” upload the file you just saved. Then in docker delete the container you created. Once deleted, click settings at the top and Import. Point it to the file you uploaded with file station. You’ll have a new container with your custom settings.

Now might be a good time to shut down the openhab package. After that’s off, you can start that docker container. On the running container click “Details”
image

Then you can look at the terminal and create a bash terminal if you want.

Here you see a karaf console and a bash console. You’ll probably see a bunch of errors. A lot of the config files were customized for the synology install. You’ll need to hand edit a lot of those files to fix all the paths. It’s a pain, but you do it once and it’s done.

I know this all looks complicated, but it’s really not.

In a session opened to the synology (not the openhab terminals) cd /volume1/public/openHAB/userdata
then “grep -r appstore” you’ll get a list of all the config files that have synology specific paths.
use nano or vi or whatever to edit those files. the base path in the openhab container for everything is /openhab
so edit the paths in those files

2 Likes

Thanks for your detailed explanation, unfortunately I have DS226J and Docker is not compatible.
Quite right ?

no idea, sorry. man, i spent 30 minutes writing that up :stuck_out_tongue:

It will certainly serve to another user :wink:

Hello @cniweb,
do you have updates of how to update DS216J, no Decker, with OH 2.4.0?

I might use it, thanks for the write up!

Now, how do you update when 2.5.0 releases?

change the image tag you download. probably need to edit the json file a little, too.

1 Like

I have a new 2.4.0.000 Release deployed:

2 Likes

That’s awesome news @cniweb
Thanks for your work! :grinning:

Thanks, fantastic !!!

@cniweb
I installed the 2.4 over my 2.3.
All of my bindings, things and items are gone!
Is there anyway to retrieve them??

Do you have the recycle bin enabled for the share that the files were on?