Is there a possibility to check if Home Assistant is up and running by script?

  • Hallo everyone,
    I'm very new to Shelly and also to scripting.

    I have got Home Assistant running on a Raspery Pi in my office and sometimes it crashes. To be able to turn the Raspberry of and on from home when it happens I got a Shelly PlugS. works like a charm with the interface and also with webhooks.

    The vision would be to have a script that checks if HassOS is up and running and if not to turn itself off and on again to restart the home automation.

    Does anyone know a simple way how to accomplish that? Maybe by checking the webinterface? I did quite some research but can't figure it out myself. Raspberry and PlugS are in the same network.


    Thanks a lot in advance,
    Georg

  • Hi,

    I solved this challenge with:

    - A "Heathbeat" signal [binary sensor / with a toogle signal] / via helper (random) functionality

    - This signal is connected to MQTT

    - The Shelly script read the MQTT binary and after 900 seconds no signal-change a email is send to myself.

    lg

    Hummelchen

  • Hiegeix7

    Is your Raspery Pi reachable by ping, whenever it “crashes”?
    That Test would be the most easy and cheap one.

    My experiences show that Raspi with ping is available but Home Assistant is crashed.

    lg

    Hummelchen

  • If the Raspberry is still on and reachable, the better way is, to send a shutdown -r now.

    Just turn off and on by cutting the power supply can end in a total failure of the operating system.

    But the problem is that Shellys don't know ssh. However, the problem can be solved with a little http server in python


    If needed I can deliver that piece of code. So you can reboot the Raspberry by a simple http://<raspberry_ip>/reboot.

    Kommentare zum elektrischen Anschluss meinerseits sind grundsätzlich zur Weitergabe an Fachpersonal gedacht und stellen eine theoretische Diskussionsgrundlage dar.

    Gruß aus Ostfriesland

    Michael

  • Dieses Thema enthält 4 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.