Files
openhab/rules/sypialnia.dual.rules

50 lines
1004 B
Plaintext
Raw Permalink Normal View History

rule "Przełączaj duala"
when
Item sSONOFF08_ext changed from OFF to ON
then
/* przełączaj: pierwsze, drugie, obydwa, żadne */
logInfo("Dual", "Got state {}", sSONOFF08_ext.state)
if (sSONOFF08a.state == OFF && sSONOFF08b.state == OFF) {
sSONOFF08a.sendCommand(ON)
} else if (sSONOFF08a.state == ON && sSONOFF08b.state == OFF) {
sSONOFF08b.sendCommand(ON)
sSONOFF08a.sendCommand(OFF)
} else if (sSONOFF08a.state == OFF && sSONOFF08b.state == ON) {
sSONOFF08a.sendCommand(ON)
} else {
sSONOFF08a.sendCommand(OFF)
sSONOFF08b.sendCommand(OFF)
}
end
rule "Zapal lampki w sypialni o zachodzie"
when
Item sSunset_Event received update ON
then
sSONOFF08a.sendCommand(ON)
Thread::sleep(1000)
sSONOFF08b.sendCommand(ON)
end
rule "Zgaś gwiazdki w sypialni wieczorem"
when
Time cron "0 55 21 * * ?"
then
sSONOFF08b.sendCommand(OFF)
end
rule "Zgaś cottonballs w sypialni wieczorem"
when
Time cron "0 08 22 * * ?"
then
sSONOFF08a.sendCommand(OFF)
end