So, I have five TRV things, where each has an item for the desired term (TRV_Lounge_Target_Temp, TRV_Kitchen_Target_Temp, …).
Each TRV has a current temp item of type Number (TRV_Lounge_Current_Temp, TRV_Kitchen_Current_Temp, …) [well I had to innovate!]
I have a heating controller thing of type Switch (ON/OFF) and item name is HVAC_Switch.
So, I’d like a rule that takes the max value from all of the TRV_Target_Temp and compares this with the corresponding TRV_Current_Temp, and if the target temp has been reached then the HVAC controller is switched OFF otherwise it remains ON, but only for up-to ONE HOUR max, after which the rule turns off the HVAC (aka “it gives up!”).
There’s many ways to cook this broth, I could craft a quick script:
if ( TRV_Lounge_Current_Temp.state >= TRV_Lounge_Target_Temp.state
and TRV_Kitchen_Current_Temp.state >= TRV_Kitchen_Target_Temp.state ) {
HVAC_Swtich.sendCommand(OFF)
/* followed by code to disable HVAC switch for an hour , prob a cron rule , not decided */
}
but not being an Xtend / Java guru, I wondered if someone could provide some magic that would allow the logic to be flexible ,to cater for any future TRVs I might add using the same nomenclatures. So provided I name future TRVs accordingly, this logic would self-adapt?
A teaser for you coding experts!