Better Thermostat boiler demand template

Just sharing my template for setting boiler demand based for a group of ‘Better Thermostat’ devices.

I use this to turn my boiler on when any of the thermostats calls for heat, and off when none of them do.

note: I don’t think both the ‘temp < requested’ and ‘mode = heating’ are required, but it works fine with them both in.

template:
  - binary_sensor:
      - name: "Heat Demand"
        unique_id: boiler_demand_group
        #state: "{{ integration_entities('better_thermostat') | expand | selectattr('attributes.hvac_action','eq','heat') | list | count | float(0) > 0 }}"
        state : > 
                 {% set BTStats = integration_entities('better_thermostat') | expand %}
                 {% set climates = namespace(under=[]) %}
                 {% for BTStat in BTStats %}
                 {% if BTStat.attributes.current_temperature < BTStat.attributes.temperature and BTStat.attributes.hvac_action == 'heating' %}
                 {% set climates.under = climates.under + [ BTStat.entity_id ] %}
                 {% endif %}
                 {% endfor %}
                 {{ climates.under | length > 0 }}
111
1 Like