Backup Power Monitoring: Modbus, Home Assistant and Independent Protection

Management Summary
Backup power monitoring makes the condition of a home energy reserve visible: whether the grid is available, how much battery charge remains and how much power can be supplied. Home Assistant brings these readings together locally, without relying on the manufacturer’s cloud. This helps assess readiness for an outage. The monitoring system provides information; electrical switching and overload protection must remain independently effective, including when the monitoring itself fails.
Contents
Local Modbus monitoring keeps inverter data available without the manufacturer’s cloud, provided the inverter, gateway, network and Home Assistant remain powered. Grid status, battery charge and power limits can then be observed locally. Home Assistant does not replace guaranteed backup transfer or electrical overload protection.
Load shedding means disconnecting selected loads so that the remaining demand stays within the backup system’s capacity. Two responsibilities need separating. A professionally designed electrical installation handles grid isolation, backup supply and required load shedding independently of the automation server. Home Assistant adds displays, history and notifications. Local communication reduces external dependencies but does not guarantee real-time response.
1. The electrical backup path comes first
An island is a local electrical supply separated from the public grid. Not every solar inverter can provide this supply during a grid outage. Backup operation requires a supported function, a suitable battery or available generation, and the manufacturer’s intended transfer equipment. Continuous output, short-term overload capacity, starting currents, phase allocation and battery limits determine usable loads. State of charge alone does not describe these limits.
Electrical-panel design and commissioning require a qualified electrical professional. Contactors switch loads; RCBOs protect against specified residual-current and overcurrent faults. These components do not automatically create grid isolation or safe backup logic. Selection, wiring and failure behavior must suit the installation. A heat pump is not universally a non-critical load: frost protection, controls and manufacturer requirements can change priorities.
One possible architecture supplies only selected circuits through the backup path. Other installations require manufacturer-provided load management or an appropriately designed independent controller. The loads disconnected when control power disappears, and the conditions for reconnection, need definition and verification. A single relay or a Home Assistant switch command does not establish these properties.

2. Modbus transport and the register map
Modbus RTU typically uses a serial RS485 connection. Modbus TCP uses a different message format over TCP. A translating gateway can provide Modbus TCP; a transparent serial server instead carries unchanged RTU messages over TCP. These cases correspond to type: tcp and type: rtuovertcp in Home Assistant. An Ethernet connector alone does not determine the choice.
A register is an addressable data field in the device. The register map specifies which field contains a measurement or status code and how that value is interpreted. Register addresses and state codes depend on the device and firmware. Grid status is not universally located at 33000, nor battery charge at 37000. Home Assistant uses zero-based addresses. A manual’s reference such as 40001 can mean the first holding register, at address 0; conversion must follow the register documentation.
| Measurement | Required checks | Meaning |
|---|---|---|
| Grid and backup status | Address, register type, valid codes and update behavior | Grid absent and backup active are different states. |
| Battery state of charge | Data type, scaling and invalid values | Energy reserve, not a direct measure of available output power. |
| Power and overload status | Sign, unit, phase reference and device limits | Additional operating information, not a replacement for protection. |
Polling intervals request updates. Device response, serial transmission, other requests, timeouts and retries extend actual detection time. Even a two-second interval does not guarantee a response within two seconds. Unchanged or restored readings can be stale; reliable freshness monitoring needs, for example, a documented device heartbeat or the timestamp of a successful read.
3. Read-only YAML with explicit prerequisites
The following template is deliberately incomplete. Entries using !secret must be supplied from the verified device map; register addresses are centrally configured, not thereby confidential. This template fits only a device with a 16-bit input register for grid status and a 16-bit holding register reporting charge in whole percent. Different register types, word order, scaling or error codes require changes. An existing supported device integration can simplify manual mapping.
# configuration.yaml: incomplete until documented addresses are supplied
modbus:
- name: inverter_local
type: tcp
host: !secret inverter_host
port: 502
sensors:
- name: Grid Status Raw
unique_id: inverter_grid_status_raw
device_address: !secret inverter_unit_id
address: !secret inverter_grid_status_address
input_type: input
data_type: uint16
scan_interval: 5
- name: Battery SoC
unique_id: inverter_battery_soc
device_address: !secret inverter_unit_id
address: !secret inverter_soc_address
input_type: holding
data_type: uint16
unit_of_measurement: "%"
scan_interval: 30The five- and thirty-second intervals are monitoring starting points only and must suit manufacturer guidance and bus load. Both sensors only read; reading a holding register does not write to it. The actual entity ID can differ from the expected sensor.grid_status_raw and must be checked before using the automation.
4. State reporting without a claim of physical disconnection
The following example requires a verified interpretation of the device’s status codes: 0 means grid absent and 1 means grid present. Other codes, unknown and unavailable represent an unclear state here. The automation belongs as one entry in the automation editor’s YAML mode. An automations.yaml list additionally requires appropriate list indentation.
# One automation in the automation editor's YAML mode
alias: Backup telemetry status
triggers:
- trigger: state
entity_id: sensor.grid_status_raw
- trigger: homeassistant
event: start
- trigger: time_pattern
seconds: "/30"
actions:
- action: persistent_notification.create
data:
notification_id: backup_telemetry_status
title: Backup telemetry
message:
{% set raw = states('sensor.grid_status_raw') %}
{% if raw in ['0', '0.0'] %}
Grid loss reported. Actual backup and load state need verification.
{% elif raw in ['1', '1.0'] %}
Grid present reported. This is not proof of protection availability.
{% else %}
Grid state unknown or invalid: {{ raw }}. No blackout conclusion.
{% endif %}
mode: restartState changes, Home Assistant startup and a thirty-second timer update the same local notification. The display therefore does not rely solely on a one-time numeric threshold crossing. For example, a sensor may keep reporting 1 even after new data stops arriving. The automation does not yet detect this stale reading that still looks valid. The message proves neither active island operation nor a contactor’s physical position.
Additional convenience load shedding needs a separate installation-specific design: an approved local interface, a clearly defined meaning for on and off commands, actual contact-position feedback and coordinated restart conditions. The basic electrical function must remain independent of this addition when Home Assistant, the gateway or the network fails.
5. Deliberate failure checks
- Controlled tests compare documented state codes and measurements with the device display, including invalid values and communication loss.
- The tests include Home Assistant restarts and automation reloads. Status reporting must reevaluate existing states; electrical operation remains independent.
- Power arrangements for the Pi, network and gateway need checking in the intended operating condition. A gateway disconnected with the grid cannot supply telemetry during the outage.
- A qualified professional performs electrical transfer and load tests according to the manufacturer’s procedure. Software tests do not replace commissioning.
- Modbus access belongs only on the required local network. Classic Modbus TCP does not automatically provide encryption or authentication; Modbus Security is a separate extension requiring support at both ends.
Questions and answers
Does unavailable mean a grid outage?
No. The state can indicate a failed communication path, an unreachable device or another fault. A conservative load strategy can respond, but needs a professionally defined fallback rule. A missing reading must not be displayed as a proven grid outage.
Does local polling guarantee overload-free backup power?
No. Electrical operation depends on sizing, transfer equipment, protection and load limits. Local monitoring adds visibility while the participating components work.
Does a second Modbus gateway fix slow readings?
Not necessarily. Required registers, actual response times, line speed and permitted polling intervals need checking first. Another connection can add pressure to device connection limits or a shared serial bus. Several contiguous registers may also represent one multiword measurement; register count and request count are not identical.