Calculate Kwh from charging #697
Replies: 8 comments 5 replies
-
Not 100% accurately no. You can work out the approximate battery capacity by dividing the battery size (77.4kWh) by 100 and multiplying it by the state of charge. Using an automation you can store the state of charge when the car begins charging and the same when it ends and then calculate the difference in the time period the car was charging to give a rough kWh session value. The car does not expose its state of charge as a power value so there will be discrepancies in this calculation. It also depends on Home Assistant knowing the state of the car at the moment you capture the values (for example when starting and ending the charging session). This might be easier if you're using Home Assistant to control the charging session but not so much if you aren't. |
Beta Was this translation helpful? Give feedback.
-
I had a kWh meter installed between my grid connection and my charging unit at home. The kWh meter reports current charging power in Watt, but also total energy used for charging in kWh. If I wanted to know the total energy in kWh added to the car in one session, I would perhaps use a state change of the charger from unplugged to plugged in, and use that to trigger an automation that records the (starting) meter value of the kWh meter. Then, I'd use a state change from plugged in to unplugged, to trigger another automation that records the (ending) meter value of the kWh meter. The difference between these two is the total energy added in that once charging session between being plugged in and being unplugged. This is the kWh meter I have: https://www.homewizard.com/shop/wi-fi-kwh-meter-3-phase/ since I have a 3 phase charging unit, but there is also a single phase version https://www.homewizard.com/shop/wi-fi-kwh-meter-1-phase/ . They connect to my home network via WiFi and Home Assistant can communicate with them directly via a local API, no cloud involved. These meters may be specific to my market (The Netherlands), but I'm sure similar products exist for other markets. My charging unit is a MyEnergy Zappi, which also has a custom integration for Home Assistant, but that involves their cloud service. It can also report energy. However, I've noticed that it consistently reports more power and more energy than the certified kWh meters mentioned above. So I'd perhaps only use it to get signals for the plug being connected and disconnected. |
Beta Was this translation helpful? Give feedback.
-
I was looking into generating some charging stats ... as my Wallbox at home already delivers its data to HA, most of my charge operations are already accounted. For the ~10% of external charges, it would be nice to get some (albeit approximate) values from the car ... too bad we get values for recuperation, but no "last charge" value ... getting some value from the delta of battery level when being plugged in and unplugged would be one solution ... anybody built some automation for that already to store the value in Influx? |
Beta Was this translation helpful? Give feedback.
-
Does someone did this automation? I'm trying to create using the idea from DJBenson, but no luck at all... |
Beta Was this translation helpful? Give feedback.
This comment was marked as disruptive content.
This comment was marked as disruptive content.
-
Just use the battery capacity in jules. There is a max min and current. Then you need to convert the diff jules into kWh. Thats it, right? My issue is more that I know where the data is bun have no clue where to setup something i just described at the beginning |
Beta Was this translation helpful? Give feedback.
-
I did this by adding some sensors and counters and integrating them into the energy dashboard. The automation is based on the state change ("on"/"off") for charging and calculates 11 kWh per hour, but updates per second since that's how I normally charge at home. Sensors
Configurationtemplate:
- sensor:
- name: "EV6 Charging Power"
state: >-
{% if is_state('binary_sensor.ev6_ev_battery_charge', 'on') %}
11
{% else %}
0
{% endif %}
unit_of_measurement: "kW"
state_class: measurement
device_class: power - platform: integration
source: sensor.ev6_charging_power
name: ev6_energy_kwh
unique_id: ev6_energy_kwh_sensor
round: 2
method: left
state_class: total_increasing
device_class: energy Automation to Track Energyalias: "EV6 Charging Energy Tracker"
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.ev6_ev_battery_charge
to: "on"
- platform: state
entity_id: binary_sensor.ev6_ev_battery_charge
to: "off"
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.ev6_ev_battery_charge
state: "on"
sequence:
- repeat:
while:
- condition: state
entity_id: binary_sensor.ev6_ev_battery_charge
state: "on"
sequence:
- service: input_number.set_value
data:
entity_id: input_number.ev6_charged_energy
value: >-
{% set current_wh = states('input_number.ev6_charged_energy') | float(0) %}
{% set power_kw = states('sensor.ev6_charging_power') | float(0) %}
{% set new_wh = current_wh + (power_kw * 1000 / 3600) %}
{{ new_wh | round(2) }}
- delay: "00:00:01"
- conditions:
- condition: state
entity_id: binary_sensor.ev6_ev_battery_charge
state: "off"
sequence:
- service: input_number.set_value
data:
entity_id: input_number.ev6_charged_energy
value: 0 This makes the EV6 charging data available in Home Assistant’s Energy Dashboard with per-second updates. Makes it accumulate just fine and finally I have a guestimate of what it does. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to calculate the total kwh for each charging session ?
Beta Was this translation helpful? Give feedback.
All reactions