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:
3
items/virtual.items
Normal file
3
items/virtual.items
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
/* czy jesteśmy dłużej poza domem? */
|
||||
Switch sHolidayVacancy "Jesteśmy poza domem"
|
||||
@@ -61,6 +61,7 @@ Switch rSONOFF06 "Conn s06 [%s]" { mqtt="<[motherqtt:/sonoff06/lwt:state:MAP(esp
|
||||
|
||||
/* d1mini w okapie */
|
||||
Dimmer dOKAP_speed <fan>
|
||||
Number vOKAP_speed <fan> /* wirtualny przelacznik na potrzeby HomeHabit */
|
||||
Switch sD1MINI01_bieg1 "Okap bieg 1 [%s]" <fan> { mqtt=">[motherqtt:/d1mini01/gpio/12:command:ON:1],>[motherqtt:/d1mini01/gpio/12:command:OFF:0]" }
|
||||
Switch sD1MINI01_bieg2 "Okap bieg 2 [%s]" <fan> { mqtt=">[motherqtt:/d1mini01/gpio/15:command:ON:1],>[motherqtt:/d1mini01/gpio/15:command:OFF:0]" }
|
||||
Switch sD1MINI01_bieg3 "Okap bieg 3 [%s]" <fan> { mqtt=">[motherqtt:/d1mini01/gpio/16:command:ON:1],>[motherqtt:/d1mini01/gpio/16:command:OFF:0]" }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -18,7 +18,7 @@ when
|
||||
Time cron "0 50 05 * * ?" or
|
||||
Time cron "0 20 15 ? * MON-FRI" or
|
||||
Time cron "0 10/20 15-21 ? * MON-FRI" or
|
||||
Time cron "0 0,20,40 8-22 ? * SAT,SUN"
|
||||
Time cron "0 0,20,40 8-21 ? * SAT,SUN"
|
||||
then
|
||||
sD1MINI04_refresh.sendCommand(ON)
|
||||
end
|
||||
|
||||
@@ -15,7 +15,8 @@ sitemap pbrk label="Domek"
|
||||
|
||||
Frame label="Kuchnia" {
|
||||
Switch item=sD1MINI02MOS
|
||||
Switch item=dOKAP_speed label="Wyciąg" mappings=[0="OFF", 30="Bieg 1", 60="Bieg 2", 100="Bieg max"]
|
||||
/*Switch item=dOKAP_speed label="Wyciąg" mappings=[0="OFF", 30="Bieg 1", 60="Bieg 2", 100="Bieg max"]*/
|
||||
Switch item=vOKAP_speed label="Wyciąg" mappings=[0="OFF", 1="Bieg 1", 2="Bieg 2", 3="Bieg max"]
|
||||
Switch item=sD1MINI01_swiatlo
|
||||
/* Dimmer item=dD1MINI01_swiatlo */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user