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.

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.

I have the same problem, upgraded to 5.1.3 on a 64 Raz. Pi. I went to check the 3 places for the correct time zone. The 2nd one doesn’t even exist, I tried to edit the 3rd. one using winSCP but it says I don’t have permission. So here I go down that rabbit hole!!!..lol.

sudo nano /etc/default/openhab

Replace “nano” with your preferred text editor.

Since this was posted I think we found the culprit. If you did not edit /boot/openhabian.conf before the first time you booted as the instructions describe, you didn’t set the timezones for openHABian. Consequently the default timezones was used. And that file gets copied to /etc/openhabian.conf. Every time openhabian-config runs it resets everything based on /etc/openhabian.conf.

To prevent/etc/default/openHAB from being changed in the future, set the timezone in /etc/openhabian.conf too.

After I ssh in with Putty typed…

“sudo WinSCP /etc/default/openhab”

It states that “WinSCP command not found”

I have visual studio code, but it says I can’t map the drives because I don’t have permission

You have probably noticed I’m very green at this​:grimacing:

I assume you installed openHABian. openHABian runs on a Linux operating system, not Windows. When you use PuTTY to ssh to the machine, you have left Windows world. That text pane is a terminal running on a Linux machine. Nothing on your Windows machine is going to be available. Nothing you run on a Linux machine is likely to start with “Win”. And WinSCP is a file copying tool, not a text editor. So the command over all makes no sense on a bunch of levels.

Even though openHABian frees you from needing to be a Linux expert, it cannot replace some basic Linux knowledge. Any time you connect to the machine over PuTTY, you need to know file structures. You need to know basic commands like sudo, cd, ls, cp, mv etc. And you need to know how to edit files. I believe the text editor nano comes installed by default but if not pico should be there.

There are tons and tons of “getting started with Linux” tutorials out there. You would do well to go through them to learn some basic Linux commands and tecniques. Again, you don’t need to be na expert, but you need some basics.

You cannot edit any of these files except on the machine itself. These are considered system files and their permissions will not allow it. So neither VSCode nore WinSCP type tools will help you here, not to mention again that WinSCP doesn’t edit files as far as I know.