Openhab on Synology

PreRequisite :        2

Installation        2

Install Synology Docker.        2

Install OpenHab Docker Image        3

Connect to your Synology server with SSH as root        3

Setup User & Folder        3

Install and run the openhab docker image        3

Perform the OpenHab initial setup        4

Sony Beamer        4

OpenWebNet BTicino Binding        6

Enable Eclipse IOT Marketplace        6

Install the OpenWebNet Binding        6

Install the OpenWebNet dependencies using the openhab OSGi console        7

Configure F454 Bus        7

Other info        8

Set debug logs on openwebnet binding        8

Connection a openhab from outside from home        9

Internet box network settings        9

SSH connection        9

Connect to the OSGi Console        9

List Bindings        9

Tail logs        10

Find the IP of the OpenHab Container        13


PreRequisite :

You should know the following :

Installation

Install Synology Docker.

From the Package Center, search & install docker :


Install OpenHab Docker Image

References :

https://www.openhab.org/docs/installation/docker.html

https://hub.docker.com/r/openhab/openhab

https://www.openhab.org/docs/installation/synology.html

Connect to your Synology server with SSH as root

mac/linux:

ssh root@NAS_IP

Or use putty on windows

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Use putty.exe

Setup User & Folder

Copy paste each of the following command

#add a user & group for openhab

useradd -r -s -u 9001 /sbin/nologin openhab

usermod -a -G -g 9001 openhab openhab

#create folders for openhab

mkdir -p /volume1/docker/openhab/conf

mkdir  /volume1/docker/openhab/userdata

mkdir  /volume1/docker/openhab/addons

#set the correct rights on the folder

chown -R openhab:openhab /volume1/docker/openhab

Install and run the openhab docker image

docker run \

        --name openhab \

        --net=host \

        -v /etc/localtime:/etc/localtime:ro \

        -v /etc/timezone:/etc/timezone:ro \

        -v /volume1/docker/openhab/conf:/openhab/conf \

        -v /volume1/docker/openhab/userdata:/openhab/userdata \

        -v /volume1/docker/openhab/addons:/openhab/addons \

        -d \

        -e USER_ID=9001 \

        -e GROUP_ID=9001 \

        --restart=always \

        openhab/openhab:2.5.0-amd64-debian

Upgrading your existing installation

docker stop openhab

docker rm openhab

Update the version (2.5.0 to 2.5.1 for exemple) in the script here

Perform the OpenHab initial setup

Connect to http://IP_OF_YOUR_NAS:8080

And complete the initial setup :

https://www.openhab.org/docs/tutorial/1sttimesetup.html

I’ve setup the binding for Philips Hue, my beamer and AV prior to setting up OpenWebNet Bticino.

Sony Beamer

Pioneer AV

Philips Hue


OpenWebNet BTicino Binding

Resources :

Enable Eclipse IOT Marketplace

Go to “Add-Ons”, “Misc” and install “Eclipse IoT Market”

Install the OpenWebNet Binding

Wait a few dozen of seconds after installing Eclipse IoT Marketplace and search

openwebnet

Click Install

Install the OpenWebNet dependencies using the openhab OSGi console

Connect to the OSGi Console and type two the following commands

feature:install openhab-core-io-transport-upnp

feature:install openhab-transport-serial

It should take a few seconds to execute and each return silently

Configure F454 Bus

Go to Inbox, you should see the following :

Click the blue button, the following window will appear :

Click “Add as Thing”

The Inbox will be updated with all your light switch & other stuff

You should see :


Automation : Roller shutter / blind / (store / volet roulant en francais)

Switch : your light switchs

Thermotstat : the temperature measuring stuff

Energy Central Unit : probably where you can configure room temperature

Add your roller shutter, it will be available in the “other” room.

Test each to know which is which, and rename them accordingly with the name of the correct room

Other info

Set debug logs on openwebnet binding

Connect to the OSGi Console and type the following command

log:set DEBUG org.openhab.binding.openwebnet

log:set DEBUG org.openwebnet


Connection a openhab from outside from home

Internet box network settings

On your internet box, setup a port forwarding :

(internet) port 4888

To

IP_OF_YOUR_NAS port 22

SSH connection from a Mac/Linux box

Connection to your Synology NAS in SSH with a Tunnel to access OpenHab web interface  :

/usr/bin/ssh -o TCPKeepAlive=yes -o ServerAliveInterval=10 -o ServerAliveCountMax=6 -p4888 -L7080:IP_OF_YOUR_NAS:8080 root@YOU_PUBLIC_IP

http://localhost:7080

On windows you can use Putty to define port forwarding.

Connection from Android with the Mobile App

Setup Steps :

  1. KeyChain-> + -> Generate key: set name, type RSA, set a passphrase and check “save passphrase”
  2. Host -> + ->
  1. Name:  Nas (your synology server)
  2. Hostname or IP : your Nas public IP (your box must make a port forwarding to your nas)
  3. Check SSH
  4. Sepcify the port you set on your internet box for port forwarding
  5. Username :  a valid Nas user
  6. Key : use the Key created in step 1
  1. Port Forwarding -> + ->
  1. Label: openhab
  2. type: locale rule
  3. host from: Nas
  4. port from : 7080
  5. Host to: Your OpenHab IP
  6. Port to: Your OpenHab port : 8080
  7. Last field:  127.0.0.1 (to allow only your android phone to use this port forwarding)

Usage Steps :

  1. Go to Port Forwarding, and activate the port forwarding rule we’ve created by clicking on it
  2. Go to Host to connect to your Nas

In the OpenHab Application:

Go to Settings,

Local :

  1. Your local IP address of your OpenHab install :  http://192.168.1.50:8080

Remote :

  1. The address must look like this :  http://127.0.0.1:7080

The application will connect to your phone (127.0.0.1 is always your own device local IP), and connect to 7080 port. Which is a port that is forwarded to your  openHab instance IP and port 8080 through the SSH connection.

Connect to the OSGi Console

docker exec -it openhab bash

/openhab/runtime/bin/client

Default password is habopen

List Bindings

bundle:list

Tail logs

log:tail


Docker Env Variables


Find the IP of the OpenHab Container

Connect to http://IP_OF_YOUR_NAS:8080

Go to Configuration -> System, network settings

http://IP_OF_YOUR_NAS:8080/paperui/index.html#/configuration/system

If the field is empty, click on the arrow, and select the only IP available, it’s the IP of OpenHab docker image.

OpenHab & Google Home

https://www.openhab.org/docs/ecosystem/google-assistant/

https://assistant.google.com/services/a/uid/000000f5c61c627e?hl=en-US&source=web

https://github.com/openhab/openhab-cloud

https://console.actions.google.com/u/0/project/myhome-25f9e/actions/smarthome

2.5.0 release

https://www.openhab.org/blog/2019-12-14-openhab-2-5-release.html