Build boolean helper with contitions template

Hi all.

Today i came up with a simple idea in my mind: I would like to show if my water solar panels are heating my boiler. I have no connection to my water solar controller, but i i know the the boiler temperature and if my heating pump for the boiler (not the pump for the solar panels) is running or not. So the idea is to create a template boolean helper which uses some kind of onditions to output true or false for the the state. The state represents if the solar panels are heating my boiler or not.
The math should do the following: if (current boiler temp is higher than the temp 5 minutes before) and pump is not running then output true. if (current boiler temp is higher than the temp 5 minutes before) and pump is running then output false. Else output false
Is it possible to build such a template and if so, how can i do this or can someone give me an example? Many many thanks for helping me on this task. :slight_smile:
Georg

In the future… it makes it a lot easier for us if you provide the entities that you are using. For example is “heating pump for the boiler” a sensor or a switch or an input boolean?

You will need a Trend sensor for this part.

template:
  - binary_sensor:
      - name: Solar Water Active
        state: >
          {% if is_state('binary_sensor.boiler_temp_trend', 'on')
          and not is_state('switch.boiler_pump', 'on') %}
          True
          {% else %}
          False
          {% endif %}
1 Like

You are right! That could be usefull. The pump is a knx binary sensor.

    - name: "Speicher UWP"
      state_address: "6/1/1"
      device_class: "running"

*binary_sensor.speicher_uwp_2

This is my final code in binary_sensors.yaml for this task:


- platform: trend
  sensors:
    boilter_temperature_trend:
        entity_id: sensor.boiler_temperatur
        sample_duration: 300
        min_gradient: 0.01
        


- platform: template
  sensors:
    solar_water_active:
        friendly_name: "Solar Water Active"
        value_template: >
          {% if is_state('binary_sensor.boilter_temperature_trend', 'on')
          and not is_state('binary_sensor.speicher_uwp_2', 'on') %}
          True
          {% else %}
          False
          {% endif %}