How to integrate my Cupra Born?

Okay the update took longer than expected, but today I got the car back and I can say it’s a nice upgrade. Setting the target temperature and charge in HA are fixed and entities like odometer, location and door lock status are now available! Before update:

Hardware: H20
Software: 0796
ABT hardware: H43
ABT software: 6074
Navigation database: 20.7
Media-codec: 3.1.4

Available entities in HA: about 29

After update:

Hardware: H20
Software: 0561
ABT hardware: H43
ABT software: 6085
Navigation database: 22.9
Media-codec: 3.1.4

Available entities in HA: 59!

2 Likes

Ah, VW. Where the software version goes down but new features get added :slight_smile:

Glad this is all working for you. Hopefully will help others having similar issues, and glad to hear that the component automatically picked up your additional capabilities and turned on the new features.

2 Likes

I’m also seeing some problems… My car is arriving in the beginning of may, but I wanted to set this up beforehand. Setup of the profile is done. Could that cause these problems?

The logs are from the version released march 28th, found here, and I just copied the volkswagen_we_connect_id folder to custom components and restarted HA.

I only get two fields, username and password, and the option for VW or Cupra.
Unexpected error

Traceback (most recent call last):
  File "/config/custom_components/volkswagen_we_connect_id/config_flow.py", line 75, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/config/custom_components/volkswagen_we_connect_id/config_flow.py", line 51, in validate_input
    await hass.async_add_executor_job(we_connect.update)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/weconnect/weconnect.py", line 176, in update
    self.__api.update(updateCapabilities=updateCapabilities, updatePictures=updatePictures, force=force, selective=selective)
  File "/usr/local/lib/python3.10/site-packages/weconnect/api/cupra/api.py", line 39, in update
    self.updateVehicles(updateCapabilities=updateCapabilities, updatePictures=updatePictures, force=force, selective=selective)
  File "/usr/local/lib/python3.10/site-packages/weconnect/api/cupra/api.py", line 45, in updateVehicles
    data = self.__fetcher.fetchData(url, force)
  File "/usr/local/lib/python3.10/site-packages/weconnect/fetch.py", line 74, in fetchData
    raise RetrievalError(f'Could not fetch data. Status Code was: {statusResponse.status_code}')
weconnect.errors.RetrievalError: Could not fetch data. Status Code was: 403

The charging station at work shows how many kWh I have charged in total during a charge, I now also wanted to process this in HA so that I can see how much I have charged in total at public charging stations.

The Cupra Born provides a sensor (sensor.cupra_born_charge_power) with a measurement unit kW
Created a Riemann sum integral sensor with helpers and created a utility meter, because I have to go from Kw to kWh and reset to 0 per day.

Yesterday I put my car at the charging station at work and after finish immediately took a picture of the total charged kWh and compared it at home with what was in HA.
According to the charging station at work, I have charged 31.36 kWh (I can now also see this in the lease company’s app) and according to the sensor I created in HA 109.36 kWh.

The sensor I created in HA starts at 0 and then runs straight to 90.21 kWh from there it steps up to 109.36 kWh. If I look at the difference between 90.21 kWh and 109.36 kWh, I don’t get 31.36 kWh, but 19.15 kWh (109.36 kWh - 90.21 kWh)

Been trying all morning to understand what is not going well now.
Does anyone have an idea what is not going well or a working solution to show the total KWh charged per charge?

More info about the sensors
sensor.kwh_sensor (Riemann som integrale sensor)

state_class: total
source: sensor.cupra_born_charge_power
unit_of_measurement: kWh
device_class: energy
icon: mdi:chart-histogram
friendly_name: kwh sensor

sensor.batterij_kwh (utility meter)

state_class: total_increasing
source: sensor.kwh_sensor
status: collecting
last_period: '109.36'
last_valid_state: None
meter_period: daily
cron pattern: 0 0 * * *
last_reset: '2023-03-30T22:00:00.010763+00:00'
unit_of_measurement: kWh
device_class: energy
icon: mdi:counter

Almost certainly, your issue is that your car isn’t properly registered with you, which is something that (at least in my own experience) you can only do when physically sat in it. A good starting point is to get the official app working first. If you can get this working, this integration should probably work without issue. Have you tried this?

Unfortunately, I’m away for a bit otherwise I’d have tried this myself. When I get back, if you’ve not solved it, I’ll have a go myself as it looks quite a useful thing to be able to do.

1 Like

No problem. There’s no cow on the ice, as we say in Sweden :sweat_smile:
The app is working fine though there is no car as you know. I won’t look further into this, unless you ask me to try something, before I have the car :slight_smile:

1 Like

Ahh sweet, I’ve just updated to the latest version of this branch and most features are working on my early edition Born on the 1st version of the software. Hassio now works better than the cupra app!

When I say most features… I mean the ones I know my cars crappy software supports

Hi
I’ve wanted to do exactly the same and record the kWhs put into the charge.
I initially tried our approach using the Riemann sum sensor and the cupra.born.charge.power enitity, which fed into HA utility meter helper. Suffice to say, i gave up because it’s just not accurate enough despite trying lots of different permutations.

My current solution is to have my granny charger plugged into a zigbee smart plug that has power monitoring, and capture the ‘cumulative charge’ stat in a HA utility meter helper. This works and matches the calculated input (kWh x hours of charging).
I also use the new HA Google Docs integration to log my daily Cupra charge amount on a google sheets doc (which also captures my house elec + gas usage and solar generation stats).

