01 / Connected system
NEPA Power Tracker
An ESP32 and FastAPI power monitor that detects outages after 75 seconds of missed heartbeats and sends Telegram alerts. It has logged 250+ outages since April 2026 and measures 87–93% monthly grid uptime.
- Built with
- Python · FastAPI · PostgreSQL · React · ESP32 (C++) · Telegram Bot API
- On this page
- OverviewHow it works
01 / Overview
Recording power over time.
The monitor covers one physical location. It has logged 250+ outages since April 2026 and measures 87–93% monthly grid uptime from an append-only PostgreSQL event log, alongside the current status.
- Current electricity status and outage history
- Monthly grid uptime from an append-only event log
- Telegram alerts for outages and restorations
- Outage-duration forecast, validated by backtesting
02 / How it works
Heartbeat monitoring
The ESP32 sends a heartbeat while it has power and connectivity. If heartbeats stop for 75 seconds, the FastAPI backend records an outage and sends a Telegram alert.
03 / How it works
Time and refresh
Today’s timeline stops at the current time; completed days cover the full day. The dashboard keeps existing data visible while refreshing in the background.
04 / More detail
Under the hood.
- No false outages
- An asyncio lock keeps incoming telemetry and the watchdog from recording the same transition twice. A generation counter cancels stale timers, and a restart grace window stops a backend restart from creating a new outage record.
- Duration forecast
- The forecast estimates how long a current outage will last from comparable past outages. It abstains when there are fewer than 8 comparable outages, and it was validated by backtesting.