2018-07-01 21:48:20 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
example of switch https://community.openhab.org/t/examples-of-scenes/16411/5
|
|
|
|
|
*/
|
|
|
|
|
|
2018-11-09 21:02:58 +01:00
|
|
|
/*
|
|
|
|
|
Ustawienia wynikające ze scen:
|
|
|
|
|
0="OFF", 30="Bieg 1", 60="Bieg 2", 100="Bieg max"]
|
|
|
|
|
|
|
|
|
|
Ustawienia wynikające z Alexy:
|
|
|
|
|
procenty od 0 do 100
|
|
|
|
|
|
2018-07-01 21:48:20 +02:00
|
|
|
*/
|
|
|
|
|
|
2018-12-02 18:34:50 +01:00
|
|
|
rule "Ustaw predkosc okapu z vOkap"
|
|
|
|
|
when
|
|
|
|
|
Item vOKAP_speed received command
|
|
|
|
|
then
|
|
|
|
|
logInfo("vOKAP", "got command {}", vOKAP_speed.state)
|
|
|
|
|
|
|
|
|
|
if (vOKAP_speed.state == 0) {
|
|
|
|
|
dOKAP_speed.sendCommand(0)
|
|
|
|
|
|
|
|
|
|
} else if (vOKAP_speed.state == 1) {
|
|
|
|
|
dOKAP_speed.sendCommand(30)
|
|
|
|
|
|
|
|
|
|
} else if (vOKAP_speed.state == 2) {
|
|
|
|
|
dOKAP_speed.sendCommand(60)
|
|
|
|
|
|
|
|
|
|
} else if (vOKAP_speed.state == 3) {
|
|
|
|
|
dOKAP_speed.sendCommand(100)
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
/* wyłączanie światła przed zmianą prędkości - tymczasowo,
|
|
|
|
|
póki nie zdebaguje czemu włączone światło blokuje sterowanie */
|
|
|
|
|
|
|
|
|
|
/* update - informacja o zmianie stanu
|
|
|
|
|
command - wymuszenie zmiany stanu (np. klikniecie w interfejsie) */
|
|
|
|
|
|
2018-07-01 21:48:20 +02:00
|
|
|
rule "Ustaw prędkość okapu"
|
|
|
|
|
when
|
2018-11-09 21:02:58 +01:00
|
|
|
Item dOKAP_speed received update
|
2018-07-01 21:48:20 +02:00
|
|
|
then
|
2018-12-02 18:36:08 +01:00
|
|
|
var preOKAP_SWIATLO = sD1MINI01_swiatlo.state.toString()
|
|
|
|
|
sD1MINI01_swiatlo.sendCommand(OFF)
|
|
|
|
|
|
2018-11-09 21:02:58 +01:00
|
|
|
if (dOKAP_speed.state == 0) {
|
|
|
|
|
sD1MINI01_bieg1.sendCommand(OFF)
|
|
|
|
|
sD1MINI01_bieg2.sendCommand(OFF)
|
|
|
|
|
sD1MINI01_bieg3.sendCommand(OFF)
|
2018-12-02 18:34:50 +01:00
|
|
|
vOKAP_speed.postUpdate(0)
|
2018-11-09 21:02:58 +01:00
|
|
|
|
|
|
|
|
} else if (dOKAP_speed.state <= 32) {
|
|
|
|
|
/* od 1% do 32% -> bieg 1 */
|
|
|
|
|
sD1MINI01_bieg1.sendCommand(ON)
|
|
|
|
|
sD1MINI01_bieg2.sendCommand(OFF)
|
|
|
|
|
sD1MINI01_bieg3.sendCommand(OFF)
|
2018-12-02 18:34:50 +01:00
|
|
|
vOKAP_speed.postUpdate(1)
|
2018-11-09 21:02:58 +01:00
|
|
|
|
|
|
|
|
} else if (dOKAP_speed.state <= 66) {
|
|
|
|
|
/* 33% do 66% -> bieg 2 */
|
|
|
|
|
sD1MINI01_bieg1.sendCommand(OFF)
|
|
|
|
|
sD1MINI01_bieg2.sendCommand(ON)
|
|
|
|
|
sD1MINI01_bieg3.sendCommand(OFF)
|
2018-12-02 18:34:50 +01:00
|
|
|
vOKAP_speed.postUpdate(2)
|
2018-11-09 21:02:58 +01:00
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
/* powyzej 66% -> bieg max */
|
|
|
|
|
sD1MINI01_bieg1.sendCommand(OFF)
|
|
|
|
|
sD1MINI01_bieg2.sendCommand(OFF)
|
|
|
|
|
sD1MINI01_bieg3.sendCommand(ON)
|
2018-12-02 18:34:50 +01:00
|
|
|
vOKAP_speed.postUpdate(3)
|
2018-07-01 21:48:20 +02:00
|
|
|
}
|
2018-12-02 18:36:08 +01:00
|
|
|
|
|
|
|
|
sD1MINI01_swiatlo.sendCommand(preOKAP_SWIATLO)
|
2018-07-01 21:48:20 +02:00
|
|
|
end
|
2018-12-02 18:36:08 +01:00
|
|
|
|
|
|
|
|
|