I’ve got a bunch of thermostats which are each a Thing. Each thermostat-Thing has multiple items, for example an “Actual_Temperature”, a “Set_Temperature”, and an “Input_Temperature”. I’ve been trying to write a code which reads out what temperature they’re set at, and then if it varies from the Input_Temperature, adjust it.
Right now I have:
Transmit temperatures to thermostats
Temperature_Targetable.members.forEach[ item |
item.sendCommand(temperature_setpoints.get(interval))
]
(Temperature_Targetable is a group of all the Input_Temperature Items)
How can I select a group of all the “Input_Temeprature” items, and then for each one check it’s value, and find the associated “Input_temperature” item?
In pseudocode I’m imagining something like this:
var new_temperature = 21
for each( item that contains "set_temperature" ) {
if(item.state =! new_temperature){
thing = item.getThing
item input = thing.getItem(contains "input_temperature")
input.postUpdate(new_temperature)
}
}