Hello,
I currently count the ours my electric car is charging, and from that calculate how much money I spend on charging:
I use history_stats:
- platform: history_stats
name: Charge ON eGolf last 30 days
entity_id: switch.wvwzzzauzgw901946_charging
state: 'on'
type: time
end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
duration:
days: 30
And template:
kwh_egolf_30days:
friendly_name: 'Kwh eGolf Last 30 days'
value_template: '{{ ((((states.sensor.charge_on_egolf_last_30_days.state | round (2) ) * ( 2300 | round(2$
unit_of_measurement: "kWh"
nok_egolf_30days:
friendly_name: 'NOK eGolf Last 30 days'
value_template: '{{ ((states.sensor.kwh_egolf_30days.state | round (2) ) * (0.925 | round(2) )) | round(2$
unit_of_measurement: "NOK"
This works fine, however I can charge the car at my workplace, hence it would be nice to get the calculation to only calculate the cost of charging at home. I have entity for device tracker for the car but I dont know how to count the hours based on car being at home and charging. Any input would be greatly apprechiated!
Thanks!