Sunrise / Sunset Help

IsItDark is an Object which contains many properties.

One of those properties is its state.

Within rules you must tell openHAB what property of the Object you’re comparing your ON against, because the Object itself isn’t ON.

More info in this section of the docs.

2 Likes

There is also an Astro channel called “astro:sun:local:phase#name” which has the value “DAYLIGHT” between sunrise and sunset and a bunch of of obscure ones inbetween but that should be enough to check against when using !==“DAYLIGHT”

True but , through experimentation. the Nautic values best suited my purpose and the start is a trigger channel.

Here’s the final :slight_smile:

rule “Sunrise Rule - Outside Lights”

when

Channel 'astro:sun:home:civilDawn#event' triggered START 

then

IsItDark.postUpdate(OFF)

Light_GF_Front_Outside.sendCommand(OFF)

Light_GF_Deck_Outside.sendCommand(OFF)

end

rule “Sunset Rule - Outside Lights”

when

Channel 'astro:sun:home:civilDusk#event' triggered START 

then

IsItDark.postUpdate(ON)

Light_GF_Front_Outside.sendCommand(ON)

Light_GF_Deck_Outside.sendCommand(ON)

end

rule “Sunrise Rule - Outside Lights”

when

Channel 'astro:sun:home:civilDawn#event' triggered START 

then

IsItDark.postUpdate(OFF)

Light_GF_Front_Outside.sendCommand(OFF)

Light_GF_Deck_Outside.sendCommand(OFF)

end

rule “Keep lights on at night and keep off during the day”

when

Item Light_GF_Front_Outside received update or 

Item Light_GF_Deck_Outside received update

then

if (IsItDark.state == ON && Light_GF_Front_Outside.state == OFF){

    Light_GF_Front_Outside.sendCommand(ON)

}

if (IsItDark.state == OFF && Light_GF_Front_Outside.state == ON){

    Light_GF_Front_Outside.sendCommand(OFF)

}

if (IsItDark.state == ON && Light_GF_Deck_Outside.state == OFF){

    Light_GF_Deck_Outside.sendCommand(ON)

}

if (IsItDark.state == OFF && Light_GF_Deck_Outside.state == ON){

    Light_GF_Deck_Outside.sendCommand(OFF)

}

end