Remote power monitoring
The power delivery in Ukraine currently faces challenges due to a power deficit caused by Russian terrorist attacks on the Ukrainian infrastructure. As the balance between consumption and generation fluctuates, periodic shutdowns occur in different districts based on a semi-accurate schedule.
My apartment is on a high floor, higher than most people are willing to climb by stairs. Typically, during a power outage, you would prefer to spend more time outside. Thus, my family and I need to know when the electricity is on or off, no matter where we are.
Project Goals
- Receive notifications when power goes online and offline.
- Gain insight into power outage patterns and durations to improve home routines and travel planning.
Potential Solutions
- Rely on one of the smart devices that already sends notifications when it goes offline.
- Leverage the full capabilities of homelab infrastructure.
I don’t think I need to explain why the latter option is the best one, right?
Requirements
- One power independent server
- One indicator of the electricity presence
As a power-independent server, I’ll use my existing AWS Lightsail instance, which I maintain for my pet projects. It will handle all management tasks, including checking the home power status, keeping a history, and sending notifications. To check if my home has electricity, I’ll use a network device with a persistent IP address that is always connected to the network. There are countless ways to check if the home is offline, but the method I chose fits well with my secondary goal of trying out the Tailscale subnet router feature.
Tailscale
Tailscale is an app that creates a flexible and easy-to-use software-defined network on top of the fast and secure WireGuard protocol. I have my own network that I can access from anywhere in the world. This network allows me to connect to any device I’ve joined, with a granular access control list (ACL) that lets me decide which devices can see and access specific resources.
In this project, an additional server acts as a Tailnet subnet router. It connects the device used to detect electricity status to the Tailnet since direct installation on the device is impossible. Although I could use this server instead of the AWS one, I prefer the Lightsail instance due to the Uptime Kuma app already installed there.
Uptime Kuma
The core of my monitoring system is Uptime Kuma, a self-hosted monitoring tool that supports various monitoring methods such as HTTP(S) requests, ping, gRPC, DNS, and others. To check device connectivity, I’ll use a simple ping through Tailnet. As long as the ping is successful, it indicates the device is connected to the network and powered on. After configuring the ping monitor, I immediately started collecting outage events, addressing one of my initial goals.
Notifications
To inform my family about the power status, relying solely on the status page is insufficient. Uptime Kuma offers a variety of notification options out of the box. I tested two: webhooks and Telegram. Using webhooks with n8n allowed me to customize texts or payloads sent to users, including AI-powered jokes. However, after trying both, I opted for native Telegram notifications for their reliability, avoiding unnecessary complications. While this means fewer fun messages, it reduces dependencies.
Future Enhancements
Initially, I considered using the EcoFlow API, which not only indicates power status but also provides data on current backup battery charge. However, they require a business week to review API access requests, which delayed this integration. Once approved, this can be a great addition to the intranet monitoring system in the future.