Keep WiFi online during a power outage, ensuring battery security cameras and smart devices stay connected.
Get notified within seconds of a power outage.
Get notified when WiFi goes down. Either once the Uninterruptible Power Supply (UPS) for the WiFi runs out of battery (usually 1-2 hours), or ISP/WiFi issues.
If you skip the UPS, you just need 1 Raspberry Pi instead of 2. But you will only be notified when power and WiFi go down together.
An Uninterruptible Power Supply (UPS) - under £150 (e.g., APC BE850G2-UK).
2x Raspberry Pi Zero 2 W - around £20 each.
2x 16 GB MicroSD cards - around £5 each.
1x MicroUSB cable.
1x MicroUSB cable with charger.
Optional 2x cases for Raspberry Pis - around £10 each.
Plug your MicroSD card into your computer.
Install Raspberry Pi OS using Raspberry Pi Imager.
Run Raspberry Pi Imager, select the correct version of your Raspberry Pi. Select Raspberry Pi OS (64-bit). Select your MicroSD card.
Click "EDIT SETTINGS" after clicking "NEXT". Pick a username and password that you'll need for later. Also input your WiFi settings.
Wait for the installation to complete, then remove the MicroSD card. Insert the MicroSD card into the Raspberry Pi.
Once you've done this with both Raspberry Pis; plug one Raspberry Pi into the UPS and the other into a wall socket.
Find the local IP address of the Raspberry Pi by checking your router's connected devices list. The IP should look something like 192.168.X.X. See screenshot for an example using the ASUS Router app:
Open Terminal on Mac or PowerShell on Windows. Enter the SSH command using the username you set and the Raspberry Pi's IP address:
ssh username@192.168.X.X
Enter the password you set when prompted. You should now be connected to the Raspberry Pi.
Create a new Uptime Monitor, select "Heartbeat Monitor", name it either "Home WiFi" (if plugging into the UPS) or "Home Power" (if plugging into the wall). Select 30 seconds interval with a 10 second grace period. Or select a longer grace period if you don't want to be notified about downtime that might only last a few seconds.
Copy and paste the below into your terminal:
read -p "Enter the Raq.com Heartbeat URL: " ping_url && echo -e '#!/bin/bash\n\nwhile true; do\n curl -I '"$ping_url"'\n sleep 30\ndone' > ~/ping.sh && chmod +x ~/ping.sh && echo -e '[Unit]\nDescription=Ping URL\nAfter=network.target\n\n[Service]\nType=simple\nExecStart=/bin/bash '"$HOME"'/ping.sh\n\n[Install]\nWantedBy=multi-user.target' | sudo tee /etc/systemd/system/pingraqcom.service > /dev/null && sudo systemctl daemon-reload && sudo systemctl enable pingraqcom.service && sudo systemctl start pingraqcom.service && sudo systemctl status pingraqcom.service
You will be asked for the Heartbeat URL, which will look similar to: https://raq.com/heartbeat/439fa4894f67be20cb18c1640009c526. Paste in the one in your account for that monitor and press enter.
The command installs a service that pings the Raq.com Heartbeat URL every 30 seconds. If the URL is unreachable, you will be notified within seconds. If the Raspberry Pi loses power, when it boots up the pinging service will automatically restart.
Go back to your account and click the confirmation button. You should now see a "Last Successful Ping".
You'll now get notified within seconds if your power or WiFi goes down. You can add additional notification contacts (email, SMS, Telegram, Slack, Discord and more). You can test notifications, by unplugging your Raspberry Pi.
If both Heartbeat monitors go down at the same time, that means there is an issue with your Internet. If only power goes out, but WiFi stays online, you know it's a power issue.
If you need to uninstall the service from the Raspberry Pi in future, just run this command:
sudo systemctl stop pingraqcom.service && sudo systemctl disable pingraqcom.service && sudo rm /etc/systemd/system/pingraqcom.service && sudo systemctl daemon-reload