Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.35k stars 1.69k forks source link

BlitzWolf BW-SHP13 precise power value? #5137

Closed vogler closed 2 years ago

vogler commented 4 years ago

How is the power value computed? It seems useless/wrong. I connected a 9W LED and it reported 2 and 4 whereas current * voltage = 9.28W seems to be better:

{"current":0.04,"linkquality":68,"power":2,"voltage":232}
{"current":0.04,"linkquality":68,"power":4,"voltage":232}
{"current":0.04,"linkquality":65,"power":2,"voltage":231}
{"current":0.04,"linkquality":65,"power":4,"voltage":231}
{"current":0.04,"linkquality":68,"power":2,"voltage":231}
{"current":0.04,"linkquality":65,"power":4,"voltage":231}
{"current":0.04,"linkquality":63,"power":2,"voltage":232}
{"current":0.04,"linkquality":63,"power":4,"voltage":231}

I assume power is reported by the device like that, but why if it has more precise values?

Debug info

Zigbee2MQTT version: 1.16.1-dev (commit #b1b134f) Adapter hardware: CC2531

vogler commented 4 years ago

Ok, I just compared the values with an old Voltcraft Energy Check 3000. I don't have a good reference, but the values seem more trustworthy:

E27 80 LEDs 9W:

Voltcraft: 2.2W
SHP13:
    power: 2W and 4 W, alternating
    I*V: 9.28W

E27 189leds 20W:

Voltcraft: 12.3W
SHP13:
    power: 16W
    I*V: 30.16W

Ikea Ledare E27 1800lm 22W 2700K:

Voltcraft: 23.7W
SHP13:
    power: 28W
    I*V: 30.03W

So it seems the reported power is closer to the truth than I*V, but why the difference? It would be nice to have more data points to see if this can be improved/calibrated. At least in that range, dividing power by 1.2 seems ok, but maybe it's non-linear.

JJanssen123 commented 4 years ago

Since this is alternating current, you cannot use I*V: https://en.wikipedia.org/wiki/Electric_power#Alternating_current

Seems the measurement is not very precise at low power.

vogler commented 4 years ago

Since this is alternating current, you cannot use I*V: https://en.wikipedia.org/wiki/Electric_power#Alternating_current

I thought that's fine for resistive circuits. These are the RMS values, no? So you're saying the difference comes from some capacitance in the LED circuit?

JJanssen123 commented 4 years ago

T.b.h. i never opened up a led bulb but i can imagine there's some capacitive and inductive stuff in the ac/dc converter.

I always thought a measuring device should return P exactly because you cannot always know it's kind of load. So you don't have to know wether I*V is applicable.

stefangries commented 3 years ago

Ok, I just compared the values with an old Voltcraft Energy Check 3000. I don't have a good reference, but the values seem more trustworthy:

E27 80 LEDs 9W:

Voltcraft: 2.2W
SHP13:
  power: 2W and 4 W, alternating
  I*V: 9.28W

E27 189leds 20W:

Voltcraft: 12.3W
SHP13:
  power: 16W
  I*V: 30.16W

Ikea Ledare E27 1800lm 22W 2700K:

Voltcraft: 23.7W
SHP13:
  power: 28W
  I*V: 30.03W

So it seems the reported power is closer to the truth than I*V, but why the difference? It would be nice to have more data points to see if this can be improved/calibrated. At least in that range, dividing power by 1.2 seems ok, but maybe it's non-linear.

Mine reports values, that are too high as well. For a 60W bulb it reports 70W, so dividing by 1.2 is quite close to the truth for me as well.

Have you found out, if this behavior is linear for higher power consumptions? Can this divisor be added to the device, or do I have to add it in home assistant?

vogler commented 3 years ago

I shelved it because I wasn't happy with it spamming messages every 10s. Seems like it has now changed to 60s. (Would be nice if it had configurable polling intervals for the on/off state. Otherwise it's either annoying or imprecise. But that's another issue.)

I just tried a little oven:

Voltcraft: 575W
SHP13:
    power: 672W
    I*V: 676W

Assuming it's more precise at higher power, 1.17 would be a good divisor.

markheloking commented 3 years ago

When comparing measurements, please keep the power factor in mind. Have you got a seperate measurement device on hand that can also measure power factor? It's entirely possible the SHP13 only reports true power and not apparent power leading to the differences in measurements/calculations. Also keep in mind it's AC, so you'll have to RMS for meaningfull calculations.

More about different types of power here.

Only an incandescent bulb (out of all typical appliances you may have laying about) that just heats a wire will be a true enough "pure resistive load" that you'll get a power factor of 1.0 (aka all power is true power). When you're seeing stuff like LED lights and other types of electronics/loads, all bets are off, and usually your typical power factor is more around 0.9 or 0.8. Bad electronics can be seen to be near 0.5. Even an oven can have a powerfactor of <1.0 depending on the topology of the internal electronics.

You'd definitely expect there to be some margin of error on the SHP13 device in terms of measurement accuracy, but it's wrong to assume this will be >15%. At that point we should first look into measuring it against some measurement devices that keep power factor in mind in order to eliminate power factor from the equation before we start hardcoding offsets in order to make a certain scenario/user/single device calibrated/happy.

stefangries commented 3 years ago

Unfortunately, I have little expertise when it comes to electrical engineering.

What I have done is measure a traditional (non-LED) 60W bulb with the SHP13. The result varied between 68W and 70W.

I then used my multimeter to determine voltage and current. There, the product came out to 59W.

markheloking commented 3 years ago

What setting did you put your multimeter to? What kind of bulb is it? Incandescent or CFL? (only incandescent bulbs will have power factor of 1.0)

vogler commented 3 years ago

Have you got a seperate measurement device on hand that can also measure power factor?

I have a PZEM-004T laying around, but haven't used it yet.

It's entirely possible the SHP13 only reports true power and not apparent power leading to the differences in measurements/calculations.

But then it should report less, not more. As I see it, the only assumptions that would explain the numbers are: 1. SHP13 reports apparent power & 2. Voltcraft reports true power & 3. the circuit is not purely resistive.

Conjunct 3 should be false for @stefangries' 60W bulb, and also my oven (it's very old, has a wind-up wheel to turn it on).

