#Sending notification on last time an automation runs

1 messages · Page 1 of 1 (latest)

stiff harbor
#

I'm trying to create a notification that sends the current volume level to the TV. How can i check if an automation hasn't run in a while and therefore send a notification?

stable citrus
#

Try setting a state trigger, with entity set to your automation, attribute set to last_triggered and a suitable value in for:.

rancid panther
stiff harbor
#

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.

stable citrus
#

That's fine...an automation can trigger all it wants, but so long as the conditions don't pass, the actions won't execute.

stiff harbor
#

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.

stable citrus
stiff harbor
#

Not sure how i would do that?

rancid panther
#

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

stiff harbor
#

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

rancid panther
#

Don’t wait at the end. Just trigger the automation when the button hasn’t been pressed for 5 seconds

stiff harbor
#

But it needs to check if it's been triggered right? Otherwise it would trigger all the time after those initial 5 seconds

rancid panther
#

No, it will only trigger once. A trigger only fires when it changes from false -> true

stiff harbor
#

This will trigger the notification on the first change, not the last.

rancid panther
#

Add another trigger that is identical but adds the for: for 5 seconds

stiff harbor
#

add another or change the first one?

rancid panther
#

Do you want the notify to execute both on first press and also 5 sec after last press?

stiff harbor
#

just the last

rancid panther
#

Then change the existing trigger

#

And you can remove the condition also

stiff harbor
#

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?

rancid panther
#

It will fire once any time the volume_level stays unchanged for 5 seconds