Delayed scheduled rules on Raspberry Pi due to wrong time

Hi openHAB community,

I would like to share my findings for my very particular scenario.
If you encounter the situation, that scheduled rules are heavily delayed (by hours) on a Raspberry Pi, consider the following:

Preamble: My router gets switched off in the evening when going to bed (around 22h).
The Raspberry, where OH3 is deployed, gets switched off automatically around 23:55 and is started at 5:00. The router gets switched on when I wake up via Openhab when I switch off the Flight Mode on my phone. During this timeframe, the Raspberry is connected to the internet via a GSM modem attached to it (don’t ask me why :slight_smile: )

As the Raspberry does not have a RTC (real-time clock) the time (when started) is set to whatever time it was when the Pi shut off (in my case 23:55).
The time is synced when the Raspberry has Internet connectivity, which happens AFTER OH3 was started, because openHAB activates the GSM stick.

After migration from OH2 to OH3 I found out, that my scheduled rules (pre shutdown) were not triggered any more.
Therefore, I have created two scheduled rules (for testing purposes) that should trigger around 7:10 and 7:15. But those rules were triggered somehwere around 12:45 and 12:50.
So I figured that it had something to do with the wrong time on startup.
This wasn’t a problem in OH2, because OH2 used Quartz for scheduling which does something differently (apparently) than the scheduling in the NGRE.

Now, I have installed a RTC module for my Raspberry and the rules are executed on point.
My first consideration was to delay the start of Openhab until the time was synced (which is now easier in Debian Buster with in openhab.service),

Just wanted to let you know of this very special scenario.

  • Platform information:
    • Hardware: Raspberry Pi 4B 4GB
    • OS: Raspbian / Debian 10 (Buster)
    • Java Runtime Environment: OpenJDK 11.0.10 2021-01-19 LTS
    • openHAB version: OpenHAB 3.0.1 Release Build

I’m not gonna ask about the GSM modem, but who does the RPi have to be shut down from 23:55 to 5:00? Why not just let it run without Internet connectivity? You didn’t specifically say that I couldn’t ask that. :wink:

Since the vast majority of users leave openHAB running 24/7, I agree that this is definitely a special case.

Hmm, I guess that’s because I don’t want to keep things running at night. And at the moment, OH does not perform anything (no rules, etc.) that requires it to keep it running.
But maybe this will change someday, because automation does not stop :slight_smile:

That’s fair. I think most people would prefer to just keep it running instead of adding the RTC module, but I’m glad that worked for you. I have things that run while I’m sleeping, so it was never a question for me.