HA 1 monitor if HA 2 is online

Hey guys,

what is the best way to monitor if ANOTHER Home Assistant has internet connection or not?

I already tried with Ping of the external url but it is always "disconnected".

What else do you recommend?

Greetings

Not sure if it is "the best", but you could try https://uptimerobot.com/

Or Uptimekuma? https://uptimekuma.org/

You can try the https://pulsetic.com/ asw ell. Setup the PING for monitoring your Home Assistant.

Call it's rest api

command_line:
  - sensor:
      command: !secret nw_ha
      name: nw_ha_curl
      scan_interval: 600
template:
  - binary_sensor:
      - name: nw_ha
        state: "{{ states('sensor.nw_ha_curl') | int(0) == 200}}"
        device_class: connectivity

In secrets.yaml

nw_ha: "curl --connect-timeout 10 -m 2.0 -s -o /dev/null -w '%{http_code}' -X GET -H 'Authorization: Bearer put_token_here' -H 'Content-Type: application/json'  http://5.5.5.5:8123/api/ || true"

Grab a long lived token from the HA UI.

1 Like

On HA2 create an automation that pings a site on the internet and if successful posts a message to a MQTT "heartbeat" topic.

On HA1 create an automation the checks the last MQTT message on the heartbeat topic.
If the heartbeat stops for more than X time, fire an alert that HA2 is down.