bramstroker / homeassistant-powercalc

Custom component to calculate estimated power consumption of lights and other appliances
MIT License
1.03k stars 264 forks source link

Idea - Measure power using smartplug attributes. Need help from electrician #599

Closed walshtj closed 2 years ago

walshtj commented 2 years ago

Thank you for a fantastic and innovative integration.

I'm putting together a submission of data measurements from a selection of Lidl/Livarno smartbulbs (GU10s, LED strip, ES bulb) and Nanoleaf hexagons.

Since LED bulbs draw such a low current it is recommended to wire several units up at the same time to get a measurable power reading when the bulbs are dimmed low. This means realistically you need a number of bulbs to use the measuring tool. This can be awkward and inconvenient.

I have used a Smartthings plug and I noticed that while the state equals the current wattage (21W in the example below) the attributes also have useful data. This is measuring an LED light strip at full white brightness and the 21W reading (almost) matches the box rating which says 22W max.

image

Assuming that 'current' reading in the screenshot is mA (i.e. 1.57A) then the P = VI ( watts = volts x amperes) still doesn't work as that would be 238 x 1.57 = 373W which is higher than the real value of 21W.

Trying to find more info I looked in deconz and saw that the 'Current' value is actually 'RMS Current'.

image

Note: I'm out of my depth here. I need someone with proper electrical knowledge to help and I am probably wrong.

I looked up RMS Current and found this formula: Current = RMS Current x sqrt(2) = 1.57 x 1.41 = 2.2A
But that making the Power (W) calculation of 524W even farther from the real value. So I am even more lost.

Basically the plug itself is working out the correct wattage using (I'm assuming) the voltage and current readings. I've no idea how they get 21W from the 1570 and 238 measurements

Why bother with this? If someone can explain the formula it means I can run the measure tests on a single bulb/device. I recently ran the measure test on a Lidl GU10 bulb. I had to use a lighting circuit with 6 bulbs to get a measurable reading - the tests took about 5 days to complete (for numerous reasons I won't go into here). It's not practical to essentially have a lighting setup (kitchen in my case) out of action for 5 days while the tests run. I wanted to see could we use the current and voltage attributes to get the power consumption when the light is very dim.

For example here is another screenshot with the same LED strip but set on the lowest possible dim setting.

image

We see that the state is registering as 0W which is not true. I just assume its rounding down. We can see there are still measurements for Voltage and Current. I'm hoping we can work out the 'real' power consumption which I assume its in the 0.1 - 0.4A range

nepozs commented 2 years ago

I looked up RMS Current and found this formula: Current = RMS Current x sqrt(2) = 1.57 x 1.41 = 2.2A

Formula above works only for resistive load, but for LED bulbs and lights it is NOT resistive load at all.

Basically the plug itself is working out the correct wattage using (I'm assuming) the voltage and current readings. I've no idea how they get 21W from the 1570 and 238 measurements

Power isn't calculated from (exposed) voltage and current readings, it is calculated inside measuring system and it is also exposed, so even exposed current value is improper it does not matter (it is different data output from measuring system, processed properly or NOT by smartplug firmware). I think: reported current value can be peak current value (not RMS) so it is useless, but more likely this value is completely wrong.

Simple explanation why power value in W isn't just I*U (for alternating current WITHOUT harmonics) https://en.wikipedia.org/wiki/Electric_power#Alternating_current_without_harmonics but for energy receiver like LED bulb it is really more complicated (because they have impulse power supply build-in so power draw is nonlinear)

We see that the state is registering as 0W which is not true. I just assume its rounding down.

For low values it is just filtered out (it is NOT rounding down, it is cut off, due to noise signal, it done this way just to be sure that exposed power value won't be negative :P), just it is technical limitation of measuring system used inside all smart plugs I've ever seen.

If someone can explain the formula it means I can run the measure tests on a single bulb/device.

It is just impossible - power draw of single bulb in low brightness state (and in standby) is lower than interfering noise signal measured by smart plug.

walshtj commented 2 years ago

Ok fair enough. Thank you for that info.

So looks like I won't be able to run measurements on a single bulb with my current (pardon the pun) smart plug. Are there any devices people would recommend for this task?

bramstroker commented 2 years ago

Thanks for answering @nepozs.

I am using the Shelly Plug S, and I was only experiencing issue with unability to measure 2 lights of 12 on very low power. More people has contributed using this plug and I am enthousiastic about it.

Also see this discussion where some user was doing some research on different smart plugs, but there is not really a conslusion / recommendation yet.

I also see you mention the Nanoleaf. This is a whole different story however as they can have patterns / different colors etc. So it's not easy to lookup values corresponding to a selected color / brightness in HA. A friend of mine has a couple of them and we want to have a look how to integrate this in powercalc somehow. But need to find the time to do that. So you can skip that for now for contribution.

walshtj commented 2 years ago

Thank you for that @bramstroker Regarding the lights measurement data - I'll move that to a different issue to avoid going off topic here.