From ab0dd077f07838aa4ebe5f602cebd9b2672dea2e Mon Sep 17 00:00:00 2001 From: Tomasz Torcz Date: Tue, 18 May 2021 12:49:02 +0200 Subject: [PATCH] salon: bardziej dramatyczne gaszenie wieczorem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I kilka fiksów z międzyczasu. --- rules/salon.lampka-stolowa.rules | 33 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/rules/salon.lampka-stolowa.rules b/rules/salon.lampka-stolowa.rules index 7d97688..4c60996 100644 --- a/rules/salon.lampka-stolowa.rules +++ b/rules/salon.lampka-stolowa.rules @@ -8,6 +8,7 @@ then /* balkon */ sSHELLY01.sendCommand(ON) + end @@ -23,11 +24,11 @@ then end - +/* TODO: w okresie kwiecien-pazdziernik na dwie godziny przed? */ rule "Zapal sufitowe przed zachodem" when -/* Item sSunset_Event_in_hour received update ON */ - Item sSunset_Event_in_twohours received update ON + Item sSunset_Event_in_hour received update ON +/* Item sSunset_Event_in_twohours received update ON */ then /* HOLIDAY */ @@ -44,14 +45,15 @@ rule "Zapal lampkę i kanapowe przez zmierzchem gdy pochmurno" when Item sSunset_Event_in_twohours received update ON then - /* more than 90% cloud cover */ - if (wClouds.state > 90.0) { + /* more than 90% cloud cover && TODO: only april-octotber */ + if (wClouds.state > 90.0 && true) { logInfo("stollampka", "Powyżej 90% chmur, zapalam") /* sSONOFF02.sendCommand(ON) */ sSONOFF02_expected.postUpdate(ON) sSONOFF09a.sendCommand(ON) + sSONOFF09b.sendCommand(ON) } end @@ -66,6 +68,9 @@ when /* Item sSunset_Event_in_halfhour received update ON*/ Item sSunset_Event_in_hour received update ON then + if (sHolidayVacancy.state == ON) { + return; + } dSONOFF01LED.sendCommand(0) dSONOFF02LED.sendCommand(0) @@ -91,7 +96,7 @@ then /* sSONOFF02.sendCommand(ON) */ sSONOFF02_expected.postUpdate(ON) - + /* kanapa */ sSONOFF09a.sendCommand(ON) end @@ -119,22 +124,24 @@ then if (sHolidayVacancy.state == ON) { sSONOFF05.sendCommand(OFF) } - - sD1MINI02MOS.sendCommand(OFF) + Thread::sleep(2000) /* kanapowe */ - sSONOFF01.sendCommand(OFF) + sSONOFF09b.sendCommand(OFF) + Thread::sleep(2000) + sSONOFF09a.sendCommand(OFF) + Thread::sleep(2000) - /* balkon */ - sSHELLY01.sendCommand(OFF) + /* blat */ + sD1MINI02MOS.sendCommand(OFF) end /* na wypadek rebootów sonoffa */ rule "Synchronizuj balkon & lampka po restarcie" when - Item rSHELLY01 changed to ON or - Item rSONOFF02 changed to ON + Item rSHELLY01 received update ON or + Item rSONOFF02 received update ON then logInfo("S02,SH01", "Reappeared, applying state balkon {}, lampka {}", sSHELLY01.state, sSONOFF02.state) sSONOFF02.sendCommand(sSONOFF02.state.toString)