I want to have some simple rule which will take my motion sensor and if it nightime, it should turn on a lamp.
So in general I want to have something like this:
rule "Turn on lamp at night"
when
Item zone1 received update ON
then
if(Time cron " 0 0 22-5 ? * * *") {
// Turn on the lamp and start a timer to turn it off automatically after some time...
}
end
Is this possible? I have only used cron expressions one time yet, and it was pretty simple, but now I’m stuck, what is the best option here…
Also is it somehow possible to restart the timer of the Expire binding? Like if this rule turns on the lamp, starts the timer and you trigger it again before the timer expires, it will restart the timer?
if (((now.getHourOfDay() >= 21) || (now.getHourOfDay() <= 5)) {
// Turn on the lamp and start a timer to turn it off automatically after some time...
}