wolfgang ziegler


„make stuff and blog about it“

Wrong time in openHAB Docker Container on Synology

January 5, 2020

I recently moved my openHAB installation from a Raspberry Pi to a Docker installation running on my new Synology Diskstation. The whole process worked basically flawless until I noticed that some (time-dependent!) rules would not fire. Or rather - fire an hour late.

The Problem

Looking in the the log files I realized that the timestamps in there were off by an hour.

...
2020-01-05 19:12:19.439 [INFO ] [pse.smarthome.model.script.pir.rules] - ...
2020-01-05 19:12:29.683 [INFO ] [pse.smarthome.model.script.pir.rules] - ...
2020-01-05 19:16:02.959 [INFO ] [pse.smarthome.model.script.pir.rules] - ...
...

However, the system time on the Synology Diskstation was correct, so this was obviously an issue with the openHAB Docker container.

The Solution

The solution I came up with wa setting the timezone using the EXTRA_JAVA_OPTS environment variable like this:

  1. Stop the container

  2. Edit the container, find the Environment tab in Advanced Settings and add this entry.

EXTRA_JAVA_OPTS=-Duser.timezone=America/New_York

Valid settings for the timezone value can be found here.

Advanced container settings

  1. Start the container again.

  2. Done, time is correct now.