Hi. Could you help to my automation please.
I want to create automation when the temperature in the solar is 1 degree higher than the temperature in the Jacuzzi, then the pump in the solar should turn on. and when will be the same or lower turn Off.
My code no work
switch.sonoff_1001032177 - this is SONOFF TH16 so can on and off power and have temperature sensor - sensor.sonoff_1001032177_temperature
climate.spa_thermostat - Bestway temperature spa sensor
device_id: f0bba9a51e0f73eff2b53d25dfc82948 - Bestway temperature spa sensor.
alias: SOLAR HEAT
description: ""
trigger:
- platform: state
entity_id: sensor.sonoff_1001032177_temperature
to: # null to triggers on every state change, ignores attribute changes.
- platform: state
entity_id: sensor.f0bba9a51e0f73eff2b53d25dfc82948
to:
action:
- service: >
{% if states('sensor.sonoff_1001032177_temperature') | float(0) >
states('sensor.f0bba9a51e0f73eff2b53d25dfc82948') | float(0) + 1 %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
target:
entity_id: switch.sonoff_1001032177
- delay:
minutes: 5
mode: single
max_exceeded: silent
The delay at the end prevents this automation running any more than once every 5 minutes to prevent rapid power switching of your pump. Adjust this time as you see fit. Be warned that this timer will reset if you reload the automation or restart home assistant.
Thank you for your help.
I don’t know what the problem is, but now the solar pump turns on by itself, e.g. now when the temperature on sonoff is 28, and in the pool 31 which cools my pool Something is probably still wrong in this code