what i want to achieve:
when phone2 is not at home, but phone1 arrives home (works already) then should group Lights turned on.
so far so good.
//rules file
rule "Comming Home"
when
Item Phone1 changed from "OFF" to "ON"
then
if( Phone2 == "OFF" ) AND ( Phone1 == "ON" ) AND (<missingCondition>)){
Lights.sendCommand(ON)
}
end
But this should only happen if it is dark outside.
rule elevation
when Item Sun_Elevation changed
then
if(Sun_Elevation.state > 0){
if(Daylight.state!=ON){
//logInfo(“houseControl”, “Sun is crossing the horizon, switching to daylight mode”)
Daylight.sendCommand(ON)
//turn off lights if on
sendCommand(porchLight, OFF)
sendCommand(Sw1, OFF)
}
} else {
if(Daylight.state!=OFF) {
//logInfo(“houseControl”, “Sun is crossing the horizon, switching to night mode”)
Daylight.sendCommand(OFF)
}
}
end
You will also need this to initialize it on startup:
rule “Initialize on startup”
when
System started
then
if(Sun_Elevation.state > 0)
Daylight.sendCommand(ON)
else
Daylight.sendCommand(OFF)
end
You will need this item from the astro binding:
Number Sun_Elevation “Sun Elevation” (Weather) { channel=“astro:sun:home:position#elevation” }