Skip to content

Issue with House Average Humidity State #10

@BrianChapman

Description

@BrianChapman

I found that the state in the House Average Humidity template was loosing the "vals" variable outside the for loop. I updated the variable to use a namespace and that resolved the issue for me.

I'm on HA 2026.1.2

 {# >>> EDIT THESE ENTITY IDS TO MATCH YOUR SENSORS <<< #}
          {% set rooms = ['sensor.lennox_thermostat_humidity'] %}
          {% set params = namespace(vals = []) %}
          {% for e in rooms %}
            {% set s = states(e) %}
            {% if s not in ['unknown', 'unavailable', 'none', ''] %}
              {% set params.vals = params.vals + [ s|float ] %}
            {% endif %}
          {% endfor %}
          {% if params.vals|length == 0 %}
            unknown
          {% else %}
            {{ (params.vals|sum / params.vals|length)|round(1) }}
          {% endif %}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions