I would like to schedule an automation to run if another automation has not been triggered for 15 minutes.
My use case is as follows. I have a remote device checking in every 10 minutes and that check in triggers an automation. The check in uses the Tailscale interface. Lets call that a "heartbeat". I have found that occasionally, the Tailscale interface needs to be reloaded (or the "heartbeat" automation is not run. Therefore, I would like to be able to check the "heartbeat" automation - and if it has not been triggered for 15 minutes, I will reload the Tailscale app. I have the reload process figured out - I just can't figure out how to create a trigger based upon another trigger exceeding a "time since"
Every automation has an attribute called last_triggered that is a datetime representing the last time when the automation was triggered and the actions were run. You can use a Template trigger to fire when that value represents a time more than 15 minutes in the past:
Thank you for all the assistance. Prior to posting the question I had tried the State Trigger method suggested by @Troon , but it did not work for me. Then I tested the scenario again, and it did trigger. I also tried the Template method suggested by @Didgeridrew and that worked as well.
One thing that I discovered in further testing. In the following scenario:
Heartbeat run
Restart HASS
No Heartbeat for over 15 minutes - even if it is over 15 minutes after the restart of HASS.
In that scenario, the Template trigger ran but the State Trigger did not. I am not totally sure why that would be the case, so although the Template trigger is simpler, is it possible that the State Trigger would be more resiliant?
If it's important that your automation runs and doesn't matter if it runs early or too often, you could add triggers for restart and automations reloaded.