Automation with numeric_state trigger using value_template is not triggering

Newbie here.

I am attempting to create an automation to notify me when a ZigBee sensor (via ZigBee2MQTT) has failed to send an update for more than some number of seconds.

This is what my automation’s configuration looks like:

alias: New automation
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.workout_repeater_last_seen
    value_template: "{{ as_timestamp(now()) - as_timestamp(state.state) }}"
    above: 150
condition: []
action:
  - service: notify.persistent_notification
    data:
      message: Reported by {{ state_attr(trigger.entity_id, 'friendly_name') }}
      title: Test
mode: parallel

I have tested the value_template in the template developer tools, like so:

{{ as_timestamp(now()) - as_timestamp(states.sensor['workout_repeater_last_seen'].state) }}

and that shows the expected number of seconds, starting at (near) zero when an update is received and increasing until the next update.

I can sometimes get the automation to trigger once, but then nothing else happens until (maybe) after I change something in the configuration, but usually not even after that.

My configuration seems the same as what is explained here, so I think I have the syntax right.

Hoping someone can spot what I’m doing wrong.

I have come across this comment in another post:

I suspect this is why my automation is not triggering, as I am waiting for a notification that the entity has not changed value for X time, but the trigger would only be re-evaluated if the entity does change value.

Is that right? Where is this explained?

I thought this had been changed with a recent update, but it seems to still work as it did previously. As to where it’s explained… AFAIK, it was never explicitly explained anywhere except in forums posts like the one you linked. I found it out through empirical testing.

You would be better off just using a Template trigger:

alias: New automation
description: ""
trigger:
  - platform: template
    value_template: |
      {{ now() -  states('sensor.workout_repeater_last_seen') | as_datetime > timedelta(minutes=2.5) }}
condition: []
action:
  - service: notify.persistent_notification
    data:
      message: Reported by {{state_attr('sensor.workout_repeater_last_seen', 'friendly_name')}}
      title: Test
mode: parallel