Hi,
For some reason my template sensor does not reset correctly daily in energy dashboard. Some days ago it started to reset a couple seconds over midnight and the energy board adds yesterdays values to todays values.
Any ideas ?
Hi,
For some reason my template sensor does not reset correctly daily in energy dashboard. Some days ago it started to reset a couple seconds over midnight and the energy board adds yesterdays values to todays values.
Any ideas ?
Your sensor seems to be unavailable very often and when it comes back the value could be added or the value that gets reported after midnight after which the sensor goes unavailable is the problem. Can you look for that “negative” spike at midnight and post the value?
No that’s not it. The energy dashboard specifically ignores unknown
→ some state transitions.
Template (in first message) sensor does not anymore copy that original sensor correcly.
Here is original sensor:
Yeah sorry, I was thinking about Utility Meters there and draw the wrong conclusion.
Have you tried adding this sensor to the energy dashboard config? Can you compare the values and post them from the individual device detail usage graph from the 18. and 19.? And I’m interested in your template code would you mind posting that too?
- sensor:
- name: "Daikin ilmalämpöpumppu energy"
unique_id: daikinap37439_daily_total_energy_consumption
state: >-
{{ states('sensor.daikinap37439_energy_consumption') | float }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
availability: >-
{{ states('sensor.daikinap37439_energy_consumption') | float }}
I don’t anymore remember why choose to use template sensor instead of that original. Maybe I thought that it is easier to change source and keep history with that approach.
If you want that functionality you can use the utility meter and maybe the trend sensor (I dont use that one, so I dont understand how that one works yet) or take availability and last reset out of the code.
But I meant that you add both sensors to the dashboard and compare the summed values and post this graph here.
Made quick check and it seems that both original and template gives same results in the enegy dashboard. So it seems I have to try create one utility meter which resets daily and check if that gives proper results.
You probably don’t need anything extra. You just need to fix your template sensor.
Change the availability template to this:
availability: >
{{ has_value('sensor.daikinap37439_energy_consumption') }}
Remove this:
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
Also why are you using a template sensor to just copy the state of your Daikin energy sensor?
The utility meter does the same thing, it ignores unavailable
→ some state.