Can't get a simple time based rule to run

  • Platform information:
    • Hardware: Docker on Synology NAS
    • OS: latest DSM
    • openHAB version: 3
  • Issue of the topic: I can’t get a Zigbee Powerplug turned of at a specific time

I tried it in two ways:

1st with a simple UI configured rule:

triggers:

  • id: “1”
    configuration:
    time: 19:30
    type: timer.TimeOfDayTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: OutdoorSteckdose01Status
    command: OFF
    type: core.ItemCommandAction

→ if I run it manually, the Powerplug switches off, but it never triggers automatically. Timezone is configured, correctly.

2nd I tried it with a DSL rule. I already have some much more complex ones. But this one, also doesn’t trigger:

rule “At 19:00 swtich PowerPlug OFF”
when
Time cron “0 0 19 ? * * *”
then
mqttActions.publishMQTT(“zigbee2mqtt/Outdoor Steckdose 01/set”,“OFF”, true)
logInfo(“Main.rules”, “Aussensteckdose wird zur definierten Uhrzeit ausgeschaltet”)
end

I did quite some fancy stuff with DSL rules, but I can’t get such a basic thing to work :frowning:

Every hint is appreciated!

Which timezone? Scheduler works off Java timezone, not openHABs. So does the logger, so its easy to check your openhab.log or events.log to see if timestamps are sensible,

You are right, I found that the log entries appear one hour later as what they are saying. Do you know how I can set the Java timezone? Even my Astro Binding Events (in other rules) are delayed for one hour.

Might help -

Astro uses the Java based scheduler, too.

Based on what you pointet me to: I found an article to set the Java timezone for the Docker Container (as my OH3 is running on my synology nas in a docker container).
Found here: Wolfgang Ziegler - Wrong time in openHAB Docker Container on Synology

And i did this:

I will report if that solved it - @rossko57 Thank you very much!!

1 Like

Sorry to hijack this topic, but I have a similar problem.
I have a time based rule which simply doesn’t trigger:

rule "Set Muell Countdown"
when
	Time cron "0 0 12 ? * * *"
then
	logInfo("TEST","Müllkalender Testmeldung")
	if ((muellCal_next_Date.state as DateTimeType).zonedDateTime.minusHours(muellCal_hours) < ZonedDateTime.now()) {

		muell_Text = muellCal_next.state.toString
		if ((muellCal_next_Date2.state as DateTimeType).zonedDateTime.minusHours(muellCal_hours) < ZonedDateTime.now()) {
				muell_Text = muell_Text + " & " + muellCal_next2.state.toString				
		}	
		muellCal.postUpdate( muell_Text)		
	} else {
		muellCal.postUpdate( "")
	}

end

Another rule though does get triggered every night:

rule "Elternbad Nachtschaltung - Aktivierung"
when
	Time cron "0 0 1 * * ?"
then
//	var Timer NightLightTimer
	
	Licht_Elternbad_Night.sendCommand( ON)
	
	createTimer(ZonedDateTime.now.plusHours(5)) [|
		Licht_Elternbad_Night.sendCommand( OFF)
		]

	if (Licht_Elternbad_Spiegel.state === ON) Licht_Elternbad_Spiegel.sendCommand( OFF)
end

rule "Elternbad Nachtschaltung - Beeinflussung"
when
	Item Licht_Elternbad_dim changed from 0
then
	if (Licht_Elternbad_Night.state === ON) {
		Licht_Elternbad_dim.sendCommand( 30)
	}
end

Also the timestamps in openhab.log and events.log are correct.

What can be the problem here?

Thanks for your help!

Maybe you want to try out this cron formatter: Free Online Cron Expression Generator and Describer - FreeFormatter.com

Documented here: Rules | openHAB

With this you can double check to have the cron as you want it.

I did use this.
This is also the reason why the two formats differ.
But also when I enter the two expressions there to check I get the result I want.

Well, one format works, the other doesn’t. What do you think you should do now?

I had the “other” format before: “0 0 12 * * ?”
But this didn’t trigger either. That’s why I started to dig in, found the hint for FreeFormatter.com and thought that solved it. But it didn’t.

Does your rules file load? (see your openab.log after edits)
Is your rule "xxx" name unique, system wide?

AHH

Your second question made me thinking whether I played around with that rule in PaperUI as well.
Well, seems I did. The rule was disabled there - for whatever reason.

So I guess it will trigger now in 5 minutes.

Thanks for the right hint!

1 Like