Configuring UPS in Energy Dashboard

I have energy monitoring (using ESPHOME Pzemac) both at the input as well as the output of my 1100 VA UPS which handles all light loads, networking and home automation devices.

I used the power (not energy) sensors of the UPS input and output to create a virtual sensor “sensor.ups_power” whose value is the difference between the output power and the input power. I consider this as the power consumed by the UPS to run (its electronics, trickle charging the battery at steady state, charging the battery after power is restored, etc.,).

I find that the value of this sensor.ups_power is almost a constant (~30W) at steady-state i.e., there has been no grid power failure for a while and the battery is fully charged.

If a power failure happens and grid power is restored, I see this sensor value shoots up to a large value (~350W) then reduces in steps back to 30W with varying time gaps, e.g., ~350W for 15 min, then 230W for 20 min, then 100W for 10 min, then finally to 30W.

Now, I know the UPS needs 30W to work its electronics. So the excess will have to be roughly the power used to charge the battery. So I created another virtual sensor, sensor.battery_charging_power whose value when (UPS input power > 0) is (states[‘sensor.ups_power’].state | float - 30 ) and 0.0 when (UPS input power == 0)

I then created yet another virtual sensor, sensor.battery_discharging_power whose value is the same as the UPS output power when (UPS input power == 0) and 0.0 when (UPS input power > 0)

I used the PowerCalc integration to create energy sensors corresponding to sensor.battery_charging_power and sensor.battery_discharging_power and used the new energy sensor in the Energy dashboard’s “Home Battery Storage”.

To account for the 30W that the UPS draws at steady state, I added a corresponding “fixed” energy sensor called “UPS Energy” to the “Individual Devices” section of the Energy Dashboard.

I’d like some comments and/validation of what I did here with the UPS configuration in the Energy Dashboard. I’m also interested to know if things will “tally” in my Energy Dashboard or will I have to make some adjustments? Or is it all completely wrong? :grinning: