I think I may have a better solution, at least a more generally usable one.
The PowerPanel software version 4 (unlike 3) supports snmp queries, and HA supports SNMP as sensor definitions.
If you install it, you can configure and enable SNMP (it is disabled by default - expand the SNMP band at the top of the page). If you are using SNMP on the system to which the USB connected UPS is attached, then you can use a different port (I chose 1161 instead of 161).
Then configure the software as usual on the system, whatever you want it to do; irrelevant for HA.
On HA you define a sensor as:
- platform: snmp
host: 192.168.130.41 <<<< PC running Powerpanel
baseoid: .1.3.6.1.4.1.3808.1.1.1.4.2.3.0 <<< Get these from CPS's MIB
community: somesecret <<<<<<<<<<< defaults to public
port: 1161 <<<<< Coordinate with what you put in powerpanel setup
name: Office UPS Load Percentage
value_template: '{{ (value | float) }}'
unit_of_measurement: "%"
MIB definitions are here: https://www.cyberpowersystems.com/product/software/mib-v2-0/
If you can’t read MIB’s (it’s painful without automation), here are a few OID’s:
Input voltage: .1.3.6.1.4.1.3808.1.1.1.3.2.1.0
Output Voltage: .1.3.6.1.4.1.3808.1.1.1.4.2.1.0
Charge Remaining: .1.3.6.1.2.1.33.1.2.4.0
Time Remaining: .1.3.6.1.2.1.33.1.2.3.0
Here’s one I will list in full as I think it’s neat how you can translate:
- platform: snmp
host: 192.168.130.41
baseoid: .1.3.6.1.4.1.3808.1.1.1.4.1.1.0
community: secret
port: 1161
name: Office UPS Status
value_template: >
{% set vals = {'1': 'unknown', '2':'onLine', '3':'onBattery', '4':'onBoost', '5':'sleep', '6':'off', '7':'rebooting'} %}
{{vals[value]}}
I like this approach as it should be system neutral and require nothing be installed on the remote systems except the powerpanel software.
Postscript: I am finding the reported load percentage does not match the dashboard, checking, will update. I’ve opened a ticket with Cyberpower.
Postscript 2: If you have a firewall on the PC running powerpanel don’t forget to open up udp connections to the port you use or you will get no response; you can test by turning off the firewall for a bit. Powerpanel does not apparently take care of it.