Files
openhab/rules/przedpokój.rules
Tomasz Torcz 7a8435acec przedpokój: więcej zdecydowania przy restarcie sonoffa
I poprawka opcji "synchronizuj z openhab", zła składnia była.
2021-02-04 20:40:19 +01:00

77 lines
1.6 KiB
Plaintext

rule "Przedpokój: przełącz światło"
when
/* If there is no action the button returns 0. When you touch it it shows a state of 1 . */
Item sSONOFF06KEY received update ON or
Item sD1MINI06KEY received update
then
if (sSONOFF06.state == ON) {
sSONOFF06.sendCommand(OFF)
} else {
sSONOFF06.sendCommand(ON)
}
end
/* podswietlenie bedzie caly czas ON, ustawione jako dioda statusu */
/*rule "Przedpokój: synchronizuj podświetlenia przycisków"
when
Item sSONOFF06 received update
then
if (sSONOFF06.state == ON) {
sSONOFF06LED.sendCommand(OFF)
sD1MINI03_light_red.sendCommand(OFF)
} else {
sSONOFF06LED.sendCommand(ON)
sD1MINI03_light_red.sendCommand(ON)
}
end*/
rule "Przedpokój: podświetlaj przy drzwiach po ciemku"
when
Item sSONOFF06 received update
then
if (sSONOFF06.state == ON) {
sSONOFF06LEDtouch.sendCommand(OFF)
} else {
sSONOFF06LEDtouch.sendCommand(ON)
}
end
rule "Przedpokój: zapal rano"
when
Time cron "0 50 5 ? * MON-FRI *"
then
sSONOFF06.sendCommand(ON)
end
rule "Przedpokój: zgaś rano"
when
Time cron "0 50 6 ? * MON-FRI *"
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ą"
when
Item rSONOFF06 received update OFF
then
sSONOFF06.postUpdate(OFF)
end
*/