Hi!
I have 2 entities that I use in an apexcharts-card to track the exported electricity and bought electricity.
Entities are:
sensor.grid_import_solar_daily_energy_cost
sensor.grid_export_solar_daily_energy_compensation
But every time I restart the raspberry, it resets the numbers.
What can I do about this? I need to have it 24 hours, then it can reset itself
These come from the huawei inverter, they were hidden, but are connected to energy-sources-table
I also have nordpool added, and everything in the energy dashboard is correct, used electricity and sold electricity with floating nordpool price.
I just want to have those 2 in a card so i donât need to go into the energy dashboard to see what I have sold and bought.
But it does not reset in the energy dashboard, just the card.
Or do you have any better suggestion how to get those 2 entities to a card with history so it doesnt reset.
I also noticed the same (and maybe to add some information to this post). With the new energy dashboard from some releases ago, in the latest release when setting up an energy sensors with a pricing entity linked to calculate costs, HomeAssistant also auto-creates new sensors named âSensor costâ with a price which seems to be like a meter entity that:
Resets once per day
Resets when HA restarts.
I guess second option canât be changed as it might be some tracked cost in the portal, but my question is, any way to change when in the day does the sensor cost resets? It would be more useful to have it reset at midnight, to have the cost sensor direclty show the accumulated costs throughout the day.
I tired searching a bit about these automatically created sensors costs but couldnât find much. Any link to docs or something would be very appreciated to understand them better!
Hi,
These sensors will be created, when you add tarifs to your energy dashboard.
In my Energy Dashboard, I have configured a price for Imported Energy and a price for exported energy.
HomeAssistant does generate these âmonetaryâ sensors automatically:
But it seems, that they reset on reboot of the system.
As you can see, both sensors do have the same âlast_resetâ timestamp (except for some miliseconds)âŠ
Both have been resetted on October 27th (Thursday)
In this case, it seems that the sensors donât use a fixed âresetâ option like daily, weekly, monthly or something else⊠which makes it a bit difficult to use them somewhere in a custom dashboardâŠ
Hereâs the âhistoryâ for the âexported compensationâ
I would really like to use these Sensors - but I would prefer to have them in the same form like other utility meters⊠with âfixedâ reset periods, like daily / weekly / monthly / quarterly / yearly
Atm, the only way I do see is to create custom sensors / templates / utility meters, where I need to set the price again - and then - calculate the prices / revenues by multiplikating the price with the exported / imported energy.
But when HA does already provide this kind of information in some way - I would prefer to use this one, instead of creating these entities manually.
I think I have solved it, at least for my self.
I created a helper (utility meter) Input sensor =one of the generated sensors.
Reset daily and that was it.
Now it has history so I can restart, and the history is still there.
Only problem I had was that I got 17-18 decimals
The way I fixed that was I made a sensor:
totalt_spotpris_idag:
friendly_name: Spotpris skulle ha kostat
value_template: '{{ states("sensor.spot_test_reset_daily") | float | round(2)}}'
unit_of_measurement: "âŹ"
This is with the helper i created, 17-18 decimals
And this is the results with the created sensor:
If someone have some improvements, feel free to share.
yes, writing the data of the existing meter-sensor into a new one can be used as a workaround.
But the downside of this is:
You have two components doing exactly the same⊠(the one without having a âbugâ) - but I prefer if the team could fix the underlying issue rather than working around it
based on what I know, the state_class: total should be able to reset.
I think, the sensor is doing what it is supposed to do⊠it does measure and it does save the âlast resetâ.
Therefore, I donât think that raising an issue will change anythingâŠ
Probably, the only way of getting this is really to create a template / helper âutility meterâ that is inherited from the cost sensors.
Is this really what it is supposed to do? I have no idea, what the idea or the use case for this behavior could be.
What is the idea to display an energy cost since last boot?
the production sensor has state class: total_increasing.
therefore, it does âneverâ reset.
The cost sensor - is another measurement sensor with state class: total.
The âtotalâ state class is a sensor that requires a reset timestamp.
Therefore, - the sensor does behave as it has been designed (corresponding to the state_class)âŠ
The Discussion would be more about, if the desired state_class is the correct one, or if it should also be âtotal_increasingââŠ
I donât know, why the state_class âtotalâ was choosen. Maybe, thereâs a good reason for itâŠ