User Tools

Site Tools


openhab

This is an old revision of the document!


OpenHAB

Pre-requisites

  • Ubuntu 16.04 Long Term Support (LTS) (I used VirtualBox on MacOS)
  • Docker Community Edition (DockerCE) v17.12.0-ce

Basic Installation (OpenHAB 2)

sudo useradd --system --shell $(which nologin) openhab
sudo usermod -aG $(whoami) openhab
sudo mkdir -p /opt/openhab/{addons,conf,userdata}
sudo chown -R openhab:openhab /opt/openhab

Create the following start-up file, I called mine /opt/openhab/run.sh:

#!/bin/bash -x
CMD=(
    docker run
    --name openhab
    --net=host
    --interactive
    --tty
    -v /etc/localtime:/etc/localtime:ro
    -v /etc/timezone:/etc/timezone:ro
    -v /opt/openhab/conf:/openhab/conf
    -v /opt/openhab/userdata/:/openhab/userdata
    -v /opt/openhab/addons/:/openhab/addons
    -e USER_ID=$(id -u openhab)
    -e GROUP_ID=$(id -g openhab)
    #--restart=always
    openhab/openhab:2.3.0-snapshot-amd64-debian
)
"${CMD[@]}"

and then make it executable:

sudo chmod a+x /opt/openhab/run.sh

Launch openHAB v2 and perform one-time setup

Note the IP address of the VM (e.g. ifconfig and find IP like 192.168.1.125)

/opt/openhab/run.sh

at the prompt, run log:tail to follow the log and see the installation occur.

then point web-browser at TCP port 8080, e.g. http://192.168.1.125:8080/ and select STANDARD.

Enable legacy addon compatibility layer

As per https://docs.openhab.org/developers/development/compatibilitylayer.html#how-to-use-openhab-1x-add-ons-that-are-not-part-of-the-distribution

If you are currently tailing the log, you need to press ^C (CTRL + C) to cancel that and get the prompt back, where you run:

openhab> feature:install openhab-runtime-compat1x
openhab>

then follow the logs again by running

openhab> log:tail

Install legacy OpenHAB v1 add-on for LightwaveRF

Find the URL for “openHAB Runtime 1.x Addons” at http://www.openhab.org/downloads.html, when I wrote this it was https://bintray.com/openhab/mvn/download_file?file_path=org%2Fopenhab%2Fdistro%2Fopenhab%2F1.11.0%2Fopenhab-1.11.0-addons.zip

cd /opt/openhab/addons
wget -O openhab-1.11.0-addons.zip \
    https://bintray.com/openhab/mvn/download_file?file_path=org%2Fopenhab%2Fdistro%2Fopenhab%2F1.11.0%2Fopenhab-1.11.0-addons.zip

then extract just the addon needed (try unzip -l openhab-1.11.0.addons.zip to list them):

unzip openhab-1.11.0-addons.zip org.openhab.binding.lightwaverf-1.11.0.jar

You should see the following:

18:22:05.597 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: IP[255.255.255.255]
18:22:05.599 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: ReceivePort[9761]
18:22:05.599 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Send Port[9760]
18:22:05.600 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Register On Startup[true]
18:22:05.600 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Send Delay [100]
18:22:05.602 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Timeout for Ok Messages [500]
18:22:05.606 [INFO ] [htwaverf.internal.LightwaveRfWifiLink] - Starting LightwaveRfWifiLink Connection
18:22:05.830 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":483,"mac":"20:3B:85","time":1514917325,"pkt":"error","fn":"nonRegistered","payload":"Not yet registered. See LightwaveLink"}
18:22:06.128 [INFO ] [verf.internal.LightwaveRFSenderThread] - Ok message not received for 100,!F*p
, retrying again. Retry count 2
18:22:06.433 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":484,"mac":"20:3B:85","time":1514917326,"pkt":"error","fn":"nonRegistered","payload":"Not yet registered. Send !F*p to register"}
18:22:06.730 [INFO ] [verf.internal.LightwaveRFSenderThread] - Ok message not received for 100,!F*p
, retrying again. Retry count 3
18:22:07.048 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":485,"mac":"20:3B:85","time":1514917326,"pkt":"error","fn":"nonRegistered","payload":"Not yet registered. Send !F*p to register"}
18:22:07.333 [INFO ] [verf.internal.LightwaveRFSenderThread] - Ok message not received for 100,!F*p
, retrying again. Retry count 4
18:22:07.560 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":486,"mac":"20:3B:85","time":1514917327,"pkt":"error","fn":"nonRegistered","payload":"Not yet registered. Send !F*p to register"}
18:22:07.935 [INFO ] [verf.internal.LightwaveRFSenderThread] - Ok message not received for 100,!F*p
, retrying again. Retry count 5
18:22:08.174 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":487,"mac":"20:3B:85","time":1514917328,"pkt":"error","fn":"nonRegistered","payload":"Not yet registered. Send !F*p to register"}
18:22:08.538 [ERROR] [verf.internal.LightwaveRFSenderThread] - Unable to send message 100,!F*p
 after 5 attempts giving up

You need to press the LINK button on the LightwaveRF Wi-Fi Link during those messages to pair it. This only has to be done once, and permits the MAC address of the VM to send commands to the LightwaveRF Wi-Fi Link.

If you miss get as far at the “giving up” message you can restart the binding to try again. Legacy bindings do not appear in the list of bundles, but you can effectively reload all of them by restarting the legacy compatibility layer.

openhab> bundle:restart "openHAB 1.x Compatibility Layer"
openhab>

This is what success looks like in the output of log:tail:

18:34:28.024 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: IP[255.255.255.255]
18:34:28.025 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: ReceivePort[9761]
18:34:28.026 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Send Port[9760]
18:34:28.026 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Register On Startup[true]
18:34:28.026 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Send Delay [100]
18:34:28.027 [INFO ] [ghtwaverf.internal.LightwaveRfBinding] - LightwaveBinding: Timeout for Ok Messages [500]
18:34:28.027 [INFO ] [htwaverf.internal.LightwaveRfWifiLink] - Starting LightwaveRfWifiLink Connection
18:34:28.227 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":509,"mac":"20:3B:85","time":1514918067,"pkt":"error","fn":"nonRegistered","payload":"Not yet registered. See LightwaveLink"}
18:34:28.546 [INFO ] [verf.internal.LightwaveRFSenderThread] - Ok message not received for 100,!F*p
, retrying again. Retry count 2
18:34:28.841 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":510,"mac":"20:3B:85","time":1514918068,"pkt":"error","fn":"nonRegistered","payload":"Not yet registered. Send !F*p to register"}
18:34:29.046 [ERROR] [htwaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":511,"mac":"20:3B:85","time":1514918068,"type":"link","prod":"lwl","pairType":"local","msg":"success","class":"","serial":""}
18:34:29.148 [INFO ] [verf.internal.LightwaveRFSenderThread] - Ok message not received for 100,!F*p
, retrying again. Retry count 3
18:34:29.359 [INFO ] [verf.internal.LightwaveRFSenderThread] - Ok message received for 100,!F*p

18:34:29.359 [WARN ] [ghtwaverf.internal.LightwaveRfBinding] - No item for incoming message[100,?V="N2.94D"
]
openhab.1514918202.txt.gz · Last modified: 2018/01/02 18:36 by robm