[SOLVED] Cron rule never fires

Openhab 2.5m2

I have a rule

rule "Sparkley Darkley Jars OFF"
when
    Time cron "0/5 0 0 ? * * *"
then
    logInfo("SonoffRFBridge", "Sparkley Darklies turned off")
    SonoffRFBridge_SparkleyDarkleyJar01.sendnCommand(OFF)
    SonoffRFBridge_SparkleyDarkleyJar2.sendCommand(OFF)
end

it should fire every 5 seconds, but it never fires

log

==> /var/log/openhab2/openhab.log <==

2019-09-02 10:27:55.813 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'SparkleyDarkleyOff.rules'

==> /var/log/openhab2/events.log <==

2019-09-02 10:31:38.476 [vent.ItemStateChangedEvent] - BRCloset2Door_BatteryLevel changed from 81 to 78

2019-09-02 10:37:00.001 [vent.ChannelTriggeredEvent] - astro:moon:local:rise#event triggered START

Any suggestion on what may be the problem

It’s hanging…
you haven’t mentioned the platform but I’m not sure if any platform is going to run fast enough to have OpenHAB doing something none stop ever 5 seconds. Stupid question, I see it is sonof bridge but what is this thing doing?

Above line has a typo: “sendnCommand”

No this will fire at midnight exactly and at 5 seconds after midnight.
Review your cron

1 Like

@vzorglub

According to this cron generator, it fires every 5 seconds, starting at 0 seconds.

https://www.freeformatter.com/cron-expression-generator-quartz.html

Nope, as Minute and Hour is fixed to 0, it will fire only at 00:00:00, 00:00:05, 00:00:10, 00:00:15, 00:00:20, 00:00:25, 00:00:30, 00:00:35, 00:00:40, 00:00:45, 00:00:50 and 00:00:55

the correct Time cron is this:

Time cron "0/5 * * * * ?"

or

Time cron "0/5 * * ? * *"

But as always: What do you want to achive?

2 Likes

@vzorglub @Udo_Hartmann

Yes, you were right. The generator confused me, because there are more tabs to fill. SORRY! :innocent:

Now I also get:

 Time cron "0/5 * * ? * *"

Btw: there also is the typo “sendnCommand”.

3 Likes

You*re welcome! :slight_smile:

2 Likes

The above rule is a demo. The every 5 seconds is just for debugging. It will ultimately run once a day.

1 Like

Thank you all.

I… uhm… never have typos… :crazy_face:

1 Like

I’m sending a MQTT command to a Tasmota flashed Sonoff RF bridge that sends an RF command to an EL CHEAPO rf switch which will switch on or off some decorative light fixtures.

1 Like

Now that is the perfect OpenHAB task if I ever heard one!
good on you!

Just FYI

This is all with the 2.5M2 MQTT binding.

All config is done in Paper UI. There are no Item or Thing files

@David_Graeff has performed an excellent refactoring that matches the OH2 idiom… and I think this even having used the old MQTT binding. :sunglasses:

1 Like