Home Assistant Community

Notification when my device is offline

#1

I’m new on HA, and I’m want it to send me a notification on my phone when my HA hub is offline( due internet connection or power failure), and reset in case is just the internet.

0 Likes

#2
0 Likes

#3

the problem is that I don’t know whitch trigger i should use

0 Likes

#4

You want HA to send you a notification if it loses internet or loses power? Think about that question for a second…

The only way that will happen is if you have a backup battery and a second internet connection (cellular, GSM, etc.). And at that point, you now have redundant systems in place and should never experience such a failure. The only thing I can think of is having an external service that pings your HA and when it stops responding, then send you a notification. But this would be external to HA and hardly anything, if anything at all, to configure in HA. Not sure if a DDNS service like DuckDNS would do this or not.

0 Likes

#5

Can I use the internet connection as a triggert to reboot my RPI (some times the connection fails and when I reboot It comes back)

1 Like

#6

You probably can, but It has nothing to do with HA at this point. You would create a script that acts like a “dead mans switch” and if something doesn’t change, say a counter, a heartbeat, whatever that’s being set externally, then the script executes and issues a reboot command on the RPi.

0 Likes

#7

At least for the part of knowing if either the HA system or the internet connection is down, I have implemented the following:

On the server hosting HA, I have a cronjob that sends a ping every minute to healthchecks.io which then notifies me via Pushover if no ping has been received for the last 5 minutes.

But I don’t have any automated restart/reset or internet reconnect in place since the failure situations can be pretty complex and likewise are the steps to resolve.

0 Likes

#8

hey man, interested in this.
How did you set this up?

0 Likes

#9
  • Sign up on healthchecks.io
  • “Add Check” on their website for your HA server - this will give you a ping URL.
  • For my HA server I configured a period of 1 minute and grace time of 5 minutes.
  • Add “Pushover” (or whatever you prefer and is supported) as an integration.
  • On my HA server (running Ubuntu 16.04), I added a new line to /etc/crontab with your personal ping URL, and which will run every minute.
* * * * *       root    curl -fsS --retry 3 https://hc-ping.com/ad372ea0-xxxx-xxxx-xxxx-xxxxxxxxxxxx > /dev/null
1 Like

#10

Thanks mate.

Went with the easy route in configuration.yaml:

rest_command:
  healthcheck:
    url: 'https://hc-ping.com/xxxxxxx'

Running Hassio on RPi2

1 Like

#11

I have a NodeRED flow that looks at the HA webhook.

If it doesn’t hear anything from the webhook in 10 mins then it will fire off an alert.

0 Likes