Files
openhab/rules/salon.lampka-stolowa.rules

145 lines
2.6 KiB
Plaintext
Raw Normal View History

2018-07-01 21:48:20 +02:00
2018-07-01 21:48:20 +02:00
rule "Zapal stółlampkę rano"
when
Time cron "0 47 5 ? * MON-FRI *"
then
sSONOFF02.sendCommand(ON)
/* balkon */
sSHELLY01.sendCommand(ON)
2018-07-01 21:48:20 +02:00
end
2018-07-01 21:48:20 +02:00
rule "Zgaś stółlampkę rano"
when
Time cron "0 30 6 * * ?"
then
sSONOFF02.sendCommand(OFF)
/* balkon */
sSHELLY01.sendCommand(OFF)
2018-07-01 21:48:20 +02:00
end
rule "Zapal sufitowe przed zachodem"
when
/* Item sSunset_Event_in_hour received update ON */
Item sSunset_Event_in_twohours received update ON
2018-07-01 21:48:20 +02:00
then
/* HOLIDAY */
2018-07-01 21:48:20 +02:00
sD1MINI01_lampki_sufitowe.sendCommand(ON)
/* balkon */
sSHELLY01.sendCommand(ON)
2018-07-01 21:48:20 +02:00
end
/* HOLIDAY */
2018-07-01 21:48:20 +02:00
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) {
logInfo("stollampka", "Powyżej 90% chmur, zapalam")
sSONOFF02.sendCommand(ON)
sSONOFF02_expected.postUpdate(ON)
sSONOFF01.sendCommand(ON)
}
end
2018-07-01 21:48:20 +02:00
/* TODO: przerobic na espeasy pulse command.
pulse 500ms, thread sleep 1s*/
/* HOLIDAY */
2018-07-01 21:48:20 +02:00
rule "Zapal lampkę i kanapowe przed zmierzchem"
when
/* Item sSunset_Event_in_halfhour received update ON*/
Item sSunset_Event_in_hour received update ON
2018-07-01 21:48:20 +02:00
then
2018-07-01 21:48:20 +02:00
dSONOFF01LED.sendCommand(0)
dSONOFF02LED.sendCommand(0)
Thread::sleep(500)
dSONOFF01LED.sendCommand(1023)
dSONOFF02LED.sendCommand(1023)
Thread::sleep(500)
dSONOFF01LED.sendCommand(0)
dSONOFF02LED.sendCommand(0)
Thread::sleep(500)
dSONOFF01LED.sendCommand(1023)
dSONOFF02LED.sendCommand(1023)
Thread::sleep(500)
dSONOFF01LED.sendCommand(0)
dSONOFF02LED.sendCommand(0)
Thread::sleep(500)
dSONOFF01LED.sendCommand(1023)
dSONOFF02LED.sendCommand(1023)
Thread::sleep(500)
sSONOFF02.sendCommand(ON)
sSONOFF02_expected.postUpdate(ON)
sSONOFF01.sendCommand(ON)
end
2018-07-01 21:48:20 +02:00
rule "Przedzgaś stółlampkę wieczorem"
when
Time cron "0 12 22 * * ?"
then
dSONOFF01LED.sendCommand(0)
dSONOFF02LED.sendCommand(0)
end
rule "Zgaś stółlampkę, sufitowe i nablatowe wieczorem"
2018-07-01 21:48:20 +02:00
when
Time cron "0 15 22 * * ?"
then
sSONOFF02.sendCommand(OFF)
sSONOFF02_expected.postUpdate(OFF)
dSONOFF02LED.sendCommand(1023)
sD1MINI01_lampki_sufitowe.sendCommand(OFF)
sD1MINI02MOS.sendCommand(OFF)
/* balkon */
sSHELLY01.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
then
logInfo("S02,SH01", "Reappeared, applying state balkon {}, lampka {}", sSHELLY01.state, sSONOFF02.state)
sSONOFF02.sendCommand(sSONOFF02.state.toString)
sSHELLY01.sendCommand(sSHELLY01.state.toString)
2018-07-01 21:48:20 +02:00
end
/*
1 Seconds
2 Minutes
3 Hours
4 Day-of-Month
5 Month
6 Day-of-Week
7 Year (optional field)
*/