robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
336 stars 61 forks source link

[FR] Seperate Electric and Combustion Odometer #341

Closed Maxi531 closed 10 months ago

Maxi531 commented 3 years ago

[FR] Seperate Electric and Combustion Odometer I am not that savy when it comes to coding or I would´ve tried myself - I know in every Plugin Hybrid sold in the EU starting 01/2021 there is a sensor onboard, which monitors the mileage driven solely electric versus on combustion or hybrid I know that this is saved as a seperate odometer named "charge depleting" or some variation of this and it's a sensor not easily accessible by the user from the infotainmet or the we connect app or website. If possible, it would be an awesome feature, considering German Tax law on PHEV will probably be changed so you need a minimum of 50% electric driving in distance not time.

Edit: updated information

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

milkboy commented 2 years ago

Without having a sample response data with this information included, it's not possible to add it :disappointed:

virtualdj commented 2 years ago

I searched for a similar value too, but unfortunately it is not available on We Connect and neither on the infotainment as a "global" value; actually there's a view in the infotainment with the sum of the kilometers driven "full electric" but only since the last charge and you can't access this data via app/website.

As a partial workaround, I added this to my HA:

alias: Eletric kilometers count
description: Calculate the driven kilometers in full-electric mode
trigger:
  - platform: state
    entity_id: sensor.golf_odometer
condition:
  - alias: Fuel consumption equal to zero
    condition: template
    value_template: >-
      {{ (states('sensor.golf_last_trip_average_fuel_consumption')|float) == 0
      }}
action:
  - service: var.set
    data:
      entity_id: var.zero_emissions_km
      value: >-
        {{ (states('var.zero_emissions_km') | float) +
        (states('sensor.golf_last_trip_length') | float) }}
mode: single

It's not perfect as it doesn't consider an itinerary entirely if the combustion engine has started (hybrid mode), but there's no other way at the moment.