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…
All, sorry to jump in here in this ongoing conversation.
After spending several days to build cool dashboards on InfluxDB and Grafana and fighting to understand why they look sometimes very good and sometimes weird, I did some troubleshooting on the data and saw the issue was coming from the problem described here (reset of the energy costs after HA restart). Unfortunately I do not see regular reset once a day as mentioned above. Is there a way to configure the regular reset at 00:00 as example?
For the second issue (reset when HA restarts) I will try to apply the sensor workaround as described as well here. as I am a beginner in HA hope to make it working before a new release of HA solve this reset issue .
I saw the same issue. They reset on restart but not daily or anything else so they are kind of pointless actually.
What I did now is create utility meter sensors for daily/monthly/yearly cycles for the desired generated sensors.
So for example I have sensor.e3dc_grid_import_energy and sensor.e3dc_grid_import_energy_cost and I just created utility_meter sensors for them like:
I actually did this for almost all sensors related to energy, cost or compensation.
This makes it much easier to export to prometheus (VictoriaMetrics) and use them in Grafana for Daily/Monthly/Yearly graphs.
I just did this today, hope it works as I want them to.