Template in Automation Trigger

I am struggling how to put this template inside this automation trigger. What I am trying to achieve is to have the automation trigger when the temperature increases by 2c more than the generic thermostat is set to.

Can anyone point me in the right direction, or give me an example on how to do it?

11

trigger:
  platform: template 
  value_template: >
    {{ (states('sensor.fibaro_system_fgms001zw5_motion_sensor_temperature_4')|int)
      > (state_attr('climate.stue' , 'temperature')|int + 2) }}
1 Like

Very few triggers take a template. Numeric state does, only for the value_template section. Even then, that section is meant for pulling numerical states out of odd places inside your state object, not for what you are trying to do (compare to something else).

You need to use @anon43302295’s method for what you want to achieve.

Thanks, it is working as I want now.
Two things:

  1. It looks like this automation is triggering each time I restart ha. Is the solution for this to make a condition with not to run this automation unless ha has been running for x minutes?
  2. How can I do the opposite, to run an automation if the temperature is decreasing 2c less than what the generic thermostat is set to?

Yes re condition to prevent homeassistant start.

Turn the symbol round, so greater than becomes less than.