Synology DiskStation

synology
Tags: #<Tag:0x00007f8760edf7f8>

(Michele) #302

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


(scott dee) #303

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


(Mr. Wiseman) #304

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.


(Daf De Giraf) #305

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


(scott dee) #306

i’ve moved to a docker container myself


(Mark Lavercombe) #307

Do you find the socket container update process is easier?

Any issues with usb ports etc?


(scott dee) #308

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


(Michele) #309

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


(scott dee) #310

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


(Michele) #311

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


(scott dee) #312

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


(Michele) #313

It will certainly serve to another user :wink:


(Michele) #314

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


(Mark Lavercombe) #315

I might use it, thanks for the write up!

Now, how do you update when 2.5.0 releases?


(scott dee) #316

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


(Christian Häussler) #318

I have a new 2.4.0.000 Release deployed:


(Mark Lavercombe) #319

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


(Michele) #320

Thanks, fantastic !!!


(Mark Lavercombe) #321

@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??


(scott dee) #322

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