rule "It's Dark"
when
Channel 'astro:sun:home:set#event' triggered START
then
ItsDark.postUpdate(ON)
end
rule "It's not dark"
when
Channel 'astro:sun:home:rise#event' triggered START
then
ItsDark.postUpdate(OFF)
end
rule "Vincent arrive a la maison et il a peur du noir"
when
Item atHomeEX changed to ON
then
if (ItsDark.state == ON) {
inter_applique_exterior.sendCommand(ON)
}
end
You need the new Item and the two rules to tell openHAB if it is dark or not
Then when you arrive at home Location item turns ON you check if it is dark and turn the light on accordingly
Have a look at Design Pattern: Time Of Day to give an idea on how to define different periods in the day to create rules with different behaviours