i would like to create a simple rule, when motion is detected turn the lamp on, but only when it is after sunset ore a time like after 19:00.
at first i have created a rule like:
rule " Light on when motion is detected"
when
Item Motion_GF_Corridor_Stiege received update ON
then
Light_FF_Stiege.send command(ON)
end
this rule is working
than i have tried:
rule " Light on when motion is detected"
when
Item Motion_GF_Corridor_Stiege received update ON
and
Item Sunset_Time received update ON
then
Light_FF_Stiege.send command(ON)
end
here i get error rule is either empty or cannot be parsed correctly
i have also tried a rule like this:
rule " Light on when motion is detected"
when
Channel 'astro:sun:home:set#start' triggered START
then
if Item Motion_GF_Corridor_Stiege received update ON
{
Light_FF_Stiege.send command(ON)
}
end
this is also not working, i get here the same error in the losg.
You can look at the post above or you can use a flag item
Please feel free to name it as you want
Items file:
Switch flagItem
Rules file:
rule "Set 1900 or Sunset flag"
Time cron "0 0 19 * * ?" or
Channel āastro:sun:home:set#startā triggered START
then
flagItem.sendCommand(ON) //sets flagItem
end
rule "Turn Off flag item"
when
Time cron "0 0 6 * * ?" //6am
then
flagItem.sendCommand(OFF) //resets flag item at 6am
end
rule " Light on when motion is detected after 1900 or sunset"
when
Item Motion_GF_Corridor_Stiege received update ON
then
if (flagItem.state == ON) {
Light_FF_Stiege.sendCommand(ON)
}
end
Also next time, try yo use the code fences as it help reading your code:
Iām new to OpenHab and in the process of migrating from SmartThings.
Iām looking to do a similar thing and wondered how the rule given might be extended to turn off the light after a set time interval, of say, 5mins?