Duke Energy Usage Today sensor rising off the charts!
apercrcl01 opened this issue · 5 comments
v0.1.0b7
At a little after 11am eastern time, the Duke Energy Usage Today sensor started climbing much higher than the actual usage. The Duke Energy Current Usage sensor is functioning properly. I checked the Duke app and can confirm that I am not actually using this much energy. I have tried restarting Home Assistant. Restarting the Duke App. When I get home I will try to power cycle the gateway.
I am seeing the same behavior.
I just started seeing this around 6pm Eastern. Investigating...
I believe they changed their API responses today. I have always used the "i" variable to pull the energy reading in Wh for a given minute. However, at the same time as the spike, this value suddenly spiked about 10x. The new value looks like a power reading to me (in W).
Before this change, the value in "dr" always equaled the value in "i". Now they are different. Perhaps I should be using "dr". I am slightly concerned however that "dr" seems to have lost precision after this change.
EX: "i" is 717.85, "dr" is 12.0. If "i" is average watts for that minute, then the energy reading for that minute would be 717.85 / 60 = 11.96 Wh. This value is only a small error from 12.0 but that would add up over a day. I'll do some testing and figure out which one the app shows.
The difference isn't as big as I thought. In my situation, the app shows 15.59 kWh. Using "dr" calculates to 15.595, and using "i" comes to 15.598. I'm going to put an update into the mjmeli/pyduke-energy repo to switch the data source. I'll then need to update the HACS integration. Since this is somewhat critical, I will need to push a new stable version and a new beta version.