So when the state of my home change to Night or similar I will change my heating setpoint to the night level.
My items are:
Number Heating_LivingRoom_Setpoint (Group_SetPoint, Group_LivingRoom)
Number Heating_LivingRoom_Setpoint_Night (Group_SetPointNight, Group_LivingRoom)
so in my rule I have:
Heating_LivingRoom_Setpoint.state= Heating_LivingRoom_Setpoint_Night.state
Heating_BedRoom_Setpoint.state= Heating_LivingRoom_Setpoint_Night.state
But to make it more generic and share the code here I was thinking about looping through the group instead of copying to each room:
Group_SetPoint.members.filter[l|forEach[l| l.sendCommand((l.name + "_Night").state)) ]
and to even make it more compact “_Night” could be taken from the TimeOfDay varaible, but not all time of the day has its own set temperature…
My complete rule for reference is here:
rule StateRule
when
Item TimeOfDay received command
then
//if WORKMODE.state.toString == "NORMAL")
if(TimeOfDay.state.toString == "MORNING") {
//heatUp to 18C in bedrooms, 21C in livingroom,23C in bathroom
Heating_LivingRoom_Setpoint = Heating_LivingRoom_Setpoint_Day
}
else if(TimeOfDay.state.toString == "DAY") {
//Dim lights for 15 minutes from 0% to 100%
//dimLights(Group_LivingRoom,100,15*60).apply
//dimLights(Group_MasterBedRoom,70,15*60).apply
//dimLights(Group_Hallway,85,15*60).apply
//heatConstant to 18C in bedrooms, 21C in livingroom,23C in bathroom
}
else if (TimeOfDay.state.toString == "WORK") {
//heatDown to 10C in bedrooms, 12C in livingroom,16C in bathroom
}
else if (TimeOfDay.state.toString == "AFTERNOON") {
//heatUp to 18C in bedrooms, 19C in livingroom,23C in bathroom
}
else if TimeOfDay.state.toString == "EVENING") {
//Dim lights for 60 minutes from 100% to 40%
//dimLights(Group_LivingRoom,40,60*60).apply
//dimLights(Group_Hallway,40,60*60).apply
//heatup to 21C in living Room
else if TimeOfDay.state.toString == "NIGHT")
//heatDown to 14C in bedrooms, 10C in livingroom,18C in bathroom
Heating_LivingRoom_Setpoint = Heating_LivingRoom_Setpoint_Night
}
//}
end