Are you sure about this ? While I haven’t used the builtin energy graphs much (I use my own card for this), I don’t recall any anomalies with reset or decreasing total_increasing values. They seemed to be displayed as expected. If not, then this is a bug in the code displaying it.
Of course this will not show when displaying the raw unprocessed total_increasing data in a simple history line graph, as these don’t display the sum. But that’s not typically the way you would display energy data anyway.
Yes, for anything database related, you only need to change the entity_id as all the database information is tied to the entity_id.
That’s all it’s for.
Yes, in the config entry, you need to delete it in the UI and from yaml if you supplied a unique_id via yaml.
There’s multiple state_classes that work for LTS, it depends on how your sensor behaves. If your sensor itself just outputs kWh then you’d use measurement. If it outputs a total increasing value, then you’d use total_increasing.
Maybe you’re miss understanding how it behaves, maybe we are talking about 2 different things? The state_class drives how HA interprets the data in the energy tab & statistics. It does not alter what is displayed on the source sensor.
Wow!
I just want to thank you so much for your inputs. You are so helpful.
I think I am now ready to switch my sensors in the energy dashboard.
Just to triple check (I do not want to make the same mistake twice ):
I delete the old sensor in the UI and I erase the corresponding lines in sensors.yaml file.
I restart HA
I rename the new sensor’s identity_id to match the old sensor’s identity_id
The energy dashboard is maybe the biggest disappointment I have had with HA by now. I changed the source sensor as I moved from the cloud reading to local reading of the data.
I can not play with the sensor names as they come from different integrations. So I either have to keep not working sensor and unnecessary integration or loose my energy data so far.
To really make the Energy dashboard something more serious this history dependency to sensors need to be addressed.
At least I am moving to Influx + Grafana for my energy monitoring.
Hi. Every One has been sucessfull with that steps off 1st, modifying the energy source entity_id , then restart ha, then putting the old entity_id to the new source kWh sensor ?
For me didnt work, Lost all the data.
I am restoring a backup but what could have gone wrong?
The new source sensor is an utility_meter ( if i have to Change the source sensor in the future again i change the source from the utility meter to not mess again with this… mess )
could that be the reason? I think not because on the energy dashboard the new data appears without editing the energy dashboard…just the old data vanished.
Well, in fact that did manage to work, but was not very smooth.
I changed the entity id of the old source off the energy dashboard, then restart ha. Created an utility meter and on the source off the utility meter put the new energy entity source, then rename the entity id of the utility meter sensor for the same has the old entity, then restart ha.
The energy dashboard started to using the utility meter data but cleared all the previous data.
I made a reboot of the host, meanwhile, but it stayed the same. Wait a bit, had two bars on the dashboard and no old data.
I thought " well going to use my backup , dont want to loose all my data" . Use the backup like this
So i lost the data since the hour that the backup was made until the hour i used that backup … but didnt Lost the changes i made on entity_ids in the same time.
For me is wierd but maybe someone knows what happened.
I used this trick (template sensor) more or less the other way around. I replaced my solar inverter by micro inverters from Enphase. I also expanded my solar array. I liked the idea of conserving the old statistics separate from the new.
So, I removed the integration from the old inverter. Note: removing the integration does not delete the old statistics!
Then I added a template sensor with a unique_id and after a reload of template sensors, I changed the entity_id of the newly created sensor to the entity_id of the old.
template:
- sensor:
name: "Solax BCDxxxxx Total Energy (old)"
unique_id: something_unique_solax_bcd_old
unit_of_measurement: "kWh"
device_class: energy
icon: mdi:solar-power-variant
state: 12345
You cannot add the entity_id here, so you have to change that after the reload, which is possible as long as the old entity is gone and you assigned an unique_id to this new one.