I have a rule that putt of my outdoor lights at eleven pm, works perfectly. But, as i noticed last saturday, when i’m out and later home then eleven, i need my outdoor lights.
To check if i’m home or not i can use the state of the mobile phones (my wifes and mine). They have 2 status open or closed. Connected to the ap or not.
So i made up this rule:
rule "outdoor lights"
WHEN
Time cron "0 0 23 * * ?"
THEN
IF KKphone.state == OPEN AND DEphone.state == OPEN
sendCommand(NB_S1_O4_outdoorlight, ON) **(or do nothing)**
ELSE
sendCommand(NB_S1_O4_outdoorlight, OFF)
END
Will this work ?
Or is there a better solution ?
rule "outdoor lights"
when
//TimeCron checks between 23 and 4:45 every 15 Minutes
//Perhaps this is a Soultion for you!
Time cron "0 0/15 0,1,2,3,4,23 ? * * *"
then
// Logical OR is a better Solution.... because if 1 Phone CLOSED the Lights switch OFF
if (KKphone.state == OPEN || DEphone.state == OPEN){
if (NB_S1_O4_outdoorlight == OFF){
sendCommand(NB_S1_O4_outdoorlight, ON)
}
}
else{
sendCommand(NB_S1_O4_outdoorlight, OFF)
}
end
I don’t understand your Rule completely … OPEN = Connected or not Connected to AP?
When you’re home, are the lights off or on?
1 Like
Open is not connected to the AP, which means that we (my wife and i) are out of the house
Ok … I think my rule will work … I have edited
No Problem …
I have a Day & Night Item triggered by a Luxmeter … so I need no TimeCron …
if Night and not all at Home -> Lights on
if Night and all at Home -> Lights Off
if Day -> Lights off
ah, mine is like this
evening - on at astro sunset ON
evening - OFF at eleven or when everybody is at home
morning - ON at 6:25
Morning OFF at astro sunrise
I do it like this…
rule "Outdoor Lights by presence of Cell Phone"
when
Item KKphone changed or
Item DEphone changed
then
if (KKphone.state == OPEN && Nacht_Modus.state == ON || DEphone.state == OPEN && Nacht_Modus.state == ON){
if (NB_S1_O4_outdoorlight == OFF){
sendCommand(NB_S1_O4_outdoorlight, ON)
}
}
if (KKphone.state == CLOSED && DEphone.state == CLOSED && Nacht_Modus.state == ON){
sendCommand(NB_S1_O4_outdoorlight, OFF)
}
end
Nacht_Modus is a Item controlled by an Luxmeter … if you have no Luxmeter you can use the Astro Binding