@petro - Is there a way to manually delete these sensors as they have not reset to kWh yet. I’d rather not change the names because I have a naming schema I like to follow. I’m currently using MariaDB. I even tried the following steps with no luck. Seems like HA is keeping the data somewhere else?
Seems my energy meters have reset, but the older utility meters are still reporting in Wh (as a unit) but the number is kWh.
1 - Changed my config to not use MariaDB and to use the built in database
2 - Commented out the configuration of both the utility meters and the energy meter sensor.
3 - Restarted HA
4 - Uncommented (enabling) both the utility meters and energy meters.
5 - Restarted HA
When I do this, the old utility meter is still Wh. If I create a utility meter against the same energy meter with a different name, it is kWh.
They are stored in your database, the only way is to wait for the purge, perform the purge yourself, or delete the database. The numbers are correct, the visual units display is incorrect. If you can get over that, just wait it out.
I also did a purge with 0 days to keep. Confirmed the database emptied. Still reporting as Wh and doesn’t seem to be deleting it as it still has the previous period information in there.
I removed the sensors, rebooted HA, purged the DB, rebooted, added the sensors back, rebooted, and now they are there again with the Wh unit and old values.
Something else is creating that other sensor. I’m guessing utility_meter. The integration sensor does not have extra attributes like ‘meter_period’, and ‘last_reset’, etc.
Sorry, I didn’t mean to be confusing. The sensor.network_energy is the integration sensor. I had to create it as a new sensor that to get it to report the right numbers as I don’t think you can reset an energy meter to zero and deleting the database doesn’t help. The utility_meter sensor which is above it, is reporting in Wh because it had a source of sensor.network_energy_meter (which is still reporting in Wh, not kWh which is why I created sensor.network_energy).
Yes, the utility_meter is not the Riemann Sum sensor. It is a utility meter. My issue now is like the energy meter it won’t reset to kWh. I’ve tried everything I know of short of starting over from scratch which I can’t do because I have too many devices.
I’ve…
Run a purge
Delete the database
Switch to a new database entirely
utility_meter.calibrate
but somehow HA still remembers the old values for the utility_meter sensor.network_daily_utility_meter and the old energy meter sensor.network_energy_meter
Here is the original sensor.network_energy_meter after I added unit of measurement to it in the config. It reports kWh now, but the number is too high, yes it is just going up little by little now, so it is working, but how does HA remember the previous state of the sensor when I have done all the purging, deleting, switching…
Ok, I figured it out. It’s a feature, not a bug I. I was able to reuse an existing utility_meter name by first deleting that device out of the ../homeassistant/.storage/core.restore_state file and then restarting HA. Once restarted, recreate the sensor with the same name and it was reset. I had to wait a minute or two for the energy meter to increase in value so the sensor would initialize.
I have a similar issue. I am trying - based on 4 objects (2 plugs and 2 bulbs) to convert the W to kWh and track the consumption. So this is what I constructed.
I first created template sensors to extract the W output for each object, then used the integration to convert the W s to kWh for each.
The output for the first template sensors is:
Can you double check for both the power meters and energy meters that the current state of those devices has the correct unit of measurement? For examples…
Hi,
Thank you for the reply. I managed to fix it. I changed the device class from HA-> Customization - and now - after almost 24h - it started to show the consumption in kWh .
Thank you
Hi @dkovacic , I don’t think you can as there is no more the Customization menu - you need to do it from yaml - either in config, or where you defined the sensor.
I finally solved it. After I defined device class, initially there was no success. After that I added new sensor defintions, new names, same configuration, and those new sensors had correct unit of measurement kWh!