I flashed my Sonoff POWCT with ESPHome. The relay works perfectly, but the power accuracy is most definitely NOT correct. I tested it with an electrician. I have 2 units, one has ESPHome and the other is stock with the Ewelink app.
The mains measure 235w and when the 3kw geyser kicks in, the house measures 1183w. The device with the stock firmware measured over 4kw. Oh and when exceeding the 4kw, the ESPHome flashed POWCT actually drops it’s reading to 537w
Can anybody kindly please point me in the right direction? I tried flashing to Tasmota, but apparently that’s not possible.
Thnak you @VasilisA.
Honesty I’m pretty new on git pull request and in esp home development scene. If you guys can test it and confirm it is working also on your side you can post a comment in the pull request.
First of all I’d like to thank you for helping with the pull request. I forgot to reply back, but I have found a fix which in my opinion is much quicker to do.
Referring to the official config file which can be found on the ESPHome website by clicking here, there is a section that says “Measurement divided by the PI number”. I had to pull the logs on the device in “VERY_VERBOSE” mode to verify that it’s in fact referring to the PI number as in 3.14… in mathematics, which it did.
Below is the “wrong” piece of configuration:
sensor:
- platform: cse7761
update_interval: 2s
current_1:
name: Current
id: a_sensor
unit_of_measurement: 'A'
accuracy_decimals: 3
icon: mdi:current-ac
filters:
# Measurement divided by the PI number
- lambda: return x / PI;
voltage:
name: Voltage
id: v_sensor
unit_of_measurement: 'V'
icon: mdi:sine-wave
active_power_1:
name: Power
id: w_sensor
filters:
# Measurement divided by the PI number
- lambda: return x / PI;
icon: mdi:flash
on_value_range:
- above: 4.0
then:
- light.turn_on: switch_led
- below: 3.0
then:
- light.turn_off: switch_led
All I did to fix it was to remove the filters, please see my code below:
I have no idea why the developers thought is was necessary to do this, but removing this actually fixed the issue and the reading matched with my Sonoff POWCT that still had the stock Ewelink software installed.
Oh and please see this section in the log where the “raw” data was being divided by the PI number:
[18:58:21][D][cse7761:224]: Channel 1 power 3681.787109 W, current 26.911350 A
[18:58:21][V][sensor:043]: 'Power': Received new state 3681.787109
[18:58:21][VV][sensor.filter:014]: Filter(0x3ffb3104)::input(3681.787109)
[18:58:21][VV][sensor.filter:286]: LambdaFilter(0x3ffb3104)::new_value(3681.787109) -> 1171.949219
[18:58:21][VV][sensor.filter:021]: Filter(0x3ffb3104)::output(1171.949219) -> SENSOR
[18:58:21][D][sensor:094]: 'Power': Sending state 1171.94922 W with 1 decimals of accuracy
I hope this helps. Please do not hesitate to ask, should someone have any questions.
I did indeed remove the filters. Please refer to this post. The second piece of code is with the filters removed. That’s pretty much the fix, just remove the filters and the power readings would be correct.
Not as yet, I only saw it today. I saw that it mentions that without the patch, up to 2kw is accurate, then over 2kw is inaccurate. The patch fixes that. You marked solution to remove the filters, I wonder if it doesn’t solve the over 2kw issue? Possibly only the patch is the right fix for this issue in all cases?
I did a lot of testing before eventually removing the filters. It definitely fixes the accuracy above 2kw. The post I marked as the solution, is still the solution for me, but I’d like to test the more “official” fix as well. I’m probably only going to be able to test it the weekend. I will definitely report back. Can you also please post your findings once you were able to test the PR?
Thanks. I will do so, but likely only get around to it weekend or next week even. What I’m not clear about then, is should the PI filters remain or be removed, after the cpp file patches. I’m hoping that @mick96 can advise so when we do get around to testing it, we can do so with correct config.
Thanks again to everyone for the efforts.