From cf648bbd4887d952a81535963daa3417d720c113 Mon Sep 17 00:00:00 2001 From: Tomasz Torcz Date: Thu, 1 Jun 2023 14:45:55 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20synchronizacja=20stan=C3=B3w=20przy=20r?= =?UTF-8?q?estartach=20kontroler=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rules/przedpokój.rules | 9 ---- rules/salon.lampka-stolowa.rules | 12 ----- rules/sync.rules | 84 ++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 rules/sync.rules diff --git a/rules/przedpokój.rules b/rules/przedpokój.rules index ea7d516..bbfdeea 100644 --- a/rules/przedpokój.rules +++ b/rules/przedpokój.rules @@ -57,15 +57,6 @@ then sSONOFF06.sendCommand(OFF) end -/* na wypadek rebootów sonoffa */ -rule "Synchronizuj przedpokój po restarcie" -when - Item rSONOFF06 received update ON -then - logInfo("S06przedpokój", "Reappeared, applying state przedpokój {}", sSONOFF06.state) - sSONOFF06.sendCommand(sSONOFF06.state.toString) -end - /* jak się urwie od internetu przyciskowi, zsynchronizuj stan światła na OFF */ /*rule "Przedpokój: synchronizuj stan jak włącznik się rozłączy z siecią" diff --git a/rules/salon.lampka-stolowa.rules b/rules/salon.lampka-stolowa.rules index ae05c6a..0a095e5 100644 --- a/rules/salon.lampka-stolowa.rules +++ b/rules/salon.lampka-stolowa.rules @@ -159,18 +159,6 @@ then sD1MINI02MOS.sendCommand(OFF) end - -/* na wypadek rebootów sonoffa */ -rule "Synchronizuj balkon & lampka po restarcie" -when - 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) - sSHELLY01.sendCommand(sSHELLY01.state.toString) -end - /* 1 Seconds 2 Minutes diff --git a/rules/sync.rules b/rules/sync.rules new file mode 100644 index 0000000..d7447c5 --- /dev/null +++ b/rules/sync.rules @@ -0,0 +1,84 @@ + +/* na wypadek rebootów sonoffa */ + +rule "Synchronizuj wiatrak wc po restarcie" +when + Item rSONOFF01 received update ON +then + logInfo("S01wiatrakWC", "Reappeared, applying state wiatrak WC {}", sSONOFF01.state) + sSONOFF01.sendCommand(sSONOFF01.state.toString) +end + + +rule "Synchronizuj lampka stół po restarcie" +when + Item rSONOFF02 received update ON +then + logInfo("S02stół", "Reappeared, applying state stół {}", sSONOFF02.state) + sSONOFF02.sendCommand(sSONOFF02.state.toString) +end + + +/* sonoff03 - wiatrak łazienka */ + + +rule "Synchronizuj koci kocyk po restarcie" +when + Item rSONOFF04 received update ON +then + logInfo("S04kocyk", "Reappeared, applying state kocyk {}", sSONOFF04.state) + sSONOFF04.sendCommand(sSONOFF04.state.toString) +end + + +/* sonoff05 - lapki sufitowe */ + + +rule "Synchronizuj przedpokój po restarcie" +when + Item rSONOFF06 received update ON +then + logInfo("S06przedpokój", "Reappeared, applying state przedpokój {}", sSONOFF06.state) + sSONOFF06.sendCommand(sSONOFF06.state.toString) +end + + +rule "Synchronizuj sypialnia po restarcie" +when + Item rSONOFF08 received update ON +then + logInfo("S08sypialnia", "Reappeared, applying state sypialnia {} {}", sSONOFF08a.state, sSONOFF08b.state) + sSONOFF08a.sendCommand(sSONOFF08a.state.toString) + sSONOFF08b.sendCommand(sSONOFF08b.state.toString) +end + + +rule "Synchronizuj kanapa po restarcie" +when + Item rSONOFF09 received update ON +then + logInfo("S09kanapa", "Reappeared, applying state kanapa {} {}", sSONOFF09a.state, sSONOFF09b.state) + sSONOFF09a.sendCommand(sSONOFF09a.state.toString) + sSONOFF09b.sendCommand(sSONOFF09b.state.toString) +end + + +rule "Synchronizuj blat po restarcie" +when + Item rD1MINI01 received update ON +then + logInfo("D1blat", "Reappeared, applying state blat {}", sD1MINI01.state) + sD!MINI01.sendCommand(sD1MINI01.state.toString) +end + + +rule "Synchronizuj balkon po restarcie" +when + Item rSHELLY01 received update ON +then + logInfo("SH01", "Reappeared, applying state balkon {}", sSHELLY01.state) + sSHELLY01.sendCommand(sSHELLY01.state.toString) +end + + +