stefangries commented 3 years ago

What setting did you put your multimeter to? What kind of bulb is it? Incandescent or CFL? (only incandescent bulbs will have power factor of 1.0)

A traditional incandescent bulb.

With the multimeter I first measured the voltage of the socket. Then I connected the multimeter in series with the light bulb to measure the current. And then I multiplied the results.

markheloking commented 3 years ago

Have you got a seperate measurement device on hand that can also measure power factor?

I have a PZEM-004T laying around, but haven't used it yet.

It's entirely possible the SHP13 only reports true power and not apparent power leading to the differences in measurements/calculations.

But then it should report less, not more. As I see it, the only assumptions that would explain the numbers are: 1. SHP13 reports apparent power & 2. Voltcraft reports true power & 3. the circuit is not purely resistive.

Conjunct 3 should be false for @stefangries' 60W bulb, and also my oven (it's very old, has a wind-up wheel to turn it on).

Hmm this would indeed indicate an error of about 20% which would be huge. I'm wondering whether it's a stable offset, or whether every device has it's own offset/error. Using a single calibration value for all devices seems like a bad idea until we figure out some average offset from multiple devices.

stefangries commented 3 years ago

I have ordered 5 more that are on their way to me. It takes a little time from China, but after arrival I can say if the offset is similar everywhere between the devices.

vogler commented 3 years ago

Factor/divisor, not offset (addition). By device you mean different SHP13s? We have data points [(@stefangries, 60W), (@vogler, 575W)]. Could be a coincidence that our factors match, but my guess is that it's consistent.

