Hi All,
I’ve created the simple rule below for my heating system. Although it all works fine I wonder if there is a more efficient way of writing the rule. So what I’m really looking for is a review of how I’ve done and any pointers at doing things better.
Thanks,
Garry
rule "Heating On"
when
Item Living_Room_HRT4_ZW_Switch changed from 0 to 1 or
Item Landing_HRT4_ZW_Switch changed from 0 to 1 or
Item Living_Room_HRT4_ZW_Mode changed from 0 to 1 or
Item Landing_HRT4_ZW_Mode changed from 0 to 1
then
if(Kitchen_SSR_302_Radiators_Switch.state != "ON") {
Kitchen_SSR_302_Radiators_Switch.sendCommand(ON)
}
end
rule "Heating Off"
when
Item Living_Room_HRT4_ZW_Switch changed from 1 to 0 or
Item Landing_HRT4_ZW_Switch changed from 1 to 0 or
Item Living_Room_HRT4_ZW_Mode changed from 1 to 0 or
Item Landing_HRT4_ZW_Mode changed from 1 to 0
then
if(Living_Room_HRT4_ZW_Switch.state == 0 && Landing_HRT4_ZW_Switch.state == 0){
Kitchen_SSR_302_Radiators_Switch.sendCommand(OFF)
}
end
rule "Getting Cold Outside"
when
Item Weather_Current_Temperature received update
then
if(Time_Of_Day.state == "NIGHT" && Weather_Current_Temperature.state < 9.0) {
sendCommand(Landing_HRT4_ZW_Setpoint,20.0)
} else if(Time_Of_Day.state == "NIGHT" && Weather_Current_Temperature.state < 5.0) {
sendCommand(Landing_HRT4_ZW_Setpoint,21.0)
} else if(Time_Of_Day.state == "NIGHT" && Weather_Current_Temperature.state < 1.0) {
sendCommand(Landing_HRT4_ZW_Setpoint,22.0)
}
end
rule "Second Floor Need's Heating"
when
Item Louises_Bedroom_ST814_Temperature received update or
Item Joannes_Bedroom_ST814_Temperature received update
then
var Timer Night_Heating_Timer = null
if(Time_Of_Day.state == "NIGHT" && Second_Floor_Temperature.state < 18.0){
Kitchen_SSR_302_Radiators_Switch.sendCommand(ON)
Night_Heating_Timer = createTimer(now.plusMinutes(5))
[|
if(Kitchen_SSR_302_Radiators_Switch.state == ON) {
Kitchen_SSR_302_Radiators_Switch.sendCommand(OFF)
}
]
} else if(Time_Of_Day.state == "NIGHT" && Second_Floor_Temperature.state > 19.0){
Kitchen_SSR_302_Radiators_Switch.sendCommand(OFF)
}
end