A Home Assistant integration for monitoring CyberPower UPS devices via Modbus/TCP with SNMP-based metadata and device-type detection.
This custom-component does not require additional components such as NUT https://wiki.archlinux.org/title/Network_UPS_Tools
Modbus/TCP is an extremely efficient method for collecting bulk data at a high rate and is used in industrial automation services for this purpose.
- Single-phase UPS support (tested)
- Three-phase UPS support (experimental/untested)
- SNMP metadata: model, serial, firmware via UPS-MIB and CyberPower enterprise OIDs
- Local polling: Modbus/TCP (port 502) + SNMP (port 161)
- Block read optimization with fallback to individual reads
- Per-endpoint Modbus locking to serialize I/O to the same device
- Per-cycle connect/close with reconnection and backoff handling
- Pacing delays for devices that require slower read cadence
- Holding register polling only (input registers are not supported on tested hardware)
flowchart TB
UI["Home Assistant UI"]
COORD["DataUpdateCoordinator<br/>(cyberpower_modbus)"]
MODBUS["Modbus/TCP Client<br/>- per-cycle conn<br/>- lock per device<br/>- block reads"]
SNMP["SNMP (metadata)<br/>UPS-MIB + CP OIDs"]
UPS["CyberPower UPS"]
META["Model/Serial/FW"]
UI --> COORD
COORD --> MODBUS
COORD --> SNMP
MODBUS --> UPS
SNMP --> META
- Go to HACS in Home Assistant
- Click the three-dot menu and select "Custom repositories"
- Add repository:
https://github.com/aburow/cyberpower-modbus-ha - Select "Integration" category
- Install "CyberPower UPS Modbus"
- Restart Home Assistant
- Copy
custom_components/cyberpower_modbus/toconfig/custom_components/ - Restart Home Assistant
- Go to Settings → Devices & Services → Integrations
- Click "Create Integration"
- Search for "CyberPower UPS Modbus"
- Go to Settings → Devices & Services → Integrations
- Click Create Integration
- Search for and select CyberPower UPS Modbus
- Configure:
- Host: Modbus/TCP host name or address
- SNMP Community: SNMP community string (default: "public")
- Device Name: Friendly name (optional)
- Port: Modbus/TCP port (default: 502)
- Unit ID: Modbus unit ID (default: 1)
- Scan Interval: Update interval in seconds (default: 10)
Device type (single/three-phase) is detected via SNMP (UPS-MIB input line count).
- Home Assistant 2024.1 or later
- CyberPower UPS with:
- Modbus/TCP enabled (port 502)
- SNMP enabled (port 161)
- Network connectivity to the UPS
- Single-phase register mapping is validated against a live CyberPower device.
- Three-phase register mapping is included but untested; treat as experimental.
- Local
pre-commithooks runruff,semgrep, andgrain. - Install once:
uvx --from pre-commit pre-commit install - Run manually:
uvx --from pre-commit pre-commit run --all-files
- SNMP not returning metadata: verify SNMP is enabled and community is correct.
- Modbus connection errors: confirm Modbus/TCP is enabled and port 502 is reachable.
- Illegal function / input register errors: the UPS only supports Modbus holding registers (FC03).
- Useful checks:
ping <device-host>nc -u <device-host> 161telnet <device-host> 502
Add this to configuration.yaml to enable debug logs:
logger:
default: info
logs:
custom_components.cyberpower_modbus: debugUseful debug entries to expect:
Modbus connect ok/failed in XmsModbus close completed in XmsWaited X.XXXs for Modbus lockBlock read succeeded: <block>Block read returned error <block>Applying backoff: <seconds>
License: see LICENSE for details.