Conditionally add value to meter sensor

So I’m trying to trace the total cost of charging my EV at home. This would not normally be difficult, but my charger is a mobile one which I bring when going on road-trips for instance. So the chargers reported figure for total energy charged does not reflect energy charged at home. If I go traveling and use the charger elsewhere, when I come back home, there will be a big bump in my figures for home charging due to the increase in the charger’s total energy figure that owes to my off-site charging.

The other figure I could use reports energy charged during latest session. I’ve scoured the web for an answer on how to add that figure onto a counter on condition that the car is at home (which can be verified in various ways). But I can’t figure out how to do it. Can someone point me in the right direction here?

You can use a utility meter with the setting delta_values: true and set up the source sensor to be a trigger-based template sensor whose state is equal to the energy from the last charging session when the car was home.

1 Like

Thanks! It just struck me that the latest session figure, which resets every time charger is reconnected to EV, will only be read by HA when charger is connected to WIFI. Problem solved. Thanks for pointing me to the delta value setting – I never understood how to get that functionality before.

1 Like