Hey fam, I’m sooo close to getting this working correctly. I recently created three virtual power meters, one for each peak rate where the power used gets tallied up across the meters depending on TOU. For some reason, when the source data resets to zero at midnight, the meter dives into negative values like it’s calibrated to do so somewhere. I think it’s similar to this person’s problem Replaced energy meter energy dashboard shows huge negative value
Here’s a graph of what my power draw from the energ provider looks like in a 24 hour period:
I had attempted to manually change the state of the meter to zero with the hope that it would take it from there (look at the upwards spike at around 12:30am in blue) but it re-corrected back to the negative values.
Any idea what’s going on here or where I can have HA reset whatever corrective math it thinks is necessary here?
Here’s a screenshot of the off-peak meter’s graph and attributes – Based on the attributes, it seems to know it should reset itself at midnight:
and here you can see the source data resetting itself to 0 at midnight (don’t mind the second drop in the graph, that was me restarting the hardware that tracks this, attempting to troubleshoot this issue)
Renamed title to be more clear – it’s negative data in a Utility Meter, not the negative data question that sometimes arises when looking at things in the Energy dashboard.
Apparently the developer of the integration can’t figure out how to handle sensor resets when net metering is enabled. The code only works if the input sensor reports a perfect zero at reset.
I’ve created an automation to calibrate the meter to zero at midnight:
alias: Reset PG E Off Peak at Midnight
trigger:
* platform: time
at: "00:00:00"
action:
* service: utility_meter.calibrate
data:
entity_id: sensor.pg_e_off_peak
value: 0