Sonoff POW (R2) Power messuring takes long to get correct values

Hi all,

I noticed, that after switching my Sonoff POW (R2) on/off with a device attached, it can take some time until I get the correct power values :

Switch off:

[18:44:27][D][sensor.cse7766:147]: Got voltage=227.4V current=0.0A power=2.5W
[18:44:31][D][switch:055]: ‘Keller POW Relay’: Sending state OFF
[18:44:42][D][sensor.cse7766:147]: Got voltage=224.5V current=0.1A power=1.2W
[18:44:57][D][sensor.cse7766:147]: Got voltage=44.6V current=0.0A power=0.1W
[18:45:12][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W

It takes approximately 40sec until Voltage drops down to 0.

Switch on:

[18:46:01][D][switch:055]: ‘Keller POW Relay’: Sending state ON
[18:46:12][D][sensor.cse7766:147]: Got voltage=1319.5V current=0.3A power=10.6W
[18:46:27][D][sensor.cse7766:147]: Got voltage=227.2V current=0.1A power=2.5W

Same here. About 30 seconds until Voltage shows the correct value.

My esphome configuration

Any help would be much appreciated.

Casper

The values are taken directly from the Sonoff Pow R2 using a digital protocol with error correction. So any issue with the calculation is by the power sensor (probably takes some time to get warmed up)

I doubt there’s a solution to this, as the issue is entirely with the power chip - all that you can do is to filter out those values.

Thanks Otto, that sounds reasonable to me. However it does not meet my further observation I made yesterday night, when playing around with other firmware, e.g. Tasmota.

With Tasmota I get almost instant (within a second) the correct power values. That let me think, that the power sensor works accurate and fast enough.

Maybe there is a timing issue or different values are queried?

I had a look at this files, which I guess are responsible for power sensor reading:

https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/xnrg_02_cse7766.ino

and

https://github.com/esphome/ESPHome-Core/blob/dev/src/esphomelib/sensor/cse7766.cpp

But then I quickly realized, that I have no clue about c-programming :frowning:

What I also just did, was changing the log level to verbose. Then there a lot of “Invalid Header Start from CSE7766” errors per second shown: ========================= [SUCCESS] Took 59.91 seconds ========================= - Pastebin.com

Has anyone been able to figure this out. I’m experiencing the same delay of about 40 secs after the button press for values to update.

I have two others, one with original firmware, one tasmota and one esphome.

Not sure if I’ve configured it wrongly.

I retest it every time a new esphome version arrives. However, the behavior is still the same as in my first post.

The only solution for me at the moment is to stick with the Tasmota Firmware for the Sonoff POW. That’s sad, because I migrated all my devices to esphome. Only for the POW I’ve to run a MQTT broker.

Can it be a capacitor discharge? Capacitor hold some energy and discharges slowly if no load is connected. How long does it take if you have a resisitve load connected?

It is, just got rid of mqtt. Will have to add that point of failure back to my solution just for Pow R2 (I have too many Pow R2’s in my home). Can’t accurately calculate total power usage with that type of delay.

Makes no difference. I tested with and without load attached.

Ok, a parallell capacitor discharges as fast as the load uses the energy. It’s very fast. The analog input does not measure 230V AC, so there is defenetly a bunch of things in between that might affect things.

If you have a laptop charger with a led, it behaves similar. Plug it in the socket and the led shines instantly. Disconnect it and the led shines for a while.

If it only affects the voltage going low, I wouldnt worry about it.

Mduduzi Mnguni pointed me into the right direction.
The default update interval on the Esphome yaml is 60s. Replace this with the update interval that suites your use case and Bob’s your uncle.

Works great!

Set mine to 5s.

Please read my first post and my used config… Then it should be clear, that I already altered the default value from 60 to 15sec. But it took about 3 intervals (~40sec) to get the correct value.