Another Template Trigger not triggering

Hellou everyone,

i know this topic is already posted different times here but searched alot i havent found any solution for my problem :frowning:
Maybe someone have a clue :slight_smile:

I have an automation which should trigger when a numeric sensor value changes from prev value. Numeric State Trigger wont work due to above/below triggers only when the value is inbetween. I decided to go with a template based trigger and compare the value to a previously saved numeric value.

Maybe someone have an Idea or a clue,
I have already a few “workarounds” which i can implement but want to know what i have done wrong
Thanks in advance for hints/ideas

alias: new automation
description: ""
trigger:
  - platform: template
    value_template: >-
      {{ states('sensor.numeric_value') !=
      states('input_number.last_value') }}
    enabled: true
action:
  - service: notify.someone
    metadata: {}
    data:
      message: "{{states.sensor.numeric_value}}"
    enabled: true
  - service: input_number.set_value
    target:
      entity_id: input_number.last_value
    data:
      value: "{{states('sensor.numeric_value')}}"
    enabled: false
mode: single

In the example you give (post a notification on any change) a state trigger on the changing entity will work, when you do not specify a to or from. If you want to avoid triggering on attribute changes, do specify a to or from, but with null as the value.

That was an easy one, thank you for very much
Have tested all possibilities bot not the state due to expected for textual changes only and haven’t seen the specific configuration
As was said in the welcome message, read the doc first :slight_smile:
Work like a charm

1 Like