Custom Integration: Volkswagen WeConnect ID (Europe)

Hi,

This plugin worked for a long time but since a couple of weeks it is no longer updating.

Under integrations I see the following error:

I don’t know how to solve this. I was looking for a way to check where to configure the login details but can’t seem to find it.

The documentation page is giving an error.

Thanks for any tips.

1 Like

The integration is acting up for me as well. It freezes. It may show e.g. the same battery charge level for hours even though the battery is being charged.

I have to manually restart the integration, it usually helps.

Sometimes the sensors go to “unavailable“ state. I think I could make an automation to reload the integration should this happen.

Very nice work @mitchztm!

Unfortunately it did not work für my e-Up, but with small changes I got it work for most of the sensors:

You may try what I did today:

volkswagen_we_connect_id # diff -u __init__.py.old __init__.py
--- __init__.py.old	2024-08-17 12:51:01.000000000 +0200
+++ __init__.py	2024-08-17 17:03:49.029374797 +0200
@@ -33,7 +33,7 @@
 
 _LOGGER = logging.getLogger(__name__)
 
-SUPPORTED_VEHICLES = ["ID.3", "ID.4", "ID.5", "ID. Buzz", "ID.7 Limousine"]
+SUPPORTED_VEHICLES = ["ID.3", "ID.4", "ID.5", "ID. Buzz", "ID.7 Limousine", "e-up!"]
 
 
 @dataclass
@@ -67,6 +67,8 @@
         for vin, vehicle in _we_connect.vehicles.items():
             if vehicle.model.value in SUPPORTED_VEHICLES:
                 vehicles.append(vehicle)
+            else:
+                _LOGGER.error("UNSUPPORTED vehicle '%s'. Skipped ", vehicle.model.value)
 
         domain_entry: DomainEntry = hass.data[DOMAIN][entry.entry_id]
         domain_entry.vehicles = vehicles
volkswagen_we_connect_id # diff -u number.py.old number.py
--- number.py.old	2024-08-17 12:51:01.000000000 +0200
+++ number.py	2024-08-17 14:03:03.521105950 +0200
@@ -77,7 +77,7 @@
         return int(
             get_object_value(
                 self.data.domains["charging"]["chargingSettings"].targetSOC_pct.value
-            )
+            ) or 0
         )
 
     async def async_set_native_value(self, value: float) -> None:

Problem was that e-Up does not support self.data.domains[“charging”][“chargingSettings”].targetSOC_pct.value .

Right now many of the sensors seem to work:


Not all Sensors are supported by the e-Up. I did test the buttons start-charging and stop-charging. This works. Great! Very nice for automation!

image
image

My dashboard

And yes. It is just a quick hack. No warranty! And just done some hours ago.

But for me it seems sufficient.

Only drawback is that logging shows some sensor that the integration does not know:

2024-08-17 19:02:53.197 WARNING (SyncWorker_15) [weconnect] /vehicles/WVWremoved/domains/charging/chargingSettings: Unknown attribute maxChargeCurrentAC_A with value 10
2024-08-17 19:03:43.702 WARNING (SyncWorker_35) [weconnect] /vehicles/WVWremoved/domains/charging/chargingSettings: Unknown attribute maxChargeCurrentAC_A with value 10
2024-08-17 19:04:30.230 WARNING (SyncWorker_61) [weconnect] /vehicles/WVWremoved/domains/charging/chargingSettings: Unknown attribute maxChargeCurrentAC_A with value 10

But this will not break my homeassistant…

Hmm. After some hours the integration can no longer request from the volkswagen server.

Logging shows

raise TooManyRequestsError('Could not fetch data due to too many requests from your account. ’

It is also no longer possible to access the data via Web:

What ist the recommended polling interval?

With Polling Interval 600 = 10 Minutes everything now works without Problems:

And yes. The unit of consumption should be “kWh/100km”. Seems that homeassistant does not have this unit.

1 Like

@wil what entity are you using for last consumption?

Ah, there is still someone here listening? Thought I am alone here as there have been not feedback to my questions. :wink:

“Last Trip Average Electric consumption” is already supported. What I added is:

  • “Last Trip distance”
  • “Long Term Average Electric consumption”
  • “Long Term distance”

If you enable debugging, you will see that there lots of new SENSORS and VEHICLE_SENSORS that are not in the code. On the other hand there are lots of sensors already in the code that do not have defined values. Maybe they are not for electric vehicles.

This is what I have changed to sensors.py:

olkswagen_we_connect_id # diff -u sensor.py.old sensor.py
--- sensor.py.old	2024-08-21 07:07:05.225946180 +0200
+++ sensor.py	2024-08-17 19:39:53.703055466 +0200
@@ -440,6 +440,30 @@
         native_unit_of_measurement="l/100km",
         value=lambda vehicle: vehicle.trips["shortTerm"].averageFuelConsumption.value,
     ),
+    VolkswagenIdEntityDescription(
+        name="Last Trip distance",
+        key="lastTripmileage_km",
+        icon="mdi:car-arrow-right",
+        device_class=SensorDeviceClass.DISTANCE,
+        native_unit_of_measurement=UnitOfLength.KILOMETERS,
+        value=lambda vehicle: vehicle.trips["shortTerm"].mileage_km.value,
+    ),
+    # long term
+    VolkswagenIdEntityDescription(
+        key="longTermAverageElectricConsumption",
+        name="Long Term Average Electric consumption",
+        native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
+        device_class=SensorDeviceClass.ENERGY,
+        value=lambda vehicle: vehicle.trips["longTerm"].averageElectricConsumption.value,
+    ),
+    VolkswagenIdEntityDescription(
+        name="Long Term distance",
+        key="longTermmileage_km",
+        icon="mdi:car-arrow-right",
+        device_class=SensorDeviceClass.DISTANCE,
+        native_unit_of_measurement=UnitOfLength.KILOMETERS,
+        value=lambda vehicle: vehicle.trips["longTerm"].mileage_km.value,
+    ),
 
 )

