I have a DateTime item named LastVacuumDate with a saved value via jdbc persistence. I want to see if the time now is more than 24 hours after LastVacuumDate.
The rule would be something like below, but I can’t find any examples or work out the right syntax. Is anyone able to give me some pointers please?
rule "vacuum_walkies"
when
Time cron "0 */20 * * * ?"
then
var DateTime TimeNow = now
if (LastVacuumDate.state.plusHours(24) < TimeNow) {
// more than 24 hours has passed, so do the vacuuming again
VacuumMsg.postUpdate("the vacuum is going walkies...")
// blah blah blah....
}
(I want to do it in that way, because depending on some extra conditions [still to be added] the vacuum might wait for 48 hours instead of 24 hours)