There are a couple of downsides to this approach:
Firstly, I have my granny charger mounted in a waterproof function box on the side of my house (more for security than anything else, as the charger is waterproof) and adding a smart plug adds bulk.
Secondly, you need a high quality smart plug that can handle the sustained load (3Kw/13a for my granny charger) and has a reliable signal connection to the house. I’ve been through a few different smart plugs and I’m currently using a Tuya 20A. My previous Tuya 13A and 16A plugs would randomly turn off - ? due to load. Also, they will drop off the zigbee network occasionally and by default return to power off when reconnecting, stopping the charge cycle. My latest 20A Tuya plug can be set to restore it’s power on reconnection. so far it’s been much more reliable but if i have any problems i’ll switch to one of my Philips smartthings plugs which seem to be far better built, but i’d rather have use a cheaper Tuya plugs if running a EV charger through them shortens their lifespan.

In the future, i plan to get a proper EV charger like a Zappi, which i’ll be able to pull the charging stats directly into HA.
I could also get a zigbee CT clamp power monitor and attach it around the 32A line for the EV charger power supply, but would struggle to fit another CT clamp in my already crowded fuse box.

For the VW ID cars, there is a ‘VW Friend’ github plugin (that shares the same base code as this) that can log charging and driving sessions, but i don’t think the Cupra’s are compatible.
Possibility for a Cupra branch?

1 Like

Unfortunately I can’t place a charging station at home, otherwise that would be the easiest solution. Hopefully there will be another solution.

So i had this working with the git clone + the feature of cupra-born copied in.

It stopped working and i thought ok time to upgrade vw connect and get the new cupra files in place. problem is that it doesnt work.

2023-05-09 15:45:00.569 ERROR (MainThread) [custom_components.volkswagen_we_connect_id.config_flow] Unexpected exception during setup
Traceback (most recent call last):
  File "/config/custom_components/volkswagen_we_connect_id/config_flow.py", line 75, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/config/custom_components/volkswagen_we_connect_id/config_flow.py", line 51, in validate_input
    await hass.async_add_executor_job(we_connect.update)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/weconnect/weconnect.py", line 176, in update
    self.__api.update(updateCapabilities=updateCapabilities, updatePictures=updatePictures, force=force, selective=selective)
  File "/usr/local/lib/python3.10/site-packages/weconnect/api/cupra/api.py", line 39, in update
    self.updateVehicles(updateCapabilities=updateCapabilities, updatePictures=updatePictures, force=force, selective=selective)
  File "/usr/local/lib/python3.10/site-packages/weconnect/api/cupra/api.py", line 45, in updateVehicles
    data = self.__fetcher.fetchData(url, force)
  File "/usr/local/lib/python3.10/site-packages/weconnect/fetch.py", line 74, in fetchData
    raise RetrievalError(f'Could not fetch data. Status Code was: {statusResponse.status_code}')
weconnect.errors.RetrievalError: Could not fetch data. Status Code was: 500

installation was get the vw connect id integration and then from shell run

git clone -b 'feature/cupra-support' https://github.com/daernsinstantfortress/volkswagen_we_connect_id.git

and then copy that to custom_components

Where did i go wrong? App is working but cant get past the login in HA.

Hey Daern,

Hey everyone else,

so I have updated my custom component to Daerns one but (I have had this issue before the Update this wasnt broken by daern) currently the entities will not get updated. My Range is at 20km even though I charged my car up 3x since then and it says its been locked since yesterday evening even though I drove to work this mornign

Have you fully rebooted your system before testing to login again?

just deleted the integration then restarted HA and installed it again → Doesnt work.

Just restarting also doesnt work, or reloading the integration.

Its reporting values its just not reporting the correct values :confused:

Is the Cupra app reporting the correct values? The Cupra software is nothing if not flaky!

Got my Cupra Born delivered yesterday and dropped this custom component in and all seems well so far, thanks daern!

What are people using the details for, particularly automations? I’m going to setup a reminder that pops up in the evening if we forget to put it on charge, and also something to prompt to turn on the climate prior to my wife leaving for work, if I can figure out a way to determine “she’s up and going to the office today”.

FYI, upcoming HA 2023.6 release will break this integration. A patch is available here and should be installed beforehand to avoid the inconvenience of it failing during the update:

https://github.com/daernsinstantfortress/volkswagen_we_connect_id/archive/8ceb117c78f270095da34943d1a69c3192a4ff8e.zip

Just copy straight over the top of the existing version and reboot HA to take effect and you’ll be good for when 2023.6 lands in a couple of days.

2 Likes

At the moment I’m just using it to display information. Starting next week, my electricity costs will change every hour. I want to make automations that start charging my car when electricity is cheap or even free.

I’m very pleased to announce a new, standalone Cupra Born integration , available today!

I’ve created a dedicated thread for this, so knock your socks off over here.

1 Like

Hi Daern, I want to show my gratitude and say a huge thank you for this amazing piece of work.
I’ve migrated to this new version and have been using it for the last week.
Its been working really well!
Looking at the state of my Cupra in HA, has overtaken my previous top activity of obsessively monitoring my solar panels, and I’ve been working pondering on a whole new host of automation :slight_smile:

I’d love to buy you a coffee.
Thanks again and well done!

darren

1 Like