Homeassistant automation attribute: last_triggered

Since the last homeassistant update it is possible to create conditions with attributes directly so I wanted to upate my autmation code:

Old:

- condition: template
        value_template: "{{ as_timestamp(now()) - as_timestamp(states.automation.telegram_answer_cancel_light_turn_off.attributes.last_triggered) | int > 1500 }}"

New:

- condition: numeric_state
        entity_id: automation.telegram_answer_cancel_light_turn_off
        attribute: last_triggered
        above: 1500

Is it even possible to do this without a template? Or why does it not work?

1 Like