Item for alarm clocks etc. and daylight saving time

I have some items which define the time for stuff like alarm clocks. Only the time is relevant, I don’t care about the date. But as there are only DateTime items I use those.

Depending on how I set the time, the date of those items is either 1970-01-01 or the date when the time was last set.

Now the trouble starts, as depending on the date the time zone is MET or MEST. When I now use the item to trigger a rule (with only the time) openhab seems to match the UTC time and depending on the timezone of the item and the current time zone the alarm goes to 1 hour too late or too early.

Is this the expected behavior? How can I use items as triggers which are not updated daily?

The time-only usages of DateTimeType can be a bit tricky and in some cases error-prone when the epoch offset becomes negative because of the difference between the system or openHAB time zone and UTC.

  • Which time zone have you configured in openHAB regional settings?
  • Which time zone is configured for your system/OS?
  • Do you have a time zone configured in JAVA_EXTRA_OPTS (if so, which one)?
  • How do you set the item state? You write “depending on how I set the time”. Perhaps you can walk us through a concrete example where you set it in some specific way and get a specific (unexpected) result.
  • What does your rule look like?

See also How to fix Incorrect datetime value '1970-01-01 01:00:00' error with MySQL TIMESTAMP in OpenHAB JDBC Persistence? - #7 by laursen

Hopefully you solved your ME(S)T trouble.

You can easily use the time of a DateTime Item to trigger a rule like this:

DateTime Clock_10  (gClock) // in my case: 2026-03-18T22:30:00.000+0100
rule "Beleuchtung: Aussenleuchten 22:30 aus"
when 
    Time is Clock_10 timeOnly     
then 
    //do something
end

rule triggers every day.

happy Easter

  • Regional settings: (GMT+1:00) Europe/Berlin

  • System is Linux, so the clock runs in UTC but timezone is set to (GMT+1:00) Europe/Berlin

  • No JAVA_EXTRA_OPTS but TZ is set in docker-compose:

        openhab:
            container_name: openhab
            image: openhab/openhab:5.1.3
            restart: unless-stopped
            network_mode: host
            volumes:
                - /etc/localtime:/etc/localtime
                - /etc/timezone:/etc/timezone
                - /opt/openhab/addons:/openhab/addons
                - /opt/openhab/conf:/openhab/conf
                - /opt/openhab/userdata:/openhab/userdata
                - /opt/openhab/persistence:/openhab/persistence
                - /opt/openhab/backup:/openhab/backup
            environment:
                - CRYPTO_POLICY=unlimited
                - TZ="Europe/Berlin"
    
  • I have tried different input methods as nothing works especially well in Firefox

    • This one takes the time as UTC 1970-01-01

                - component: f7-col
                  slots:
                    default:
                      - component: oh-input
                        config:
                          clearButton: false
                          inputmode: text
                          outline: true
                          variable: time
                - component: f7-col
                  slots:
                    default:
                      - component: oh-button
                        config:
                          action: command
                          actionCommand: =vars.time
                          actionItem: =props.item
      
    • rlk_datetime_standalone (from marketplace) uses the current date / timezone but the value also seems to be stored as UTC. So if I set the value now to 7:00 it is stored as 5:00 UTC which is 7:00 MEST but 6:00 MET

  • My rule trigger looks like this (created in the gui):

    configuration: {}
    triggers:
      - id: "1"
        configuration:
          itemName: automation_wecker
          timeOnly: true
        type: timer.DateTimeTrigger
    
    

What is unclear to me: How are time-only items supposed to work? If the DateTime is stored in UTC they need to be updated at each daylight saving time change.
Thanks for your help!

Let’s try to isolate the problem. I know nothing about widgets/UI components, so I’d like to keep that out of the equation for now. I did the following

  • openHAB time zone: Pacific/Midway (GMT-11)
  • JVM time zone: Europe/Copenhagen
  • Item: DateTimeTest

Created these DSL rules:

rule "DateTimeTest set"
when
    Item DateTimeTest changed
then
    logInfo("TZ", "jvm.zone = {}", ZoneId.systemDefault)
end

rule "DateTimeTest triggered"
when
    Time is DateTimeTest timeOnly
then
    logInfo("Triggered", "DateTimeTest triggered")
end

Then did this in a karaf console (time was one minute later):

openhab:update DateTimeTest 16:50

With this result:

2026-04-03 16:49:06.018 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DateTimeTest' changed from NULL to 1970-01-01T16:50:00.000+0100 (source: org.openhab.core.io.console$openhab)
2026-04-03 16:49:06.020 [INFO ] [org.openhab.core.model.script.TZ    ] - jvm.zone = Europe/Copenhagen

And then:

2026-04-03 16:50:00.020 [INFO ] [.openhab.core.model.script.Triggered] - DateTimeTest triggered

I believe only the JVM time zone is relevant here, not the time zone configured in openHAB. The “Time is” creates a cron expression using the JVM time zone:

I guess this is because the JVM time zone is used in the other end when evaluating cron expressions.

In any case, it seems to work fine for me. I suspect that you may lack to set up the JVM time zone for your Docker container.

Can you try to run these same tests and post the results?

See also Rule based on CronJob does not execute (OH3.2, Synology DSM > 7.0, Docker) - #9 by JimH

Without changing anything in the config I got this:

2026-04-06 11:56:34.714 \[INFO \] \[org.openhab.core.model.script.TZ    \] - jvm.zone = GMT

(I seem to have disabled the change events somewhere, so i only got the log from the rule.)

Next I tried to add EXTRA_JAVA_OPTS to my docker-compose file and while doing so I realized that I have a syntax error. This does not work:

            - TZ="Europe/Berlin"

I have to use either

            - TZ=Europe/Berlin

or

            TZ: "Europe/Berlin"

Now I get:

2026-04-06 14:17:22.396 \[INFO \] \[org.openhab.core.model.script.TZ    \] - jvm.zone = Europe/Berlin 
2026-04-06 14:18:00.379 \[INFO \] \[.openhab.core.model.script.Triggered\] - DateTimeTest triggered

and the rule actually triggers at the correct time.

Thanks a lot for your support!