Binary sensor to compare climate sensor group values

Hi all,

My goal is to have a binary sensor which states if any of my climate sensors has a current temperature lower than my target temperature (minus 0.3).

I am using the below configuration for this:

binary_sensor:
  - platform: template
    sensors:
      evohome_heating:
        friendly_name: "evohome heating"
        value_template: >-
          {{ expand('group.evohome_climate_sensors')
          | selectattr('attributes.current_temperature', '<', 'attributes.temperature')
          | list | count > 0 }}

I am ensuring that all climate sensors return values. However the binary sensor always returns unavailable.

The error log says < is not supported between instance of str and float. However both seem floats in the entity:

hvac_modes:
  - 'off'
  - heat
min_temp: 5
max_temp: 35
preset_modes:
  - none
  - temporary
  - permanent
current_temperature: 19.2
temperature: 19.5
preset_mode: none
status:
  setpoints:
    this_sp_from: '2023-01-03T07:10:00+01:00'
    this_sp_temp: 19.5
    next_sp_from: '2023-01-03T15:00:00+01:00'
    next_sp_temp: 19.5
  zone_id: '6988629'
  active_faults: []
  setpoint_status:
    target_heat_temperature: 19.5
    setpoint_mode: FollowSchedule
  temperature_status:
    temperature: 19.5
    is_available: true
friendly_name: Zitkamer
supported_features: 17

Is my select attribute statement invalid?
And would anyone know how to include the offset of 0.3 in this?

You are selecting entities where the rendered value of the current_temperature attribute is less than the string “attributes.temperature”… the second argument is not rendered the way the first is.

Any suggestion how to compare two attributes of the same entity?

Hello there, I’m in the same situation of mjvanderveen, because my group of heater controllers does not provide hvac_mode value, so I’ve tougth to count all climates that have state=heat and current_temperature < temperature.
How can I do that?

{% set cli_list = expand('group.evohome_climate_sensors')
| selectattr('attributes.current_temperature', 'defined')
| selectattr('attributes.temperature', 'defined')
| list %}
{% set ns = namespace(y=[]) %}
{% for x in cli_list if x.attributes.current_temperature <=
x.attributes.temperature %}
{{ x.entity_id }}
{% set ns.y = ns.y + [x.entity_id] %}
{% endfor %}
{{ ns.y | count > 0 }}

Great example!

@terafil i switched to using ramses_cc which allows me to read all valves independently and get their combined heat demand values from the evohome controller.

It gives more flexibility then the honeywell integration in hass.