I’ve set up a uptime monitor for my home automation system so that I’m notified when it is down. Such event could mean two things: either Internet connectivity issue, or system is down due to power failure, crash etc. The service is provided by UptimeRobot and is free. It can watch over your system by pinging it or issuing a HTTP GET request every now and then. I chose to go for the second option, as by having that request served by Node-RED flow I’ll be able to both verify that Node-RED is up and my system is connected to the Internet to send me notifications should that be necessary.
The Node-RED flow to serve the HTTP request issued by UptimeRobot is extremely simple:
It spits out a message “Raspberry Pi is Up!” then you access pi’ ip address:port/watchdog. I use duckdns for dynamic DNS, so with a bit of port-forwarding on my router the above mentioned page is exposed to the web. I have enabled basic HTTP authentication on Node-RED as a simple security measure against accidental lands on my control page.
So it checks my home automation system every 5 minutes and will immediately send me email notification upon detecting it is down.
I have it running of over a week now and my uptime isn’t exactly perfect, but as they say “if you can’t measure it, you can’t improve it”