Hi!
I’m having trouble getting my energy meter to work properly. It’s a PZEM-004 energy meter via Modbus. All the sensor values read from device show correct values. The problem is the utility meter which, instead of incrementing its value by 1kWh on each change of counter (it has no decimal part), increments by an amount equal to the meter’s actual value (7449kWh). Did I miss something?
Does the value of the total actually increase when new values are sent? I get the feeling that because the new value isn’t higher and the state class is total_increasing, it registers every double as a counter reset. I think utility meter expects only actual increases. But i.m.h.o. it should not behave as it does.
If the total value never actually resets, setting the state class to total might fix it I guess.
If the total is decreasing (because energy is decreasing (due to energy production) then this is expected behaviour and the state class should then be changed tot total.
I just noticed some zero value spikes on the energy counter, possibly due to communication problems. Maybe that would be the cause of the error. How can this situation be handled? My counter keeps going up, I have no energy production. It is expected that it will reset itself after 9999 kWh.
Thank you.
I have modified according to your recommendations, but it seems to behave the same. Here are the results. Also increased the precision of the energy_counter register to observe smaller changes.
Values after zeroing all entities at the start of the period:
I’m having a similar problem.
I set it up to monitor a hot water recirc pump.
That pump is drawing ~25W when on.
So at the end of 4 hours I expect the utility meter to read 100Wh
It’s reporting 37W
I also tried to monitor my coffee maker. it’s drawing 1000W when heating
I was expecting 1000Wh
At the end of 1 hour the utility meter reported 87,000W
I’ll scan through the posts above but this seems like a simple issue of integration over time.
The utility meter does not integrate power to energy, it just counts up the total of an energy sensor for a defined cycle (e.g. energy last hour). If you don’t have an energy sensor then you need to integrate your power to energy by using the Riemann sum helper:
Pay particular attention to the method, nine times out of ten left will reduce approximation errors the best but it is not the default setting.
Once you have that always increasing energy sensor (it never resets) you can create energy per hour/day/week/etc… sensors with the utility meter.
Thanks for the explanation - now I question the “utility” of the Utility Meter
Watts is an instantaneous measurement - the power draw of a particular load at the point in time.
Watt-hours is the power (energy) consumption.
What is the utility of “counting” multiple instantaneous load measurements?
It’s not averaging over time. It’s not determining the energy consumption. It doesn’t appear to report peak load over the defined period.
It’s definitely summing, although now I’m stumped as to what the information is supposed to illustrate.
Also, how many samples is it summing?
I had it set to “daily”, how many cycles is that? Does it take a reading every minute? 5 minutes? 5 seconds?
The integration helper converts e.g. W to Wh or kW to kWh. You need that if you only have W or kW, because there’s no point in adding those. Compare it to speed versus distance traveled. Adding speeds tells you nothing. Integrating speed to get distance traveled is useful. Integrating is not mere adding like the utility meter does. Integrating is calculating a surface area in a graph.
The utility meter helps creating an ever increasing total for entities that reset when you don’t want them to, or helps you get a daily, weekly, monthly value for totals that are ever increasing. So if the integral helper gives you a total kWh sensor (ever increasing), the utility meter can give you a daily or monthly kWh sensor.
Another example, my wall charger gives a sensor for kWh added per charge. It resets for each charge cycle. In order to get an ever increasing total, you can also use an utility meter without a cycle. It will add all charge cycles for you. So utility meter is doing a summation of increases over a period of time.
Read what I wrote again. That is not what the utility meter does.
It takes an ever increasing energy total sensor and enables you to extract totals for any period you want.
An ever increasing energy total is not much use for calculating your monthly bill. The utility meter will give you monthly energy totals from the ever increasing total. Or daily totals if you want to know how much energy you used today compared to yesterday.
I think i identified the problem and i think the Utility Meter docs need to be more specific.
The plug im using has several power related entities
Current in A
Voltage in V
Power in W
Power Delivered in kWh
I was originally using the Power entity in W thinking the Utility Meter would use the time stamp of each sample and intergrate the instantaneous power measurement at the sample time and the time elapsed to calculate a running Wh total.
I was thinking the Power Delivered in kWh was already in kWh and appeared to be a running total with an infinite time horizon, it just keeps increasing. So using that as the source integrated over time would be double integrating the time component. Essentially returning kWhh. And there is no way to reset that entity value so the starting number would include power consumed in the past.
Now, if i understand correctly after playing with the utility meter integrating the kWh entity, it appears my assumptions were in correct.
It appears that the Utility Meter is taking the samples as differential consumption reported since the last sample. That was not readily apparrent.
The docs should be very specific and direct the user to use a kWh entity not the instantaneous W entity.
"Input sensor
The sensor entity providing utility readings (energy, water, gas, heating)."
There should be a caveat immediately under that.
Something to the effect:
“Note: The Utility Meter tracks total consumption over a period and requires an entity value with an integral time component. For electricity use kWh, Wh, etc. Do not use an enity reporting instantaneous power in W.”
Similar break outs for other utilities should be specified.