Last trigger automation

Hello guys
i need a template to have the last trigger of an automation.
I search a solution here without find that.
How to do?
I’m newbie with template.

{{ state_attr('automation.your_automation_id', 'last_triggered') }}

like this ?

  • platform: template
    sensors:
    template_lastrigger:
    friendly_name: “last trigger”
    entity_id: automation.nuova_automazione_2
    value_template: “{{ state_attr(‘automation.nuova_automazione_2’, ‘last_triggered’) }}”

When i control the config doesn’t finish the control.

you need to format your code properly. put three backticks (```) on a line before and after the code.

Not really sure I understand what you mean by this.

when i launch the check of configuration doesn’t finish and i can’t know if the config is correct.

Yes, and I can’t tell why the config checker is failing on that code you posted because it isn’t formatted properly.

I’ve other template for other reason,like temperature,and work properly.
Where’s the error because i can’t find the error ?
With the ’ ’ i can’t compile.

this will be the last time I say this and if you don’t fix it you will be on your own…

you need to properly format your code you posted above using three back ticks (```) on the line before and the line after your code.

Also you haven’t said what the error is that you are getting.

I can’t help if you don’t provide the information.

1 Like