Cupra Born EV integration

Grab the latest version from HACS - should fix it. v0.8.2

1 Like

v0.8.2 Works ! thank you :slight_smile:

Here is some code to create a climate template switch. This combines the start /stop and climate buttons into a single switch button.
This proved more difficult than I thought. This is due to the time it takes to activate the climate control in the car and update the climate sensor.
Using a template switch to combine the stop and start buttons was simple enough, but adding the climate sensor to the value template, to sync the switch was difficult, The sensor kept turning the switch off immediately after you turn it on, as it needed time to update.
This is not good on a dashboard as you keep pressing the button!
To counter-act the switch shut off, I added a delay timer to the value template, to keep the switch on, in my case for additional 2 mins. This works well as it allows the switch to stay on, until the climate sensor updates. It also sync’s the switch to the Phone app and car controls.

These are the entities I used in the We connect App. Please change the name if required.

sensor.cupra_born_climatisation_state Climate Sensor state
button.cupra_born_start_climate Start climate button
button.cupra_born_stop_climate Stop climate button

Add a simple timer (use settings, Device and services and select helpers)

timer.climate_delay delay 2:00 mins

   - platform: template
     switches: 
      cupra_born_climate:
        unique_id: cupra_born_climate
        value_template: >
         {{ not is_state('sensor.cupra_born_climatisation_state', 'off')  or is_state('timer.climate_delay','active')}}
        turn_on:
          - service: button.press
            target:
              entity_id: button.cupra_born_start_climate
          - service: timer.start
            target:
              entity_id: timer.climate_delay
        turn_off:
          - service: button.press
            target:
              entity_id: button.cupra_born_stop_climate
          - service: timer.finish
            target:
              entity_id: timer.climate_delay
        icon_template: >-
          {% if is_state('sensor.cupra_born_climatisation_state', 'off') %}
            mdi:fan-off
          {% else %}
            mdi:fan
          {% endif %}
1 Like

Hi together,
I use this integration since quite a while and it just works like a charm. Two weeks ago it suddenly broke, but it worked again after updating it to 0.8.2 like recommended above.

Since yesterday afternoon it does again not work anymore. Is there another breaking change in the API or does it work on your side? Looking into the logs it states “weconnect_cupra.errors.APICompatibilityError: No user id provided”.

Fixed see

issue with t&c’s

Hi,
I installed the integration using HACS, the most recent version. After a retest of HA, I tried to install the integration and after a relatively long wait it returns the following error:

Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

Does anyone has a clue what to do?
In the log it shows:

Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 20:08:54 (1 occurrences)
Last logged: 20:08:54

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 70, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 172, in post
    return await self._post_impl(request, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 179, in _post_impl
    return await super()._post_impl(request, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 84, in _post_impl
    result = await self._flow_mgr.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1262, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1282, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1418, in async_create_flow
    handler = await _async_get_flow_handler(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2776, in _async_get_flow_handler
    await _load_integration(hass, domain, hass_config)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2753, in _load_integration
    await async_process_deps_reqs(hass, hass_config, integration)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 561, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 54, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 176, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 192, in _async_process_integration
    await self.async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 274, in async_process_requirements
    self._raise_for_failed_requirements(name, missing)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 302, in _raise_for_failed_requirements
    raise RequirementsNotFound(integration, [req])
homeassistant.requirements.RequirementsNotFound: Requirements for cupra_we_connect not found: ['weconnect-cupra-daern==0.50.10'].

Hmmm, it might be the domain: files.pythonhosted.org, I’ll report back asap.

Update, it now returns: Config flow could not be loaded: Unknown error.

Nothing found in the log :confused:

Update 2: second attempt worked…

So, no issue :blush:

Does the Cupra API also allow to read out the location as GPS coordinates? This would allow to visualize the location on a map like in the Cupra App.

Yes, that’s possible and daern’s integration extracts these coordinates. To build a visualization, I added a map card to my dashboard and looked for the entity “CUPRA Born tracker”

0.8.4 is on HACS to fix it being generally broken following API changes. Feedback welcomed as always.

That’s fantastic! I haven’t seen that. Thanks a lot for the tip.

Do you need a license to use all these options?

Do you need a license to use all these options? No

Edit: I logged in on the web and accepted a bunch of stuff (should be optional i think). No change. I now added a second entity with the same credentials and it found the car… Removed the old and all good… Don’t know what did it…

Hello! I had trouble with the integration suddenly not connecting to the car and not being able to log in with “unexpected error”. I removed all files, rebooted and reinstalled everything. Now I can log in but the integration can’t find any car… Anybody have any ideas for what the problem is?

My integration worked for many months. One updated needed in april after API changes.
Broken again a week or so ago
“Logger: weconnect_cupra
Source: /usr/local/lib/python3.12/site-packages/weconnect_cupra/api/cupra/api.py:73
Last logged: 10:50:40 PM
Failed to retrieve data for VIN XXXX: Could not fetch data. Status Code was: 400”

Updating to 0.8.4 + latest HA did not help. Even deleted and reinstalled the integration via Hacs and reconnected.
The Cupra App still works fine.

Any suggestion please?

image
When i wanna login i get a error. i used the same credentials that i use in the app

HA : 2024.6.1
HACS : 2.0.1
Cupra : 0.8.4

See above - login to the official app or via the web and you’ll be presented with a load of new consents. You need to accept all of these before the integration works.

Also, this integration only supports the Cupra Born - no other Cupra models are supported at the moment.

You mean: https://mijn.cupraofficial.nl/ ?

No, best to do it in the official app. Log off, clear app data, restart etc. Then log back in and you should get a load of consent notification popups.

1 Like

for other cupra (like leon) I use the seat integration. This works fine up to a certain hour. but then the maximum polling is reached and i get an “unavailable” until midnight. then there is a reset and all data is displayed again.

1 Like