The long term ist not really long term. It seems to be 31 days.

Just modify, restart and test if this also works for the ID family.

1 Like

Also enable debugging, There are lots of other sensors not used in the code that could be useful. I just added the LongTerm and also distance which is useful for me but did not look in detail to the other sensor reported back from the VW We connect server.

Please look and report back here if there are other useful sensors. Once done and tested we could ask to enhance the code on github.

Also adding my code für e-Up could be useful. I guess that adding support for e-Golf should be easy. Unfortunately I do not have it.

What I do not understand with the current code is why “lastTripAverageFuelConsumption”, “Fuel Level”, “Oil Inspection days” and others are supported, and other sensors without values but the ID family does not have an combustion engine. Only electric only vehicles are in the SUPPORTED_VEHICLES,
Is this code from a different project?

1 Like

@wil I see those now. Maybe post on the integration page on GitHub. I think the original integration was based on the old WeConnect before VW released a specific ID platform.

Feel free to do so. I have already posted the e-Up change at Not working for eUP! after migrated to the new Volkswagen API · Issue #227 · mitch-dc/volkswagen_we_connect_id · GitHub .

Is it possible to use this integration to monitor charging costs? I tried to add it to the energy monitor but it doesnt show up as an option

I currently use the eevee app but from October they are removing the “free for non fleet customers” option and they want £12 a month (now makes sense why it suddenly changed to only work for 1 car at a time, which they said was a bug) to continue using it which would be about 25% of my charging cost. I have 2 EVs and the monthly charging report was nice so me and my wife could see how much it was costing us to drive our cars but not £24 a month nice.

Also, is there a way to have it stop prompting for reconfiguration? most of the time when I open HA I have many of these that I have to dismiss, at first I would do the reconfigure but I noticed the integration wasn’t broke and I could just dismiss them.

I have not seen any of your error messages for reconfigure. But it seems to be crucial, that you use one one account at the portal for both cars and for homeassistant.

With my changes above you will see the LongTerm consumption (kWh/100 km) and the driven range (km). Long Term seems to be the last 31 days (my assumption). Like this
image

With this you can calculate how many kWh you have used by the car in the last 31 days. In my example this is 11.1×(731÷100) = 81.14 kWh. You may add between 10% to 15% on top because of charging overhead.

But you will see the same information at the Volkswagen Homepage if you login with your account (Volkswagen Connect) of VW. You can download all trips of one month and calculate the consumption usung Excel or other.

I have not seen any information on how much you have charged.

Hi everyone,

just got my ID.3. Lookinf forward to use the application. I created an ID with the Volkswagen APP and am able to access the car.
However if I tried to login into the integration, Im was getting an “Invalid Authentication”. Am I using the wrong username? I am using my Email adrress. Am I using the wrong app to connect to my car?
THX in Advance

This thread ist about the following integration GitHub - mitch-dc/volkswagen_we_connect_id
See Installation.
Use the account you use on www.volkswagen.de after you have added your car. This integration only works if you have added your car to it and if you already see information about trips, etc. there. Should be the same account you use on the Volkawagen App.

It will not work if you do not already have the Volkswagen We Connect services established. WIth my e-Up after one year I had to buy the We Connect services to use it.

In general: If the Volkswagen App works for you then this integration should also work if the car type is supported.

Thanks Willi, I figured that. So the app works. My ID.3 is showing up. The We Connect Service is valid until August 2026. Just checked on volkswagen.de. When I am logged in, I can see the vehicle as well. Still it is giving me an “Invalid Authentication” in the Integration
Reboot HA twice as well. Updated HACS to the latest version. Redownloaded the Custom Integration …
Bildschirmfoto 2024-08-29 um 12.33.02

Very strange. For me it works very well. One thing to mention. Change the Update interval to 300 (= 5 minutes). 45 seconds is too low. Volkswagen will block your account for this day if this integration pulls to frequently. If this happens you no longer be able to login at www.volkswagen.com and use the Volkswagen App. As this is still possible for you, I do not think that you are blocked and have to wait for tomorrow.

I would try to change the password and try after this again . It may be that the integration has problems with special characters that escapes on python (the integration is written in python).

BTW which version are you using? I am on 0.2.3

Homeassistant http://homeassistant.local:8123/config/integrations/dashboard shows
image

http://homeassistant.local:8123/config/integrations/integration/volkswagen_we_connect_id shows:

Where do you see an version number?

I just installed the integration via HACS at August 17th 2024 via github. Last changes in github are 2 months ago. Thus I should have the latest version available.

manifest.json shows version 1.0:

# pwd
/root/homeassistant/custom_components/volkswagen_we_connect_id
# more manifest.json 
{
  "domain": "volkswagen_we_connect_id",
  "name": "Volkswagen We Connect ID",
  "config_flow": true,
  "documentation": "https://www.home-assistant.io/integrations/volkswagen_we_connect_id",
  "requirements": ["weconnect==0.60.3", "ascii_magic>=2.0.0"],
  "ssdp": [],
  "zeroconf": [],
  "homekit": {},
  "dependencies": [],
  "loggers": ["weconnect"],
  "codeowners": [
    "@mitch-dc"
  ],
  "iot_class": "cloud_polling",
  "version": "1.0"
}

Go to HACS in the side panel, click on the application and it will tell you which version is installed.

Is it possible that I am using an invalid charakter in my password? The password is autogenerated and there is a " in there…