Is there a trigger for checking remote access?

I’m running a tunnel on a domain through Cloudflare, creating remote access with the HA addon “Cloudflared”. Recently I was not at home and couldn’t get access to my HA. The problem was that the addon stopped or was not started at start up. This is of course a huge problem.

I was thinking if there was a trigger to check if the remote access connection is still established (or if it changes), then I could restart the addon like this:

alias: "restart cloudflared"
trigger: []
condition: []
action:
  - service: hassio.addon_stdin
    data:
      addon: [name_of_addon]
      input: restore-sensor
mode: single

So is there a way to check if remote access is still available?

Have you got the Watchdog toggle turned on in the addon’s info page?

yes, I have. So it’s a mystery to me why the addon was still turned off because this feature should do exactly what I want. I thought I might come up with a backup solution if watchdog fails like it did. Because I didn’t stop the addon manually.

Have you looked at the logs for the addon?

There is a service hassio.addon_start that may be of use but I don’t know much about it.

I didn’t check the log on that specific day, I could only check it much later when I was home since I didn’t have remote access. Couldn’t find anything then.

Services to restart the addon are not the problem. The problem is finding a trigger for checking if there is a remote connection or not. I mean the domain itself was not offline, the tunnel to my HA installation was just not there anymore, so simply checking for a response of the domain is not helping. That’s why I thought there might be a more efficient way.

Restarting the addon at specific times might be a workaround but not so nice if you’re remote connected at the time.

Found the solution. :star_struck: There is a hidden (deactivated) entity, a binary sensor that checks if the addon is running. In the entities section I had to check to show all deactivated entities and then search for the sensor. Now I can finally use it to trigger my automation.