SonoffLAN icon indicating copy to clipboard operation
SonoffLAN copied to clipboard

Sonoff S60 generally works but it loses overall energy consumption

Open guciopl opened this issue 2 years ago • 16 comments

On/Off control works ok, Daily and Month energy meters are correct. Volts, Amps, Watts I did not exactly check but looks that this is correct as well.

Only thing malfunctioning is overall energy used. It keeps resetting, no idea why. I have 3 of them and on all 3 overall consumption regularly disappears (1st picture in batch of 3). Therefore when I use sensor.sonoff_1002XXXXX_energy in Energy dashboard it shows total bullshit (2nd picture in batch of 3). For example S60TPF is desk LED lamp using 9W, and in Energy dashboard daily energy consumption shows 0,88kWh, while the true one is 0,04. All other readings are ok (3rd picture in batch of 3) and they match ewelink readings (last picture). Let me know if I can assist somehow by sending some more logs or sharing device to Your account.

led led2 led3 lod lod2 lod3 pc pc2 pc3 Screenshot_20240415_142538_eWeLink

guciopl avatar Apr 15 '24 12:04 guciopl

Energy should have history for last 30 days. Check attributes of your sensor https://github.com/AlexxIT/SonoffLAN?tab=readme-ov-file#sonoff-pow

AlexxIT avatar Apr 15 '24 13:04 AlexxIT

I don't think this is matter of history settings. I don't set them at all and I have 20+ sonoff devices (mostly POW) and they all work well. Definitely something is wrong on HA side with calculating actual power to energy usage. I bought another S60 and added it to HA to double check it.

Daily/monthly usage from app is correct (I verified that with independent power meter): Screenshot_20240417_104627_eWeLink

Those 2 attrubites are passed to HA correctly and visible there: 12

However actual power usage readings are somehow incorrect, and when I link it with power meter entity by this:

- platform: integration
  name: energy_spent_S60chlod
  source: sensor.sonoff_100223XXXX_power
  unit_prefix: k
  round: 2

This is what I see in Energy dashboard after adding sensor.energy_spent_S60chlod there: 11

All needed entities like - sensor.sonoff_100223XXXX_power - sensor.energy_spent_S60chlod are of course added to recorder in configuration.yaml

guciopl avatar Apr 17 '24 08:04 guciopl

The component just requests data from the cloud. I've never seen this data. I don't have any of these devices.

AlexxIT avatar Apr 17 '24 09:04 AlexxIT

Hi! I am also having problems in Energy dashboard when adding S60 devices. Data in Individual devices usage is not shown correctly as seen on next two screenshots. I shows negative Energy when it should be positive. I think there is problem with data timestamp. Any ideas? Screenshot_2024-04-22_08-17-42 Screenshot_2024-04-22_08-19-34

tpehant avatar Apr 22 '24 06:04 tpehant

I'm having the same issue, maybe it's because Energy dashboard treats them as incremental not daily?

jabbas avatar Jul 12 '24 20:07 jabbas

In my case, in the db data looks ok:

image

But when put in the energy tab:

image

jabbas avatar Jul 12 '24 21:07 jabbas

I can confirm the issue, I have 2xS60TPF and they both do the same.

Another problem I found is that I cannot add the power consumption to the "Energy Tab", despite both devices working correctly.

I guess there's some configuration error on the addon side, both plugs are working perfectly.

Gherry777 avatar Oct 11 '24 14:10 Gherry777

Problem with wrong metering I solved with adding method: left to the configuration:

- platform: integration
  name: energy_spent_jacuzzi
  source: sensor.sonoff_XYZ_power
  unit_prefix: k
  round: 2
  method: left

as per: https://www.home-assistant.io/integrations/integration/#integration-method

Devices I use S60TPF with are not having constant usage, so this metering method is better suited. Now readings in HA match readings in Ewelink. They are being also correctly transformed into daily usage in Energy tab once I registered energy_spent_jacuzzi there.

If someone doesn't need current usage and simply want to have daily readings from device transfered to Energy tab, then the easiest thing to achieve that is to modify S60TPF's _energy_month entity in customize.yaml. You need to set it as total_increasing:

sensor.sonoff_ABC_energy_month:
  device_class: energy
  unit_of_measurement: kWh
  friendly_name: "Device"
  state_class: total_increasing

guciopl avatar Oct 11 '24 16:10 guciopl

Where exactly did you find customize.yaml? I'm having the same problems and I really only need the energy consumption te be correct for my use case, so i'd like to implement the fix you found.

Thanks in advance!

mikeschat avatar Oct 12 '24 16:10 mikeschat

Where exactly did you find customize.yaml? I'm having the same problems and I really only need the energy consumption te be correct for my use case, so i'd like to implement the fix you found.

Thanks in advance!

I have it in root directory, next to config.yaml. It is included in that config like this:

homeassistant:
  customize: !include customize.yaml

I think You can also put that code directly to config.yaml but not sure.

guciopl avatar Oct 12 '24 17:10 guciopl

I have the same issue with the S60 plugs and large negative consumption in the 0:00 time bucket. Any ideas what's causing this or how to resolve or work around it? Was considering creating an Integral on the current power value and seeing if that does the same, I suspect it won't from looking at the data.

RichardP-1 avatar Dec 12 '24 08:12 RichardP-1

Problem with wrong metering I solved with adding method: left to the configuration:

- platform: integration
  name: energy_spent_jacuzzi
  source: sensor.sonoff_XYZ_power
  unit_prefix: k
  round: 2
  method: left

as per: https://www.home-assistant.io/integrations/integration/#integration-method

Devices I use S60TPF with are not having constant usage, so this metering method is better suited. Now readings in HA match readings in Ewelink. They are being also correctly transformed into daily usage in Energy tab once I registered energy_spent_jacuzzi there.

If someone doesn't need current usage and simply want to have daily readings from device transfered to Energy tab, then the easiest thing to achieve that is to modify S60TPF's _energy_month entity in customize.yaml. You need to set it as total_increasing:

sensor.sonoff_ABC_energy_month:
  device_class: energy
  unit_of_measurement: kWh
  friendly_name: "Device"
  state_class: total_increasing

@guciopl Thanks for these work arounds, both seem to work great.

For others that have not got this working yet, I would just add that you can now do the 1st work around direct in the UI without having to use config files. Just add a new Helper, select "Integral" give it a name, use the original power sensor as the input. Set Metric prefix to "k", Time unit "Hours", Method "left", Precision "2" and submit. Then add the newly created sensor to the energy dashboard. Simples! :-)

petebanham avatar Dec 29 '24 11:12 petebanham

any news on this? I know that i cant do integral "trick" but since there is an entity for the required data (energy) it should be used.

It seems that the energy reading gets zeroed every hour:

Image

lukpep avatar Feb 07 '25 15:02 lukpep

I confirm in April 2025 the same behaviour. Any chance to get it fixed?

mvimercati avatar Apr 07 '25 19:04 mvimercati

I confirm in April 2025 the same behaviour. Any chance to get it fixed?

It should work fine if you follow the steps above. 😁

petebanham avatar Apr 07 '25 20:04 petebanham

Yes, the workaround should work. I'm trying it, thank you

mvimercati avatar Apr 07 '25 20:04 mvimercati