Hi folks, I have a few Cron time triggers already and they all work great (single time trigger every day, i.e. 5am etc).
I now want to trigger a rule every X minutes, but it doesn’t seem to work. Rule triggers at exactly midnight each night though…
var power24
rule "24hr_power"
when
Time cron "0 0/15 0 ? * * *"
then
var Number power24 = Solar_Power.sumSince(now.minusDays(1), "rrd4j")
Solar24Power.postUpdate((power24 / 144 * 24).intValue)
end
According to the Cron time generator that i’m using : “0 0/15 0 ? * * *” should be ‘every 15 minutes’, but it doesn’t trigger the rule, except at midnight… Does OH not accept these minute repeating Cron triggers?
You are right, when i look at it, i selected ‘Every 15 minutes’, however, when i ask to see ‘next execution’, it is just 00:00, 00:15, 00:30, 00:45.
Here is my Log:
2020-04-22 00:00:00.990 [vent.ItemStateChangedEvent] - Solar24Power changed from 267 to 151
2020-04-22 00:00:30.552 [vent.ItemStateChangedEvent] - Dusk_Time changed from 2020-04-21T20:06:00.000+0100 to 2020-04-22T20:08:00.000+0100
2020-04-22 00:00:30.560 [vent.ChannelTriggeredEvent] - astro:sun:home:morningNight#event triggered START
2020-04-22 03:30:00.004 [vent.ChannelTriggeredEvent] - astro:sun:home:morningNight#event triggered END
2020-04-22 03:30:00.007 [vent.ChannelTriggeredEvent] - astro:sun:home:astroDawn#event triggered START
2020-04-22 04:24:00.008 [vent.ChannelTriggeredEvent] - astro:sun:home:nauticDawn#event triggered START
As you can see, the rule triggered at 00:00 and the value was updated. It may be that the rule triggered at 00:15 etc as well, but the value didn’t update as there was no power draw at that time.
I just saw that on the ‘hours’ tab, the default on that generator is ‘00:00’ hour only, changed it to ‘Every hour’ and the new cron is 0 0/15 * ? * * *
I updated the Cron expression to “0 0/15 * ? * * *”, but still not seen any updates. Will look to see what the Log says now that i’ve put an loginfo line into the rule.
Thanks All! This is working now. The Cron trigger was only for every 15 minutes during the first hour of the day, good spot! Also, the tip about adding the loginfo really helped in identifying what was happening