I use an Emporia charger that provides a sensor "sensor.evcharger_energy_this_month" that can be used to calculate how much money you have spent on electricity in the calendar month.
If you have a different charger, like a Chargepoint for example, the metrics they provide will be different.
Please send a pull request to this repo if you have suggestions on how to incorporate data from other chargers.
To get an accurate price / per kilowatt hour, instead of using the utility company's stated price per kWh, I prefer to include all the taxes, riders, and fees they lump into your bill. To do that, divide (total_bill_amount) / (net_supplied_energy - net_supplied_customer_to_grid) since I have solar panels as well. Our utility quotes $0.13/kWh on the rate schedule, but actual price is $0.154/kWh with fees and riders included.
- Log into your Home Assistant dashboard
- Click Settings -> Devices & services
- On the top navigation bar, click Helpers
- Click Create Helper
- Click Template -> Template sensor
- Name it something like "evcharger_cost_this_month" or similar
- Paste and customize these values:
{% set energy_this_month = states('sensor.evcharger_energy_this_month') | float %}
{{ ((energy_this_month) * 0.1544904) | round(2, default=2) }}