markheloking commented 3 years ago

I have ordered 5 more that are on their way to me. It takes a little time from China, but after arrival I can say if the offset is similar everywhere between the devices.

This should allow for some back-of-napkin conclusions until better info is known. Maybe we should encourage people to check theirs and keep posting measurement info here in the future so that we can keep track of when/if this changes in the future (manufacturers are known to change devices like this without updating model numbers).

Factor/divisor, not offset (addition). By device you mean different SHP13s? We have data points [(@stefangries, 60W), (@vogler, 575W)]. Could be a coincidence that our factors match, but my guess is that it's consistent.

I was indeed talking about lineair correction calibration, so both offset and factor. In this instance I used the wrong word as I was talking about that factor of 1.2x.

vogler commented 3 years ago

I was talking about that factor of 1.2x.

-pedantic: That would be the divisor, the factor would be 1/1.2 🙈 I assumed the offset to be 0, but yes, it could be up to 4/1.2-2.2 = 1.13W for my first example.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

vogler commented 3 years ago

bump

Maybe we should encourage people to check theirs and keep posting measurement info here in the future so that we can keep track of when/if this changes in the future

Where/how? Release notes, on the device page?

JJanssen123 commented 3 years ago

I have recently tested two new BW SHP13's and compared with a Xiaomi plug ZNCZ02LM. I tested with two halogen lamps so there should be no interfering inductive or capacative load. Lamps were on about 10 minutes and there was no change in measured power. I have no others means of measuring power, so fwiw:

            | Xiaomi plug   | BW_SHP13-1        | BW_SHP13-2
Lamp 18 W   | 18.7 W        | 20 W              | 22 W
Lamp 53 W   | 55.67 W       | 62 W              | 62 W

It seems the BW SHP13 is indeed somewhat high in power measurement. But I don't think Z2M should correct this in any way. Maybe some warning on the device page indeed. Or in the reviews on AliExpress ;)

vogler commented 3 years ago

But I don't think Z2M should correct this in any way. Maybe some warning on the device page indeed. Or in the reviews on AliExpress ;)

Why not? Just mention it on the device page and link this issue. Fixing it in z2m takes a couple of characters (e.g. x/1.17) whereas it may become way more complicated to correct after (e.g. my mqtt values are stored in influxdb, used in node-red, on Android etc.). In general for n different consumers, you have to adjust this value n times (or sub|fix|pub the value on a different topic).

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

vogler commented 3 years ago

unstale

frank-f commented 3 years ago

I got an SHP13 as well. I also have a pretty precise power meter. I measured the SHP13 with a plain old lightbulb connected to it, so power measurement should be as good as it can get. Power meter says 102 W, Zigbee2mqtt reports 115 W. @Koenkk I'ld like to be able to set an individual calibration factor for voltage, power and current, because they're all a bit off, but power really needs it the most. Can you maybe consider that for some future version? @vogler My correction factor (or divider in your terminology) would be different than yours, so I don't think hardcoding 1.17 would make anyone happier or unhappier than they already are.

vogler commented 3 years ago

@vogler My correction factor (or divider in your terminology) would be different than yours, so I don't think hardcoding 1.17 would make anyone happier or unhappier than they already are.

1.13 is still much closer to 1.17 than 1. Of course there should be options to adjust it, but also a reasonably precise default (e.g. avg of values reported here).

KiPiCoOl commented 3 years ago

Hi,

My participation :

SHP13 | 1st Wattmeter | 2nd Wattmeter |
329W  |      290W     |       286W    |
662W  |      590W     |       581W    |
github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

vogler commented 3 years ago

unstale

Dark-Noir commented 3 years ago

Is it not possible to add a device type specific configuration to the configuration.yaml for calibrating this things like with Tasmota https://tasmota.github.io/docs/Power-Monitoring-Calibration/ ? I mean as a feature ^^

aw-jansen commented 3 years ago

