And “Office” as an example could be “Shop”, “Water_Room”, “Basement_Storage”, “Electric_Room”, or “Main_Basement”. I have a group that has all my room names and I know from @rlkoshak that I can do something like this:
The tl;dr is you need to name the Items such that you can construct the name of an associated Item using the name of the Item you have. This may require some String manipulation, usually a split("_"). With the name, you can pull the Item out of a Group using a filter or find first. So it would look something like:
Basement_Rooms.members.forEach[ room |
var setpoint = HVAC_Items.members.findFirst[ room.name+"_Tstat_HeatSetPoint" ] as NumberItem
var temp= HVAC_Items.members.findFirst[ room.name +"_Tstat_Temperature" ] as NumberItem
var damper = HVAC_Items.members.findFrist[ room.name+"_Damper" ] as SwitchItem
damper.sendCommand(if(setpoint.state > temp.state) ON else OFF)
]
I suspect that was a fluke. The String “Office_Tstat_HeatSetPoint.state” comes before “Office_Tstat_Temperature.state” alphabetically and so > returns false instead of an error.
2018-04-03 16:13:40.006 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Testing': java.lang.String cannot be cast to java.lang.Boolean
var setpoint = HVAC_Items.members.findFirst[ sp | sp.name == room.name+"_Tstat_HeatSetPoint" ] as NumberItem
var temp= HVAC_Items.members.findFirst[ t | t.name == room.name +"_Tstat_Temperature" ] as NumberItem
var damper = HVAC_Items.members.findFrist[ d | d.name == room.name+"_Damper" ] as SwitchItem
Use the DP post as a guide over my quick and dirty (and apparently wrong) example above.