An EV charging station where I have a sensor for lifetime energy (used kWh over time, Easee).
A template sensor that shows current electricity price, per hour (Nordpool).
Now I want an entity that gives me cost over time based on this, i.e. the same thing that the Energy panel gives, but just for the charging station.
I have looked into the Utility Meter. The problem I can’t solve there is the fact that the price changes hourly. I don’t know how to take that into account.
I’ve also looked into creating an automation that saves the latest reading to a helper from the charging station, so that I can do some math:
Hmm…I’m doing something wrong, which probably has to do with that I don’t understand this correctly. The sensor itself seems to be correct, but I get very strange values in the Reimann sum integration (and the Utility meter that follows it.
I’ve probably messed up the units, since I don’t understand it correctly.
My source sensor is measuring in kW, which is a difference compared you your example, @PeteRage .
Since you have a spiky load try using the LEFT mode of the Reimann.
TLDR
What happens otherwise is it integrates by “drawing” a line from the first zero to the first non zero. So let’s say to be turned off for 2 hour and when if is off it always reads zero. So since it’s not changing the first zero is two hours ago, Then it turns on and goes to 3. It’ll draw a line from that first zero to the first 3 and calculate the area.
Thank you for the info! Now it works much better, the values are now more in line with what to expect.
One question though, what units should I use? On the sensor (that multiplies SEK per kWh with used kWh) i’ve set SEK as unit_of_measurement, which I think makes sense. Though, the Riemann sum integration and the utility meter gets “SEKh”, which I don’t really understand.
@balloob how cool wouldn’t it be if you could have this build-in all devices(or entities) that has an energy sensor or attribute automatically instead of building this for each entity you want to track the cost of.
You press the entity, or device, and you see the todays cost or the total cost as well as in the energy dashboard of course.
Right now the energy dashboard supports that but only for you total consumption and not per tracked entity.