kuchnia: wprowadzenie wirtualnego stanu dla okapu
Normalne sterowanie okapem jest realizowane dimmerem (0-100%). Wirtualny stan jest po to, żeby się sceny dobrze mapowały i do współpracy HomeHabit.
This commit is contained in:
@@ -12,6 +12,32 @@ example of switch https://community.openhab.org/t/examples-of-scenes/16411/5
|
||||
|
||||
*/
|
||||
|
||||
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) */
|
||||
|
||||
rule "Ustaw prędkość okapu"
|
||||
when
|
||||
Item dOKAP_speed received update
|
||||
@@ -20,23 +46,27 @@ then
|
||||
sD1MINI01_bieg1.sendCommand(OFF)
|
||||
sD1MINI01_bieg2.sendCommand(OFF)
|
||||
sD1MINI01_bieg3.sendCommand(OFF)
|
||||
vOKAP_speed.postUpdate(0)
|
||||
|
||||
} else if (dOKAP_speed.state <= 32) {
|
||||
/* od 1% do 32% -> bieg 1 */
|
||||
sD1MINI01_bieg1.sendCommand(ON)
|
||||
sD1MINI01_bieg2.sendCommand(OFF)
|
||||
sD1MINI01_bieg3.sendCommand(OFF)
|
||||
vOKAP_speed.postUpdate(1)
|
||||
|
||||
} else if (dOKAP_speed.state <= 66) {
|
||||
/* 33% do 66% -> bieg 2 */
|
||||
sD1MINI01_bieg1.sendCommand(OFF)
|
||||
sD1MINI01_bieg2.sendCommand(ON)
|
||||
sD1MINI01_bieg3.sendCommand(OFF)
|
||||
vOKAP_speed.postUpdate(2)
|
||||
|
||||
} else {
|
||||
/* powyzej 66% -> bieg max */
|
||||
sD1MINI01_bieg1.sendCommand(OFF)
|
||||
sD1MINI01_bieg2.sendCommand(OFF)
|
||||
sD1MINI01_bieg3.sendCommand(ON)
|
||||
vOKAP_speed.postUpdate(3)
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user