Docker revisited: OpenHAB 2.0 on Synology

paper-ui

After testing the OpenHab 1.7.0 on Synology, it came to my mind that having now a working Docker setup would be great environment for trying out the daily snapshots of OpenHAB 2.0 alpha. Its new GUI, the Paper UI looks quite nice, and with it’s built-in autodetection one could configure at least some of the devices without fiddling with config files. I confess – As much I love hacking and tweaking, I’d still prefer devices to “just work”. Fine-tuning can come later, but it would be nice if I could play with devices as much as possible by just plugging them in, and in this regard OpenHAB is going right direction with its Paper UI.

Unfortunately there were no public Docker images for OpenHAB 2.0, so I had to roll my own. Here are the links to the Docker hub page and GitHub repository

Image can be downloaded with command:

docker pull wetware/openhab2

For further instructions for configuration and running the container, please see the Docker and GitHub pages above.

Information about changes in configuration and running between OpenHAB 1.x and 2.0 can be found here

Auto-detection of devices with UPnP

Unfortunately not all things work out-of-the-box when using Docker containers due to the missing multicasting support. Auto-discovery of new devices in Openhab 2.0’s new Paper UI uses mainly UPnP protocol. Also protocol called AllJoyn is listed, but I’m not that familiar with that one, although the supported devices and services list seems interesting (especially Spotify).

Detection is done by sending discovery UDP messages to address 239.255.255.250:1900. Other UPnP devices (such as Philips Hue hub) will response with a message to this same address. Sending the UDP multicast message is done correctly from the container, but receiving them however requires support from Docker to enable MULTICASTING on container network interface, which is not yet implemented (7/2015). You can follow the discussion here at the GitHub issue page There are 2 work-arounds available:

  • Run container with –net=host option. This will use the network interface of the host instead of creating a separate one for the container. In practice it will map 1:1 all ports on the container to the host and enable the container to receive multicast UDP messages.
  • Run container with –net=none option. This defers creating the network interface during the startup. Then on the host use pipework to create the network interface on the container side with IFF_MULTICAST set:
pipework docker0 -i eth0 CONTAINER_ID IP_ADDRESS/IP_MASK@DEFAULT_ROUTE_IP

BTW. If you have Philips Hue, the auto-detection for lights and other devices connected to the hub might not work automatically, since the hub must be first paired with OpenHAB. The Paper UI does not currently explicitly say this, but after the hub is detected, OpenHAB is waiting for the user to press a pairing button on the hub. Before the button is pressed, no devices can be found.

Feedback

As with the previous OpenHAB Docker image, I’d be happy to receive any comments, bug reports or other feedback related to running OpenHAB 2.0 on Docker!