Backup Power Monitoring: Modbus, Home Assistant and Independent Protection

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.
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. Establish the electrical backup path first
Not every solar inverter can form an island 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. Separate Modbus transport from 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.
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. Report states without claiming physical disconnection
The following example requires an explicitly verified device contract: 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. A permanently plausible but frozen sensor reading still goes undetected. 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, clear switching polarity, 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. Verify failures deliberately
- In controlled testing, compare documented state codes and measurements with the device display; include invalid values and communication loss.
- Restart Home Assistant and reload the automation. Status reporting must reevaluate existing states; electrical operation remains independent.
- Check power arrangements for the Pi, network and gateway 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.
- Restrict Modbus access to 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.