Setting Timezone in OS and / or openHAB

  • Platform information:
    • Linux Container
    • OS: Debian Linux 10.5
    • Java Runtime Environment: OpenJDK Runtime Environment (Zulu (build 1.8.0_232-b18)
    • openHAB version: 2.5.7 Release Build

The timezone of the OS is Etc/UTC, the timezone of openHAB is Europe/Berlin as set in /etc/openhab2/services/runtime.cfg.

The results are mixed:

  • local times for sunrise, sunset from the astro-Binding are correct.

  • Timezone display in the Paper-UI / Configuration / System / Regional Settings is correct, however showing 1 hour offset, while 2 hours is the correct value during daylight saving time.

  • The times used for DSL-rules and scripted automation / jython are UTC:"datetime.time(): {}".format(datetime.time()))" {}".format("The ZonedDateTime is: {}".format(format_date("The LocalDateTime is: {}".format(format_date("The ZoneId.systemDefault() is: {}".format(ZoneId.systemDefault()))"The DateTime is: {}".format(

How can the org.eclipse.smarthome.i18n settings be accessed by an automation module?

If the org.eclipse.smarthome.i18n settings are not used through all bundles in openHAB, what is their intention?

Can you confirm, that the best way to set the timezone is to do so on the level of the operating system instead of org.eclipse.smarthome.i18n?

Thank you and best regards,

Don’t forget java has it’s own timezone and local settings

How was openHAB installed? What are the settings in the PaperUI system menu?

Good Point, I added the appropriate option to EXTRA_JAVA_OPTS in /etc/default/openhab2 and the code snippets from my first post all show the correct local time / locale.

The installation was done with openHabian.

Again, what about the openHAB settings in Paper UI?

The display in the Paper-UI / Configuration / System / Regional Settings reflects the settings as set in /etc/openhab2/services/runtime.cfg.

However the dropdown list is showing 1 hour offset, while 2 hours is the correct value during daylight saving time.

Why are they not set the same?

1 Like

Before, I had the underlying OS configured in local time, so I did not run into these issues before. Not long ago I moved my home’s openHAB to this VM and just would like to know if it is really necessary to do locale configuration in 3 places

  • operating system
  • /etc/default/openhab2
  • /etc/openhab2/services/runtime.cfg or Paper-UI respectively

and what these settings have an impact on.
The starting point was, that option 3 is not sufficient for DSL-rules and automation being provided with the correct locale / timezone.
After reading @rossko57’s Post I changed option 2 and can confirm, that options 2 and 3 together are working (except the faulty time offset in the display).

It could be, if you wrote every rule very carefully to reference OH timezone rather than java’s version of “now”. Probably impractical. DSL Rules are essentially java and so take their cue from the java engine’s ideas.