Hi all, im just wondering if any of you awesome people can help me and explain how/why so that I can learn how to achieve the following.
ive got the below rule that works well but I want to integrate if its dark. I’ve made a switch
(Dark_Outside) that turns on when its dark but im unsure how to integrate it into the following. so that all of the following have to be true for the rule to run:
Someones_Home changed from OFF to ON
Dark_outside.state == ON
X_Iphone_networkBinding.state == ON
rule "X Arives Home Night"
when
Item Someones_Home changed from OFF to ON
then
if (X_Iphone_networkBinding.state == ON)
{
All_Lights.sendCommand(ON)
Lounge_TV.sendCommand(ON)
Amp_Power.sendCommand(ON)
Thread::sleep(10000)
sendCommand(Amp_Volume, 50)
Thread::sleep(500)
sendCommand(AMP_Lounge_Preset, 3)
sendNotification("XXXXXX.co.nz", "X arrived home.")
}
end
rule "X Arives Home Night"
when
Item Someones_Home changed from OFF to ON
then
if (X_Iphone_networkBinding.state == ON && Dark_outside.state == ON)
{
All_Lights.sendCommand(ON)
Lounge_TV.sendCommand(ON)
Amp_Power.sendCommand(ON)
Thread::sleep(10000)
sendCommand(Amp_Volume, 50)
Thread::sleep(500)
sendCommand(AMP_Lounge_Preset, 3)
sendNotification("XXXXXX.co.nz", "X arrived home.")
}
end
You may also need some similar rule that takes actions, if someone is already home when it becomes dark.
Remember OpenHAB is driven by events, not steady states.