Time-based rules not working on 5.0.1

  • Platform information:
    • Hardware: Raspberry 4 - 4 gig
    • OS: openhabian/Bookworm
    • Java Runtime Environment: temurin-21-jre-arm64/bin/java
    • openHAB version: 5.0.1
  • Issue of the topic: please be detailed explaining your issue
  • Please post configurations (if applicable):
    • Items configuration related to the issue
    • Sitemap configuration related to the issue
    • Rules code related to the issue
    • Services configuration related to the issue
  • If logs where generated please post these here using code fences

Hi. I created a new installation of openhabian 5.0.1 and copied my configuration over from 4.3. However, I noticed time based rules are not running at their scheduled time. For example:

configuration: {}
triggers:

  • id: “1”
    configuration:
    time: 13:00
    type: timer.TimeOfDayTrigger
    conditions:
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: Den_Fan_Switch
    command: OFF
    type: core.ItemCommandAction

This did not run at all at 1p.m.. The same is true for my CRON jobs which I normally use cron as it’s easier to configure. What I check raspi-config, I see US and Central time configured properly. My time stamps in the Log Viewer match the current time as well. What can I check or look for to see what might be misconfigured?

Thanks for any help.

Guy

There are three places to check the timezone.

  1. MainUI → Settings → Regional Settings
  2. /etc/timezone
  3. /etc/default/openhab

The timezone should be the same in all three places. May users are finding /etc/default/openhab to get a timezone added unexpectedly.

1 Like

Wow, thanks for the reply. 1 and 2 were correct as US/Central. However, /etc/default/openhab is set to London.

Thanks Rich!

Guy

Same for me. Logfile time was wrong, same reason.

I never had that on older OH Versions. Why is the timezone in /etc/default/openhab not propperly set according to the timezone of OH?

We don’t know yet. Issue is open and it’s been investigated but remains a mystery as to what is editing that file during the upgrade.

The same issue popped up again with OH5.1 installation.

Hello Rich,

I just migrated to Raspberry Pi from Windows. I am on 5.1. I have the same issue, when I use filezilla and click on etc/local time I get:

Command cd”/etc/localtime”
error: Directory/usr/share/zoneinfo/Europe/London no such file or directory
error: Failed to retrieve directory listing

I am not very good with software. How do I fix this? I would really appreciate a step by step guide if possible. My cron rules are not working.

Thanks, Aziz

Nowhere above talks about /etc/localtime. Why are you trying to open that file?

There are only two files you need to look at and one seeing in MainUI: /etc/timezone, /etc/default/openhab.

You must have root to edit these files. I don’t know how to do that in filezilla. It should ask for your password. From the command line you’d use sudo before the command to open the file for editing.

Thanks. I am not very good at software. I did find another thread that directed me to use SSH and update Duser time zone. That seems to have worked. Thanks again for all your help.

I can confirm this problem for openHAB 5.1.0 - Release Build. Time in Logs was one hour behind what “date” showed, and time based rules fired one hour too late. In my case, /etc/timezone was Europe/London. I used timedatectl to correct it to Europe/Berlin, now everything works as expected.

Hi,

My time-based rules are still not working after the update to 5.0 and further.

Time-zone in Openhab is correct, but the follow-rule does not trigger the lights based on the time and made bij de MainUI of Openhab:

configuration: {}
triggers:

  • id: “1”
    configuration:
    time: 12:05
    type: timer.TimeOfDayTrigger
    conditions:
    actions:
  • inputs: {}
    id: “2”
    configuration:
    command: ON
    itemName: ZWave_Node_004_ZW175_Smart_Switch_7_Switch
    type: core.ItemCommandAction

Has somebody a suggestion what this might be ?

The rules based on the astro binding works fine.

Hi

I can tell you that the problem is solved and had, in my case, nothing to do with Openhab. There were no errors in the log to be found. The fundamental problem was in my Linux-server and the NTP-service. After repairing that, the time issues were solved and all is working fine now.

Don’t know it’s the right thread but let me address my issues.

Can you share a link to this issue?

I ran OH since 2020 and now I setup a completely new installation (OH5.x) without any legacy.
Installed on raspi via Raspberry Pi Imager. Everything smoothe but after some time I recognized

  • logs
  • cron
  • and persistence (rrd4j & jdbc)

are showing diffrent timestamps!

  • Main UI - Regional Settings - Europe/Berlin - doesn’t help
  • changing /etc/timezone via linux commands - doesn’t help
  • changing /etc/default/openhab will help till the next update!
    It will be overridden!
  • creating /etc/openhab/linux.parameters is currently the only reliable way to cope with this issue.

Coming to the point:
I don’t want to maintain extra linux parameters in a self maintained file just to have my configured timezone ready all over the place!

Until we know what’s writing it we don’t really know where to open the issue. openHABian? openhab-distro?

The relevant code in openHABian is here. I’m not sure where the code for apt/yum/etc is.

Sure, that’s a valid question!

But I’m still curious regarding the problem. Is it well known that after OH setup you need to edit some /etc/whatever files, restart again and after that you regional settings are fine?

You’re in the US so if you’re setting up a new system from scratch do you also have default timezone Europe/London?

It’s fairly well known. I can’t say how well, but there are many threads discussing it including the release discussion threads.

I run in Docker which doesn’t have this problem. There is no /etc/default/openhab file in the Docker container. It’s a “manual” install inside the container, not apt or yum or openHABian. To set the EXTRA_JAVA_OPS one passes that as an environment variable, which I do every time I start/create a container.

1 Like