feat: synchronizacja stanów przy restartach kontrolerów

This commit is contained in:
2023-06-01 14:45:55 +02:00
parent 66ea303cff
commit cf648bbd48
3 changed files with 84 additions and 21 deletions

84
rules/sync.rules Normal file
View File

@@ -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