Know this is an old thread but has anyone figured out how to add car and get the costs
Here I use the Export in the energy dashboard, and I get the price from the NordPool plugin.
I get the total consumption from an HA Glow (donāt got an smart meter with P1/HAN port) and for the car, I have an LK PowerTag on the relay for the charger.
This way works quite well for me, as I pay flat-rate for the power Iām using at home for my car.
So I get something like this
yes, the ābasicā measurement is pretty simple - since EV charging is either grid import - or it comes from your solar power.
This is how I have it done atm:
EV Charging - mostly from Solar productionā¦
EV Charger listed in single devices:
But: I think, it would be great if the Car could be added as a specific device - like a house battery.
The major difference here is, that you can load your house-battery - and later unload itā¦
That will be shown different in the chargeā¦
It might be a bit difficult to implement it in the chart itself, because somehow the system would require to know, if the energy came from your solar - or from the grid.
If it does not know this, it would show the consumption from your solar (or the grid import) + the charging itself (added on top)
I guess, that could be hard to differenciate and will cause major complains from the community - even more, if the charging will be done by SOLAR + IMPORT
BUT:
having a dedicated information in this area, as already requested somewhere (I donāt remember, if it was in this topic, or another FR)
That would be niceā¦ at least, it could be shown how much energy you have put in your car - but it could probably not show from what source it wasā¦
Is there anything we can do to get this properly done in the Energy Dashboard? I tried a WTH and another tried this but it doesnāt seem to get any traction. My feeling is that with a little development on the HA side this could be a great feature, especially in managing the optimum time for charging and getting a grip on your costs. Any thoughts?
You can also create a dummy value with a template sensor:
- template:
- sensor:
- name: "Battery unload dummy"
unique_id: battery_unload_dummy
unit_of_measurement: "kWh"
device_class: energy
state_class: total
state: "{{0.0|float}}"
hmā¦ I had another thought about this topicā¦
I think, there are different approaches and cases that should be considered when discussing the integration of an EV into the energy dashboard, because there are some edge-cases that can happen compared to a house-batteryā¦
Housebattery:
most probably a single device (or two) bind to the household that can be charged - and discharged.
EV:
- Amount of ānā Cars possible.
- Battery charging ā by solar or grid import
- Battery discharging ā by driving, not used for HouseConsumption
- Battery discharging ā by HouseConsumption if āvehicle to gridā will be available (depending on your location, etc.)
- Measurements can come from the EV or from the Charging-Station or from a Shellyā¦
- EV can be charged everywhere else ( ā can be difficult to measure in combination with vehicle to grid, for example)
Also, in addition to that:
Since charging your EV is already part of your house consumption (total) it is already included within the graph.
The only way to get āproperā information is to add the device (charging station) as single deviceā¦
But then, it will not be possible to configure when vehicle to grid" will be availableā¦
I think, since there are so many different options this is something that wonāt be possible as a general
implementationā¦ The solution with powercalc or whatever might work in some (maybe most) cases as of todayā¦ but I really see a high risk of implementing such things today - when there are certain things that are yet unknownā¦ and might be change drastically in the next 2 years maybe?`
Another vote. Would be nice to have it separately on the energy dashboard.
Another consideration with electric cars: Has anyone found a good way to only report charging (ie energy consumption) when the car is āhomeā? I havenāt figured out how to accomplish this yet: When i charge my car somewhere other than at home, that energy usage still shows up on the Energy Dashboard, which incorrectly implies I consumed that energy from my home, rather than elsewhere (public charger, work charger, friends house, etc).
Perhaps thereās a way to use a Helper or Template to say something to the effect of āif vehicleLocation !=āhomeā ignore energy usageā. Or, even better, put that usage in a different bucket, where one could track both charging usage at home, vs āotherā.
Not what you asked for but I use a shelly 3em. This way also the charging losses are monitored. My car only shows āpower addedāā¦
It seems you use the car integration to measure this. If you use a separate meter mounted before your charging point (i used one like this: Energy meter Conrad and connected the pulse line to my Youless P1 sensor. Now I can see how much I use for the car and substract is from my total usage to see what my home energy usage will be. The result looks like this:
Hi, yes thatās correct, Iām using the car integration. So the challenge is, the integration reports the charge activity regardless of the carsā physical location. Any tricks to scope in some logic to that, or is that just a limitation at the moment?
That would be possible by constructing some kind of template sensor that gets updated when your car reports charging at the home location. As far as I know, HA does not offer service calls to update template sensor values and attributes. That is why I use the variable custom integration.
Here is an example of the definition of such a variable sensor (to be added to configuration.yaml)
var:
car_power_consumption:
unique_id: a8509780-d26c-45ca-971c-ab0b3fabf501
friendly_name: Car Power Consumption
unit_of_measurement: 'kWh'
icon: mdi:car-electric
restore: true
initial_value: 0
attributes:
version: "1.0"
cycle_active: false # cycle still active true/false
cycle_started: 01-01-2022 00:00 # date-time this cycle started
cycle_charged: 0 # amount charged this cycle
cycle_start_value: 0 # used to calculate more precise
cycle_start_capacity: 0 # battery capacity at start of cycle
battery_total_capacity: 40 # max battery capacity in kWh (set this according to your car)
I made an example automation that can be used to make this roll as shown below. As I donāt know your cars sensors, it is based on the assumption that you have these sensors available (replace them with yours). You can then use that as an imput sensor for your energy dashboard as described in this topic.
-
binary_sensor.mycar_chargestate
(āonā when the car is charging) -
sensor.mycar_battery
(percentage battery full) -
tracker.mycar
(car location and returns āhomeā when car is at home )
example automation:
- id: '1acf296d-5024-46c4-9e02-71b2208f04f5'
alias: car_power_update
mode: restart
trigger:
- platform: time_pattern
minutes: /1 # update once a minute when charging
- platform: state
entity_id: binary_sensor.mycar_chargestate
id: charging
# Only actions when neccessary
condition:
- condition: template
value_template: >-
{{ states("tracker.mycar") == "home" or
state_attr("var.car_power_consumption","cycle_active") == true }}
action:
- if:
# start or stop charing cycle
- condition: trigger
id: charging
then:
- if:
# New charge cycle
- condition: template
value_template: >-
{{ states("binary_sensor.mycar_chargestate") == "on" and
state_attr("var.car_power_consumption","cycle_active") == false }}
then:
- service: var.set
data:
entity_id: var.car_power_consumption
attributes:
cycle_active: true
cycle_started: >-
{{ now() }}
cycle_start_value: >-
{{ states("var.car_power_consumption") | int(0) }}
cycle_charged: 0
cycle_start_capacity: >-
{{ states("sensor.mycar_battery") | int(0) }}
else:
# Stop charge cycle
- service: var.set
data:
entity_id: var.car_power_consumption
attributes:
cycle_active: false
# update power usage value
- condition: template
value_template: >-
{{ state_attr("var.car_power_consumption","cycle_active") == true }}
- service: var.set
data:
entity_id: var.car_power_consumption
value: >-
{% set charged = states("sensor.mycar_battery") |float(0) -
state_attr("var.car_power_consumption","cycle_start_capacity") |float(0) *
(state_attr("var.car_power_consumption","battery_total_capacity") |float(0) /100)
%}
{{ state_attr("var.car_power_consumption","cycle_start_value") |float(0) + charged }}
Another bump, very interesting since I have added my ev also to ha. Can we get this to the dev attention?
Bumpy Bump!
Iād really be interested in this as well.
Bumpidibump ā¦ it is 2023, so everyone is having PV and a battery and an EV
Arenāt you using evcc to control your wallbox? I added some MQTT sensors to get detailed charging information back from evcc:
mqtt:
sensor:
- name: Vehicle Charge Power
icon: mdi:ev-station
state_topic: "evcc/loadpoints/1/chargePower"
unit_of_measurement: W
Doing a lil bit of archeology by bringing this up but iād really appreciate if this feature was implemented with EV specific calculations.
Meanwhile, the workaround to put the car in the battery section seems to work fine.
About EV considerations, if you have a smart charging station at home, the work is easier as you get all the entities needed. I have a Wallbox Pulsar (integrated with the wallbox integration) which gives me added and discharged energy.
So with such a charging station, integrating as a battery system can be reliable, even if you vehicle has V2L, V2H or V2G capability.
nice to see I am not the only one with that wish! My EV charging is destroying the whole purpose of that Energy dashboard. All bars look really small in comparisson to when the EV was plugged in
+1
The energy dashboard works lovely with the variable energy prices. But charging an EV during off-peaks tends to skew the impact on costs. Can no longer say ā50% of total kW goes to car? Nice, then car is 50% of the billā.
I am currently āabusingā gas input just for my EV, it worksā¦ but it makes the totals kind of useless.
Please add the option to add a cost / price input to individual devices!
As I donāt have gas, I put the EV consumption into it. This give me one extra circle with that specific consumption and follow the price.
itās not perfect of course. I would like to have one extra customizable circle in HA where we can adapt on the need.
Those kwh of the EV are also in the count on electric part. Nothing change there but I just removed the EV part from the devices list.