Last time a webhook was triggered

Hello, I am trying to use a webhook for starting a pump for 15 minutes. Each time the webhook is started again it should extend the duration by 15 minutes.

Hence, I’d like to know when was the last time the webhook was triggered to create an automation where the trigger is something like “webhook was not triggered for the last 15 min”, then turn off the pump.

Or maybe it’s not possible to make that simple and I need to create a sensor for this?

As far as I can tell, there’s no way to access that info directly, but you could set up an automation, that receives the webhook post and stores the current date and time in a helper variable. Then you could in turn use this helper to access the last webhook activation and also trigger your pump automation, whenever the state of the helper changes.

this is a very old question. bummer that it wasn’t answered initially. however in case others come to seek this I’ll answer it… I believe it is indeed possible.

state_attr('automation.webhook_automation', 'last_triggered')

will provide the last time the webhook was triggered. so you can use a template trigger that compares it to now() offset by some timedelta() of your choosing.