Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95480

Help with detecting if a room in the house in below temperature

$
0
0

@theCheek wrote:

I’ve created a group.all_radiators containing all my Tado Thermostatic Valves in one group.

My idea is to create a template sensor that iterates over each radiator, and if one of the radiators’ current_temperature is below the rooms desired temperature, then the sensor should be set to “Cold”.

I’m pretty new to Jinja2, so am trying to get my head around the whole variables not being available outside a scope (loop), otherwise I would have just set a variable to cold then returned this variable at the end of the for… loop.

Here’s what I’ve got so far:

      cold_rooms:
        friendly_name: Cold Rooms
        value_template: >
          {% for radiator in states.group.all_radiators.attributes.entity_id %}
          {% if state_attr(radiator,'current_temperature') | float < state_attr(radiator,'temperature') | float %}
          COLD
          {% else %}
          HOT
          {% endif %}
          {% endfor %}

Obviously the result is a mess:

COLD HOT HOT HOT HOT HOT HOT

All I want is Cold to be set as the sensor state if any one of the radiators is colder than its configured temperature. I’m obviously missing something so obvious I will kick myself.

Any help much appreciated :slight_smile:

Posts: 8

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95480

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>