I’ve been using the myenergi grid import sensor combined with a utility meter (day/night rates) for a couple of years with no issues, but yesterday I migrated to a new deployment of HA in kubernetes and clearly messed up my config somewhere, as this morning the energy dashboard is showing 10 KW/h returned from midnight to 1am.
The source import sensor reset to 0 at midnight as expected, but the utility meter night sensor went down from 0 to -20, then started climbing back up. The math does work out but it shouldn’t have gone down to -20 when the grid import reset.
I do have “periodically resets” enabled in the utility meter helper config.
Am I missing something somewhere ? It was working on my old instance but for some reason the utility meter edit panel is not the same as the creation one, so I can’t compare all the settings.
I’ve tried re-creating it and made sure net metering is off, but now night won’t even count anything at all, the energy dashboard just says the meter entity is negative and invalid and won’t display it at all.
I really don’t get why the energy meter goes negative, doesn’t make any sense
For anyone finding this in the future, I think I figured it out. I had to delete the meter, then go to the developer tools and delete the entities manually then re-create it with : net metering off, periodically reset on (net metering cannot be changed after creation).
I suspect the entities were negative and conserved accross re-creations, so it kept erroring but once I deleted them it started fresh
Did you set unique_id for your utility meter? If you didn’t have this set you may have been looking at the wrong entity after you made changes to your sensor.
I then removed the meter and disabled net metering to check that maybe this is an issue but then the meter was wrong so it’s now disabled.
(When a meter is remove and add with the same name the data is preserved.)
How is it possible that it had negative value if the source couldn’t have and didn’t have negative value.
The only source of power usage I have is my inverter that shows current load power (at a given moment). How can I measure my power usage in HA? I’d like to know my hourly and daily consumption.
Consumption would be how much energy you’ve consumed, rather than how quickly you consume it (power is the rate of energy consumption).
If your sensor only reports power, then you need to calculate the integral of that entity to get energy. This is done with the Riemann Sum integration.
The analogy would be if you are trying to track how far your car has traveled. Right now you are looking at the speedometer, and that won’t help you unless you perform some calculations that consider the time duration you spend at any given speed. If you perform a Riemann sum integral on the speedometer data you will end up with the odometer value. Likewise, if you perform a Riemann sum integral on the power data, you will get energy.
Once you have the energy entity working, you can feed that into a utility meter entity, and then feed that into your energy dashboard.
When you set up the Riemann sum, make sure to use left as the calculation method.
Thanks’ for the comment. I’m new to HA. The average over load power works okay to estimate the average load from the last hour.
I tried Integral and sure it works as a meter but I still don’t know how am I supposed to get average energy usage over a period of time (say, last hour or last 24hrs).
I added utility meter over that integral but looking at how it looks the results (incremental over a period of time) I’m not sure the average would be accurate (because it drops to 0 and keeps incrementing).
Getting consumption averages and totals over a period of time seem hard in HA or not obvious…
The utility meter entity you created shouldn’t drop to zero unless you configured a meter reset cycle, or if you enabled net consumption and your power meter can go negative (and therefore your Riemann sum entity can decrease instead of only increase).
I’m not quite sure what your end goal is. The energy dashboard (demo here) shows how much energy you’ve used hourly, daily, weekly, etc. If you want to use the energy dashboard you just need to add the utility meter you’ve already created to the configuration for the grid consumption (settings → dashboards → energy, then “add consumption” under the electricity grid section).
If that doesn’t get what you want, I can help you set up some calculations (either using the statistics integration or a template sensor) but you’ll have to be specific about what exactly you want (Power vs energy, over what time period you want to calculate the value, etc.)