2

My Home Assistant (RPi4) keeps crashing. I'm not sure why, but I need to keep it running. My first plan was to task another computer on the network (I have many...) to ping the HA RPi4 every minute or so and cycle power on the HA server if the ping fails. Now (after upgrading HA to the most recent release...) HA crashes, but the host is still pingable. That sucks.

So, how can I check my HA host from another server on the same LAN and be sure HA itself is healthy? Suggestions?

I'm likely just coding a little Python program. I'll cycle power by plugging the HA host into an IoT plug, cycling it using MQTT /Tasmota (MQTT server is not a container on my HA server, it's on another device).

2
  • Aren't you able to use a script on the RPi4 that makes sure that the exe will be restarted if it dies? Using deamon for example. (I don't know whether that is supported on RPi4.) Commented Jul 6, 2021 at 15:12
  • HassOS uses a leaned down version of Raspian, so the OS is stunted. I wouldn't know where to start.
    – JimS-CLT
    Commented Jul 7, 2021 at 14:27

1 Answer 1

2

There is a REST API call you can make to HA to check if it's alive:

http://your.homeassistant.ip/api/

If HA is running, the call will return this:

{"message": "API running."}

You do need to authenticate though. The simplest way: generate a long-lived access token at the bottom of a user's profile page on the HA UI, then use it in a script or a curl request like this:

curl -X GET http://your.homeassistant.ip/api/ -H 'Authorization: Bearer <long lived access token>' 
1
  • Using your curl request, I get a syntax error under "GET". Also, it appears I should not include the "<>" around the Bearer operand. Do I need to import a library for curl?
    – JimS-CLT
    Commented Sep 29, 2021 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.