Combining two binary sensors

Hello everyone

I want to create a “problem” binary sensor that is on whenever the heat request for my boiler (I get that as a % value from Tado) is above 50% for 30 minutes and the gradient of the temperature (I can get that using the ‘trend’ binary sensor) is < of a certain value

This will highlight when my boiler hasn’t fired up in the morning

What’s the correct sintax for combining a numeric sensor and a binary sensor into a resulting binary sensor?

I want the resulting sensor to be on (problem) when:
Sensor1>50 & Sensor2=Normal

The problem I have is that the combined binary sensor always shows as ‘normal’ no matter the conditions

This is the code I’m using

  - platform: trend
        entity_id: sensor.salotto_temperature
        sample_duration: 7200
        min_gradient: 0.00008
        device_class: heat
  - platform: template
       device_class: problem
       friendly_name: 'BoilerON' 
       value_template: "{{states('sensor.salotto_heating') | float > 50 }}"
       device_class: problem
       friendly_name: 'BoilerError' 
       value_template: >-
          {{ is_state('problem', 'Problem')
             and is_state('temp_rising', 'Normal') }}

binary sensor is true/false or in HA terms ‘on’/‘off’. If it’s a deviceclass heat, true should mean it’s rising.

       device_class: problem
       friendly_name: 'BoilerError' 
       value_template: >-
          {{ is_state('binary_sensor.problem', 'on')
             and is_state('binary_sensor.temp_rising', 'off') }}

If you take a look at the device class settings, both explain what to use when looking at the binary state:

Hi, still not working


BoilerON is ON and temp_rising is OFF
But BoilerError is OFF

Also, for my understanding, what’s the meaning of “>-”?


just removes whitespace. I don’t bother with the - because HA naturally removes all whitespace anyways.

Template’s not working because we aren’t using the full entity_id name. I edited the post with the correct entity_ids