Automation Trigger - If temperature of sensor1 is above the temperature of sensor 2 - how?

This is a simple configuration that works:

trigger:
  - type: temperature
    platform: device
    device_id: 116b30000000000000000000003
    entity_id: sensor.sonoff_000000001_temperature
    domain: sensor
    below: 20

And this is what I am trying to do, but I get an error that the value isn’t a float:

trigger:
  - type: temperature
    platform: device
    device_id: 116b30000000000000000000003
    entity_id: sensor.sonoff_000000001_temperature
    domain: sensor
    below: {{ sensor.sonoff_000000002_temperature + 10 }}

What I am trying to do is to turn on a pump, when the temperature of the furnace boiler water is above the temperature of the drinking boiler water. (So it heats it up, not cools it down).

Is this even possilbe?

I can’t post you a code to put in your automation, but did you consider condition in automation?
I don’t know will it work you have to test it. And there is also a variety of helpers you can create so check it out.

Thans for the reply. Even if I use a condition I would have to somehow write “if temperature from sensors 1 is bigger than temperature from sensors 2”. I don’t know how to put 2 sensor values in one “uf” sentence

:thinking:

/

When a template triggers

{% if states('sensor.sensor1') > (states('sensor.sensor2'))

I don’t know if a device trigger accepts a template or not (but I doubt it).

but you can use a template trigger and that uses a value_template as the test.

so yours should be:

- platform: template
  value_template: "{{ states('sensor.sonoff_000000001_temperature') | float < states('sensor.sonoff_000000002_temperature') | float + 10 }}"

Thanks everyone. i got it in the correct direction.
Seems to work, but only 50% of the time.

Which probably is a networking or someting else.

What did you end up doing?

it might help the next person who has the same question.

I followed the krskrab answer. I made 2 templates with JINJA2. One for when the temperature is higher and when when the temperature is lower. Trigered when it returns TRUE.

The trigere then turns on a a smartdevice.

i can be more detailed when I perfect it e.g. when I make it actually work reliably.

I created 2 Automations. On for turning the pump on, one for turning the pump off.

<Image missing as I don’t have the right to post it as a new user>

The trigger is a simple template. Below to turn the pump off.

I tested it and it worked. I can also see it in the logs
<Image missing as I don’t have the right to post it as a new user>

I’ve also set the Sonoff devices as high pripority in my network and this seemed to have helped. Or the reboot of the HomeAutomation helped. At the moment it runs on the VM over wifi, will put it on a raspberr once I get my hand on one.