A power monitor for a country house: grid, inverter, generator
How to find out that the house has lost power, what it is running on right now and how long the battery will last, when half of the sensors go dark together with the house.
The power at my country house goes out from time to time. The house then switches to the inverter, and when the battery runs down, I have to start the generator. I needed to know that the power is out, what the house is running on right now and how much longer the battery will hold. A power monitor now keeps track of that.

A relay on the main feed instead of a sensor
The catch is that the sensor that should report a grid failure is itself powered from that grid. That became the signal: there is a smart relay in the distribution board, powered from the incoming line, and the monitor simply checks whether it responds. If the relay does not respond, there is no power on the main feed. The monitor itself runs on the router, which has its own UPS, so it survives the outage and sees it.
At first I could not read measurements from the relay: its local protocol is encrypted with a key from the vendor's cloud. Outage tracking did not need that anyway, reachability was enough.
Three sources without a single sensor on the generator
Nothing monitors my generator, but I still managed to detect when it is running. What helped was an access point that is powered from a wall socket, not from the UPS.
| Grid | Inverter | Access point | Source |
|---|---|---|---|
| up | does not matter | does not matter | normal |
| down | responds | does not matter | on inverter |
| down | silent | responds | on generator |
| down | silent | silent | blackout |
A notification goes out on every transition, and when the grid comes back a summary arrives: how long the house stayed on each source.
What the monitor has grown
The monitor caught its first real outage on the day of the rollout, July 24, 2026. After that it gradually grew features. An outage log appeared with a timeline of phases: when the grid went down, when we moved to the generator, when everything came back. The monitor accumulates generator engine hours and reminds me about the oil change when fewer than 30 hours are left before it, and for every outage it estimates the fuel burned.

To see real volts, amps and kilowatt-hours, I had to reflash the inverter relay and put a meter with open firmware on the main feed. The forecast of how long the battery will last and the main feed protection both rest on these measurements.
How long the battery will last
Battery capacity cannot be described by a single number: by my measurements it delivers 2.63 kWh at a 600 W load and only 2.27 kWh at 1150 W. So the forecast is calculated for the current load. The monitor takes all "from full charge to cutoff" sessions, builds a dependency from them and gets roughly this picture:
- 500 W: 5.3 hours;
- 1 kW: 2.3 hours;
- 3.5 kW: 38 minutes.

It is also a measurement of battery health: degradation shows up in the trend of these sessions.
Main feed protection
The house hangs on a 50 A main breaker. If it trips, that means a request to the grid company and a house without power until the crew arrives. So my meter on the main feed breaks the circuit earlier, at 53 A, and then restoring power becomes a button in the dashboard.

The threshold is set by current, not by power: the breaker trips on current, while the voltage on the main feed drifts from 202 to 243 V, and a threshold in watts is off by ten percent. It is set above the breaker rating on purpose. The thermal release holds 56.5 A for an hour and longer, so the breaker will not notice 53 A, and the pump's inrush currents will not cut the main feed.
The cutoff is done by the meter, not by the monitor. It survives a crash of the container, the router and Wi-Fi. There is no automatic restore: with the load still connected it would produce a cycle of switching on and off. A cutoff must not end up in the outage log. Its numbers are needed for reconciliation with the supplier, so cutoffs are recorded separately.
The monitor's mistakes and one mistake by the agent
Devices on the country house Wi-Fi silently disappear for minutes while still powered. A failure is now accepted only after three failed probes one minute apart, while a return is recorded quickly: a false "the power is back" is harmless.
Because of the same Wi-Fi, an outage could start straight from the generator. The relay is silent, the inverter is silent, the access point is alive: formally that is "on generator". In reality the generator is started by hand a couple of hours later, and the radio took down two devices at once. Such a start now waits 10 minutes.
The first version had a check based on the server's network cable, and it lied: the inverter powers the whole house together with the switch, so the cable always showed "power is present". I had to cut it out.
Capacity was calculated in two places, and one of the functions did not discard junk measurements: a one-minute session of 0.02 kWh got into the calculation, and "0 minutes left" went out in a notification with a live battery. The voltage sag threshold was hardcoded as 198 V, and the monitor missed real sags down to 202 V.
After a trial trip of the cutoff the meter disappeared from the network. The agent concluded that the meter is powered downstream of its own relay and that the cutoff is pointless, cancelled the task and wrote that into the documentation. I objected: since the meter could be switched back on, that theory is wrong. The check took one command: the meter's uptime had not reset, power had not been lost, and it had disappeared because of Wi-Fi. The cutoff was enabled the same day.
What the monitor does not see
There is no perfect detection by reachability: the log has a "false alarm" button, and it is needed. If the meter goes silent because of Wi-Fi, the monitor will see the same thing as with a grid failure. There is no measuring device on the generator phase, and the voltage in the house during that time is unknown.
A monitor like this is for a house with backup power, where it matters to know the source and the remaining charge, not only the fact of an outage. How its events spread across the house, to the phone, to voice and to the family bot, I will describe in the next article.
Tags: Diagnostics, Monitoring, Power, Self-hosting
Read next
Home backup power: a review of my own setup
Grid, inverter and generator in one cascade. What turned up when I drew the diagram of the setup for the first time and walked through it asking about failures.
Where a network anomaly detector should live
A script on the router or logic in a flow collector that is already running - how the plan shrank by half and what a run over the history showed.
My own panel on a mobile router: one Go binary and 128 MB of memory
What I managed to do with a pocket LTE router, the Huawei E5885. A dependency-free panel in Go, ad blocking, a connection map, operator SMS and counters that lied.
Comments