AlexxIT / SonoffLAN

Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
https://github.com/AlexxIT/Blog
MIT License
2.67k stars 414 forks source link

S40TPB Smart Plug Energy Entity Always Displaying 0 kWh #1253

Closed tonki486 closed 11 months ago

tonki486 commented 11 months ago

The issue is with the S40 smart plug (US version). After enabling the energy entity, there is no data being populated and it always displays 0 kWh.

s40 energy

I thought that issue #1084 resolved the energy problem with the S40 plugs, but that one seems to be that the energy entity was entirely missing, while in my case, I can enable it, but it doesn't report anything. I also have S31 plugs, and the energy entities for those report data correctly.

I have included the diagnostics log below. While taking a look at the log, I notice that the energy data is present under the "dayKwh" property. Checking with the eWeLink app, the value of 0.02 kWh is correct.

"power": "15.42",
"appPower": "25.22",
"reactPower": "19.95",
"voltage": "118.97",
"current": "0.21",
"dayKwh": "0.02",  <----
"dayWorkTime": 121,
"hundredDaysKwh": "get",
"h186DaysKwh": "get"

sonoff-e5d5f5eea9a569ce516a340731f671e0-S40 - 3-b9cdf54a0a0b7aae963278b9ee7cd75b.json.txt

As a workaround, I know I could create a Riemann sum integral sensor + utility meter (daily reset) to achieve a similar result. But having the energy entity available without having to go through these extra steps would be more convenient.

tonki486 commented 11 months ago

Looks like I created this ticket too quickly. The energy entity started reporting data once a new day started.

It looks like the energy data only starts reporting the day after the S40 plug is first initialized. Or it was just a coincidence that the data started appearing after midnight. That would mean it takes multiple hours (at least 6h in my case) after adding a S40 plug to Home Assistant before the energy entity starts being populated. In any case, this is not a bug so I will close this issue.