You are basically counting Time ( The 2 first Templates )
Then You take brenndaur-tag ( time ) - speicherladung-tag ( time ) * 4.95 ( For some unknown reasons ! )
With this result ( int ) you give it a unit-of messurement: Kwh ( And call this device-class: energy, total iincreasing )
But what you have is still just Time( and int)
So what you see in the “final” graph, is TIME * 4.95 and TIME * 14.84
And for some reason you call this kWh
But where is/comes the spend Wattage into the picture ?
So you mean that your heater is using full throttle 4.95kW vs14.84kW every hour/minute/seconds ?
Don’t you have a sensor which actually shows how much Wattage it currently use ?
Where do you get these 2 numbers from ? the spec. of your Device ?
During home assistant start up the source sensors may not be available before the template sensors and the float(0) filters will render the state values with your specified default of 0.
This will stuff the energy dashboard right up. The availability templates should prevent this occurring.
some value → 0 → some value: add the entire value to the energy used.
some value → unavailable → some value: do nothing.
I don’t see any evidence of this in your history graphs but you may not have shown the times this occurred.
BTW this 3rd party integration may be an easier way to do it:
Look at his first time-sensor, and his sum-up sensor, which he then adds to his energy-dashboard ( not sure if it’s as another source, or as individual device )
He don’t seems to understand that people needs to know what his is doing and why
Seems like he sums up all ( in total-increasing ) and adds to the default-source, at un-given times ( in first pictures days ago, twice ), and his sum keep increasing ( for obvious reasons )
I think these 2 pictures pretty mush says it all, and as you say Tom’s advice didn’t solve your issue, and you haven’t presented anything that looks like a solution, i suggest you remove the “Solved” tag, as others unaware might try to follow your example, not knowing what they are doing, either
Yes, PowerCalc is absolute the best and easiest way
I was just trying to show/explain for OP “what went wrong” , before suggesting anything. , i was very “confused” weather he really understood, and what his purpose was.
Turned out he did really have a power-sensor, not sure why he didn’t use that, and the way he answered turn me off.