Openhab 5.0: Possible issue with Handling Time Zones?

Hi again, I do have another strange issue. What I see is that after upgrading to 5.1.x, my openhab is using UTC (~London time), even though my RP is using CET and I have set openhab it too. At startup it correctly shows:

2026-01-10 11:33:45.268 [INFO ] [org.openhab.core.Activator ] - Starting openHAB 5.1.1 (Release Build)
2026-01-10 11:33:47.440 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to ‘Europe/Paris’.

But in the same line, the time is off by 1 hour. As a consequence, timers like:

theTimer = createTimer( dateTime, \[| … \]

seem to run one hour late. Changing the time zone in MainUI seems not to change things. Restart of OH also with no success. Am I missing something ?

Try add this to /etc/default/openhab

EXTRA_JAVA_OPTS=“-Duser.timezone=Europe/Paris

For sure :slight_smile:

Please setup the time zone for Java, i.e. create a file linux.parameters in $OPENHAB_CONF/ and add at least the EXTRA_JAVA_OPTS from /etc/default/openhab.
Then add the corect time zone:

EXTRA_JAVA_OPTS="-Duser.timezone=Europe/Paris"

Please be aware that EXTRA_JAVA_OPTS may contain other parameters as well.

/etc/default/openhab may be reset by apt when updating the software.

Ok, will try. But shouldn’t MainUI handle this when changing the regional settings ?

No, this is the environment for the sandbox. MainUI has no access.

ouch: in my /etc/default/openhab I find:

EXTRA_JAVA_OPTS="-XX:-TieredCompilation -XX:TieredStopAtLevel=1 -XX:+ExitOnOutOfMemoryError -Dxtext.qn.interning=true -Duser.timezone=Europe/London"

So good catch. Where is this coming from ? Note, in my OH 4.3.8 installation before the upgrade I didn’t have this. Removing the timezone here and restarting solved the issue.

This is only a temporary fix.

As said above, openHAB will rewrite /etc/default/openhab through upgrade. Please copy all “non standard” settings to /etc/openhab/linux.parameters.
The systemd service file is configured to prefer the settings from /etc/openhab/linux.parameters

openhabian@openhab:~$ cat /etc/systemd/system/multi-user.target.wants/openhab.service
[Unit]
Description=openHAB - empowering the smart home
Documentation=https://www.openhab.org/docs/
Documentation=https://community.openhab.org
Wants=network-online.target
After=network-online.target

[Service]
Environment=OPENHAB_HOME=/usr/share/openhab
Environment=OPENHAB_CONF=/etc/openhab
Environment=OPENHAB_RUNTIME=/usr/share/openhab/runtime
Environment=OPENHAB_USERDATA=/var/lib/openhab
Environment=OPENHAB_LOGDIR=/var/log/openhab
Environment=OPENHAB_STARTMODE=daemon
EnvironmentFile=-/etc/default/openhab
EnvironmentFile=-/etc/openhab/linux.parameters

User=openhab
Group=openhab

WorkingDirectory=/usr/share/openhab
ExecStart=/usr/share/openhab/runtime/bin/karaf ${OPENHAB_STARTMODE}
ExecStop=/usr/share/openhab/runtime/bin/karaf stop

SuccessExitStatus=0 143
RestartSec=5
Restart=on-failure
TimeoutStopSec=120

LimitNOFILE=102642

[Install]
WantedBy=multi-user.target
openhabian@openhab:~$

Please take notice of the two lines for EnvironmentFile, the lines will be read in order, so the latter will overrule the former.

This behavior is true since March 2025 :slight_smile:

Hi Udo, thanks for this explanation. But isn’t using the UTC time by default in this way a problem for all people using datetime timers (one can not use rules with variable timer triggers that can be set by hand, at least I would not know how to do this). The use-case is e.g. that blinds close 1 hour after sunset, this to me sounds like a standard use-case, isn’t it ? Maybe it is better to make openhab use the system time be default and not to overwrite this ?

You simply have to setup the correct time zone.
Once in the past the time zone for java was automatically set from system (if not set via EXTRA_JAVA_OPTS manually), but that was erratic in some distros, so the time zone was set to UTC by default.
Please be aware that there are openHAB users around the whole world, so UTC is the most reasonable default value, and if one needs another time zone, then it must be changed manually.

1 Like