Time of day rule not working

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: Raspian
    • openHAB version: Latest stable
  • Issue of the topic: please be detailed explaining your issue

Total newbie here. I’m trying to get my first rule to work and not having luck. It’s pretty simple, with a ON command being given to a switch at a defined time. I’m doing this through the rules GUI, and not through the command line. After setting up the rule, I can work the switch using the “Run Now” button, but when the time comes for the switch to work through the rule, it doesn’t turn on. The code for the rule is:

triggers:
  - id: "1"
    configuration:
      time: 16:50
    type: timer.TimeOfDayTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: FoyerLight_Switch
      command: ON
    type: core.ItemCommandAction

I’ve checked the time in the Raspberry Pi and it’s correct. I’m sure I’m missing something basic. Please advise. Thanks!

What about the openHAB log files? Are the time stamps correct? OH manages the timezone independently from the operating system which sometimes causes users problems.

Are there any errors in the logs?

Open up the developer sidebar in MainUI (<alt><shift>d) and start the event stream. You should see rule running events in the feed. Set the time trigger to something soon (e.g. one minute from now) and watch the clock, the logs, and the event feed. Is there any indication that the rule was triggered in any of those places?

So there are definitely differences in time. See the image:

The local time is the 15:44:37, while the universal time is 20:44:37. The event just previous to me retrieving the time was 21:42.37. Could this be the problem? How can I change OH to have the correct time synced? Thanks!

Settings → Regional Settings

So I do have the correct time in regional settings. I am EST and that’s correctly reflected in the settings and in the command line. What I’m confused about is where that differential of 21 hour vs 15 hour is coming from and if that’s affecting the problem. Does that need to be changed somewhere or is that a different issue that has no impact on what I’m seeing?

Logging and scheduling uses the Java clock. openHAB cannot set that, it may be a different timezone to host operating system -it depends how you installed Java.

Okay, so that was it. My Java time is set to Europe/Berlin. Testing it using Berlin time works.

So for a Linux dummy, how do I set the Java clock to be correct (and most importantly, stay that way even after rebooting)?

Thank you!

Follow from here