Second this ^^ a calibrating feature that would enable you to add, substract and multiply the values would be awesome.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

vogler commented 3 years ago

unstale. This bot is annoying. @Koenkk Is there something similar implemented for another device or do you have some advice how to go at it?

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

frank-f commented 3 years ago

unstale

stefangries commented 3 years ago

I tried the newer BW-SHP15 (external converter here) works much more precisely for me. Nevertheless, there should be a configurable multiplier for the BW-SHP13.

fluffymadness commented 3 years ago

I second this. Since there is energy monitoring in home assistant now it would be nice to get a bit more accurate values. Would be interesting how accurate zigbee plugs from other vendors are. If the deviation is also that huge. Maybe some filter function like esphome has would be an interesting addition https://frenck.dev/calibrating-an-esphome-flashed-power-plug/

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

itguy013 commented 3 years ago

unstale

Jopand commented 3 years ago

Unstale

AbeltjeNL commented 3 years ago

Unstale

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

adorobis commented 2 years ago

unstale

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

adorobis commented 2 years ago

unstale+

iz3man commented 2 years ago

EDIT: Please ignore my post. The one I write about is a Girier - JR-PM01. ;) Will do testing with SHP-13 as well. I just got too many devices in my home ;)

Seems I'm not the only one. I never verified the readings until today. There is a power supply connected to the socket which pulls 2.200W from the socket - as stated by the Blitzwolf SHP-13. But the connected battery managment device only sees 1.800W. As well as a clamp current meter, measurng the AC and DC side of the power supply. Could have to do with the PS's power factor, and I will do measurement with a pure ohm' load to verify. But if this is not the case, then I'd say 22% error is not acceptable.

Sungtroll commented 2 years ago

I did comparition test of my Blitzwolf devices after i noticed the Voltage reading was very far off on some of devices. Here tested with no-load, 200 Watt load, 400 Watt Load and 800 Watt load, a heating oven so power factor is 1. I tested the real supply voltage with Fluke IV 89 True RMS multimeter and then the Ampere from the fluke to calculate the real power watt. To bad Blitzwolf does not have a calibration tool, because Blitzwolf power plugs power measurements are not accurate.

image

image

Koenkk commented 2 years ago

@Sungtroll can you check if it is just an offset? (are we good if a user can set an option to always take the voltage/power/current - 5)?

stefangries commented 2 years ago

@Sungtroll can you check if it is just an offset? (are we good if a user can set an option to always take the voltage/power/current - 5)?

Even if I was not addressed, I can tell you that a multiplier would be better than a summand. A correct multiplier for the power value of the SHP13 is about 0.85.

adorobis commented 2 years ago

A correct multiplier for the power value of the SHP13 is about 0.85.

Same observation here.

Dark-Noir commented 2 years ago

Is it not possible to add a device type specific configuration to the configuration.yaml for calibrating this things like with Tasmota https://tasmota.github.io/docs/Power-Monitoring-Calibration/ ? I mean as a feature ^^

Why not implementing this, instead of a hard multiplier. This should get a much better and precise reading for Current, Voltage and Power.

Sungtroll commented 2 years ago

@Sungtroll can you check if it is just an offset? (are we good if a user can set an option to always take the voltage/power/current - 5)?

I included the voltage differense and i can see it makes no sense to add or substract 5v, 20 watt or 50 mA. The correction factor is different on different devices but correction factor is the right way to do it. My house voltage is slightly different every second so i will use a 12V to 230V pure sine inverter to measure again to get it 100% correct. Tasmota uses power Watt dividing with Volt to calculate mA, but calculating the mA from devices mA with mA correction factor will do the same and calculating Watt from corrected Volt and corrected Ampere will also work. So divide your device measurements with the correction factors and remember the correction factor is different for Volt, Ampere, and Watt so 0.85 or .95 for everything wil not work. My devices varies between 0.85 to 1 as seen in the table

image