Help with template in automation to control netatmo valves with a thermostat

Fixed at the end !!! I thought that the template had stopped working but it was that it had to start from a difference of less than one (negative) to more than 1 to trigger the automation.
Everything perfect!!! thank you all very muc!!!, I was going crazy

I donā€™t think I deserve the solution. That should go to @Didgeridrew or @123 I just came in and helped correct syntax.

Yes, among the 3 you have achieved the solution, regards for you three.
I donā€™t know how to do it : Who should mark the solution?, or should write the code in another message?

Personally, Iā€™m fine with J getting the ā€œSolutionā€ since itā€™s working.

But I would like you to post the full, final working automation. We may need to submit this as an issue on the github, since the behavior of the numeric state trigger template doesnā€™t seem to conform to the way the documentation says it should be done.

Corrected. Your first template worked, it couldnā€™t start from a difference greater than 1 (- or +) to trigger it. Itā€™s working perfectly.
Iā€™m sorry for all the laps that I have made you give

Hello again I need your help. I had to modify the action because ā€œclimate.turn_onā€ did not work and I had to create scripts to make it work.
I have had to do 2 automations, one for on and one for off. The one to turn off is fine ,it turns off when the temperature is 1 higher than the target. The one to turn on has to go from being the same temperatures to 0.1 difference. It works until it coincides that there is a change in the programmed target temperature and it doesnt pass through 0 it does not trigger automation. I put the code:

- id: '1638916756789'
  alias: termostato_atico_on
  trigger:
  - platform: numeric_state
    entity_id: climate.termostato_atiko
    value_template: '{{ (state.attributes.current_temperature - state.attributes.temperature)
      | abs }}'
    above: 0
  condition: []
  action:
  - service: script.turn_{{ 'on' if state_attr('climate.termostato_atiko', 'current_temperature')|float
      <= state_attr('climate.termostato_atiko', 'temperature')|float else 'off' }}
    target:
      entity_id: script.valvula_atico_on
  mode: single
- id: '1638916756700'
  alias: termostato_atico_off
  trigger:
  - platform: numeric_state
    entity_id: climate.termostato_atiko
    value_template: '{{ (state.attributes.current_temperature - state.attributes.temperature)
      | abs }}'
    above: 1
  condition: []
  action:
  - service: script.turn_{{ 'on' if state_attr('climate.termostato_atiko', 'current_temperature')|float
      >= state_attr('climate.termostato_atiko', 'temperature')|float else 'off' }}
    target:
      entity_id: script.valvula_atico_off
  mode: single
1 Like