diff --git a/rules/sypialnia.dual.rules b/rules/sypialnia.dual.rules new file mode 100644 index 0000000..b146899 --- /dev/null +++ b/rules/sypialnia.dual.rules @@ -0,0 +1,39 @@ + +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 wieczorem" +when + Time cron "0 30 21 * * ?" +then + sSONOFF08a.sendCommand(ON) +end + +rule "Zgaś lampki w sypialni wieczorem" +when + Time cron "0 00 22 * * ?" +then + sSONOFF08a.sendCommand(OFF) +end