SEAT Connect car integration in Hassio

Hello there.
Volkswagen Group (VWgroup.io) has connected car technology for their Audi, VW, Skoda and Seat.
Home assistant has developments for Skoda and VW. Could anyone give a hand to integrate Seat?
I have started but need a push.
https://github.com/jfamaral/seatconnect
Thanks!

2 Likes

Can’t wait for this - how is it coming along?

1 Like

Most functions should be similar to Skoda Connect integration but you might need to make changes for login to make it work.
Other things in the code that might need some work is get/put and URL handling if it’s much different to Skoda. Else you might only need to fix a few constants to make sure the correct headers are sent.

1 Like

You are right. Received a reply moments ago from the SEAT support telling they won’t share an API.
It is a rather complex authentication system that just makes it hard (and not really smart) to authenticate.

I need to spend some hours digesting further code…

1 Like

Yes it’s if they took oauth and twisted the solution into fitting their needs.
It’s pretty straight forward though as long as Seat hasn’t done anything new. You authenticate with your user to identity.vwgroup.io (with brand specific forms and look), receive a token, code or whatever the brand has decided (code seems to be the new way). Exchange code for refresh+identity token from vwapps and then use that identity token to get API tokens (refresh+access) from mbboauth.
The last tokens are used to fetch data from vw-group servers where all data seems to reside. Identity token can be used to fetch user specific data such as car nickname, which cars you have registered etc.

I don’t have a Seat but maybe I can take a look and see what seems to differ from Skoda to Seat login. If I get some spare time I’ll post an update.

How far along are you? Can you login to Seat Connect with the code you currently have on github?
At line 112 in api.py you should be able to remove ‘token’ and only use ‘code id_token’, that’s all that is needed for Skoda Connect login.
Then remove line 182.

I can help with what I’ve learned from working on the Skoda integration.
My attempts at patching the Seat Connect APK, to disable SSL pinning and use a mitm proxy, has so far failed though so I haven’t yet been able to see if there’s any difference to the API calls yet.

I’ve been mostly dissecting how https://my.seat/portal/ handles the requests.
Then I have copied skoda integration and touched some variables, but the authentication is not working yet…

How it goes:

Then:
https://dpm.demdex.net/id?d_visid_ver=5.1.1&d_fieldgroup=AAM&d_rtbd=json&d_ver=2&d_orgid=F050097853468AB40A490D4C%40AdobeOrg&d_nsid=0&d_mid=793584364770070237622760&d_blob=j8Odv6LonN4r3an7LhD3WZrU1BR96t2PTI&d_cid_ic=seat_id8228745d4bddf2e4d8601&ts=1612363387820

And then the results are available here:
https://my.seat/portal/api/v1/vehicles
https://my.seat/portal/api/v1/user/overview
https://my.seat/portal/api/v1/vehicles/VIN NUMBER/status-report
https://my.seat/portal/api/v1/vehicles/VIN NUMBER/carfinder
https://my.seat/portal/api/v1/vehicles/VIN NUMBER/trip-statistics/newest
https://my.seat/portal/api/v1/vehicles/VIN NUMBER/health-report
https://my.seat/portal/api/v1/dealers/preferred
https://my.seat/portal/api/v1/vehicles/VIN NUMBER/speed-alert?ts=1612010
https://my.seat/portal/api/v1/vehicles/VIN NUMBER/speed-alert/configuration
https://my.seat/portal/api/v1/user/personal-data

Can you access all data and functions in the web application? Or is there some functions not available?
For Skoda the integration is based upon the App API calls which seems to access the VW-Group servers directly.
The Skoda Connect web app is limited.

I have created a Seat account and will test some, though I suspect that I don’t get very far without a VIN registered.

Great news!
I have managed to inspect the app and it seems as if most, probably all, of the code from the Skoda Connect integration can be used.
I have successfully fetched data via a script I used previously for Skoda, now adapted for Seat. The only parts changed this far is a few constants and some headers. I will work with @jfamaral and see if we can’t get this integration up and running soon.

2 Likes

Great news - can’t wait. Let me know if I can help testing it. I have a Seat with Seat Connect

I have now created a repo based on my work with Skoda Connect. All seems to be working the same.

3 Likes

Been testing for few hours, seems to be working fine! Thanks @Farfar!

1 Like

Since it seems to be working fine for Seat with only client authentication differences it might be in order to de-brand the library and make it brand independent. Will see how that might be possible to implement onwards.

3 Likes

Same here. @farfar you rock!

2 Likes

A word of caution though. Seat doesn’t seem to have implemented token handling in the same way as Skoda for their app.
Seat doesn’t seem to refresh tokens when they expire but Skoda does.
Will need to test some more but it looks like the integration can use the Skoda way of handling tokens so we don’t need to re-auth when they expire.
This might change though of Seat changed their app.

Fantastic news! I’m expecting my new Seat Leon ST PHEV in a few weeks. However, I can not find ‘Seat connect’ repo with HACS?

We got out Seat Leon Sports tourer 14 days ago - fantastic car!
If you can’t find it in HACS, just add the repository manually in HACS - you will get a lot of sensors :slight_smile:

Repository: https://github.com/Farfar/homeassistant-seatconnect

Correct, it’s not there. The README is sloppily copied from Skoda ditto so not 100% accurate.

2 Likes

Hello there,
just tried to set up the Seat Connect integration. Unfortunately I only get an error after starting HASS:

  • Error adding entities for domain sensor with platform seatconnect
  • Error while setting up seatconnect platform for sensor

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 315, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 506, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/config/custom_components/seatconnect/sensor.py", line 27, in state
    return self.instrument.state
  File "/usr/local/lib/python3.8/site-packages/seatconnect/dashboard.py", line 114, in state
    val = super().state
  File "/usr/local/lib/python3.8/site-packages/seatconnect/dashboard.py", line 59, in state
    return self.vehicle.get_attr(self.attr)
  File "/usr/local/lib/python3.8/site-packages/seatconnect/vehicle.py", line 513, in get_attr
    return find_path(self.attrs, attr)
  File "/usr/local/lib/python3.8/site-packages/seatconnect/utilities.py", line 86, in find_path
    return find_path(src[path[0]], path[1:])
KeyError: 'combined_range'

Is this a known error?
I already reinstalled the integration.

UPDATE
Surprisingly, today morning I saw all the Seat Connect Sensors in Hassio. There are no more changes or reboots to Hassio or any changes to customize.yaml since my last post above.
I did a reboot of Hassio just now to check if the error will appear again: There are no more errors. I can not explain it :thinking:

Thanks for any help :slight_smile: