#Sending notification on last time an automation runs
1 messages · Page 1 of 1 (latest)
Try setting a state trigger, with entity set to your automation, attribute set to last_triggered and a suitable value in for:.
If you simply want a condition that will only be met if the automation hasn’t triggered for a certain period of time, use a template condition like this. It will only allow the automation to execute if it has been at least 1 hour since it last triggered:
{{ now() - this.attributes.last_triggered | default(0 | as_datetime) >= timedelta(hours=1) }}
Yeah I have that but that will do the inverse of what I want. It will trigger the automation on the first run of a series. I want it to trigger on the last.
That's fine...an automation can trigger all it wants, but so long as the conditions don't pass, the actions won't execute.
Um i don't follow
I'm pressing the volume down button a bunch of times. On the last press i want to send the notification.
Have you tried [this](#1336030715745271888 message)?
Not sure how i would do that?
How do you define “last press”? HA can’t read minds. It doesn’t know if you are going to press the button again or not.
If you want to trigger after “button hasn’t been pressed for 10 seconds” then you use a state trigger like Daniel suggested. But I would use the event entity or button entity as the trigger (whose state should be a datetime of when it was last pressed), and you can leave the state and attribute empty, and set for: 00:00:10
Yeah that's pretty much it @rancid panther. If the automation hasn't run again for 5 seconds it should send the Notification. So i guess i need to add a "Wait 5 seconds and check if the automation was run again" at the end - just not sure how i do that
Don’t wait at the end. Just trigger the automation when the button hasn’t been pressed for 5 seconds
But it needs to check if it's been triggered right? Otherwise it would trigger all the time after those initial 5 seconds
Here is the current automation for notification https://pastebin.com/XV19mhqU
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
No, it will only trigger once. A trigger only fires when it changes from false -> true
This will trigger the notification on the first change, not the last.
Add another trigger that is identical but adds the for: for 5 seconds
add another or change the first one?
Do you want the notify to execute both on first press and also 5 sec after last press?
just the last
ok. I will try! Thanks
But i assume if would press the button for more than five seconds in a row it will fire multiple times? or no?
It will fire once any time the volume_level stays unchanged for 5 seconds