I have an automation that controls radiator thermostats offset to mitigate wrong temperature from a sensor in thermostat. So I have an external sensor that is used as the actual temperature value, then target temperature of the radiator thermostat is set based on the difference between thermostat current temperature and the actual temperature.
Now, I have several radiator thermostats in the same room. And I have a template to define a new target temperature for thermostat. I want to simplify my automation to use just area and label instead of enumeration of all thermostats in the room. Is there any way for a template to be evaluated separately for each device and, if so, how to reference the device?
So instead of repeating actions for each device, like this:
It is not clear to me exactly what you are trying to do, but I think you likely want a Repeat for Each action with a templated for_each. If you can clarify how the different entities, areas, and labels are related, we may be able to provide more specific help.
Points of confusion:
this.current_temperature: In an automation of script the variable this references the state object of the automation of script… which will not have an attribute current_temperature.
Targets follow Union logic. Each of the types, like “Label” or “Entity ID”, creates an independent list and those lists are added together. So, a climate.set_temperature action with the target shown above will be performed on all climate entities in the Main Bedroom and all the climate entities labeled thermostat… Is that what you actually want to happen?
I have several radiator thermostats in the room, they are assigned to an area and a label. I want to assign target temperature individually for each of them
‘this’ was mentioned as an example, but apparently not a correct one.
I’d like to perform an action on all entities within the area and label. So it should be all climate entities in the main bedroom that have label thermostat. the mentioned behaviour looks more like OR action - all entities that have area “main bedroom” or have label “thermostat”
Entities list include all reference temperature sensor, thermostat temperatures and target temperatures.
In each area there are entities for target and reference temperatures. So when automation is triggered, target temperature for triggered area is evaluated, thermostats from the area are selected and temperature updated