I used a shelly plug s to measure the energy of my small solar power plant. Now I switched to another device and want to use the plug s for other things.
When I remove the plug s from the energy dashboard I am loosing the values in the history - how can I preserve them?
For example: I used my entity “sly-plug-2” (a shelly plug s) for measuring the energy of my pv system. I switched to OpenDTU on saturday.
Now I want to use my shelly plug s to measure for example my washing machine. But if I remove the plug s from the pv part of the energy dashboard, it removes all values in the history as well.
The statistics are bound to the entity name. If remove one entity and add another in its place, yes the statistics for the old entity will not show, but they are still present in the database.
You would either give the new entity the exact same name as the old one or edit the database to associate the old datasets with the new entity name.
An old topic, but I encountered this problem before.
I solved this problem by creating Template Sensors based on the sensors coming from the integrations.
This way I created some sort of abstraction layer above all of my energy and power sensors. If I ever have need to change the physical device or integration, I only have to edit the template sensors to make it read the data from the new sensors.
It’s a lot of work if you have many power/energy sensors like me, but worth the effort to keep your energy statistics working.
Has anyone managed to find a solution yet? I extended my solar system and got a new inverter. My old one cannot be removed because, as you said, it removes statistics data as well.
When I initially configured the energy dashboard I used the cloud-based Growatt-server integration. A couple of months later I implemented local data gathering from the inverter (via grott/mqtt). Thus, I have the following 2 sensors for solar production:
sensor.rooseveltstraat_2_total_lifetime_energy_output → coming from the cloud-based integration, this sensor provides all year data but with many gaps when the integration stopped working
sensor.growatt_all_strings_generated_energy_total → coming from local data capture, but it contains only a few months of history.
If I configure the energy dashboard to use sensor.rooseveltstraat_2_total_lifetime_energy_output I am getting valid year-round statistics, but with several weeks-long gaps.
If I configure the energy dashboard to use sensor.growatt_all_strings_generated_energy_total I have no gaps in the data, but the first few months of the year are missing.
If I configure the energy dashboard to use both sensors, I get double the production.
It would be great if there was a method to tell the HA energy dashboard ‘until date X, use sensor set A. Between date X and Y, use sensor set B. After date Y, use sensor set C’. After all, devices come, devices go, and often there is a transition period.
Is there such a method?
If not, can I do this?
Create a template sensor, let’s say sensor.home_power_production which I make equal to sensor.growatt_all_strings_generated_energy_total for now, but which I can change when the situation changes.
Now, this sensor has no history in the database. So:
Create history in the database, something like if date < 1 jul 2022 then sensor.home_power_production = sensor.rooseveltstraat_2_total_lifetime_energy_output else sensor.home_power_production = sensor.growatt_all_strings_generated_energy_total?
I can probably figure out the template sensor, but I would need a bit of guidance with the database.
I, too, changed a sensor from a blinking LED reading to reading data directly from the HAN port of an energy meter. This has raised the same concerns as this thread and many others. I attempted to rename sensors so that the new energy would save to the same name as the old, but the history appeared to have been erased even then. I believe this issue will require a solution at some point because many people will be getting new hardware with better integration capabilities for home automation and sensors will be changing rapidly. History is, of course, very important in these times.
For the time being, I’ll just leave the old solution in parallel with the new one to keep energy dash running as before.
Same problem. I previously had one Unility Meter to add grid import. Now I switched to a peak/offpeak tariff. I added a new utiity meter which then creates two sub-entiites, one for each tariff. I added both to the dashboard, the old one is obsolete.
Is there a way to tell the energy dashboard to not show the old entry in the overview anymore? Or do I have to cope now for all times with a sensor that always show 0 and thus adds no value to the UI?
Is there a feature maybe to hide a row from the energy dashboard UI if the value is zero? Just want to de-clutter the UI.