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!
Can’t wait for this - how is it coming along?
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.
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…
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:
- Page load on my.seat creates a relay code.
- Inserting the email opens https://identity.vwgroup.io/signin-service/v1/d6b68e78-c604-4d58-afd0-2c4c718d18ee@apps_vw-dilab_com/login/authenticate?relayState=84571f135f74b817afa9174e74ea216fe045f5d6&email=##############
- Inserting the password opens https://identity.vwgroup.io/signin-service/v1/d6b68e78-c604-4d58-afd0-2c4c718d18ee@apps_vw-dilab_com/login/authenticate
- Which redirects to https://identity.vwgroup.io/oidc/v1/oauth/sso?clientId=d6b68e78-c58-afd0-2c4c718d18ee@apps_vw-dilab_com&relayState=84571f135f74b817afa9174e74ea216fe045f5d6&userId=################&HMAC=96cfff344b8e97de76c90c01c9f0a8868a72d871b16f7625e
- And validates https://identity.vwgroup.io/oidc/v1/oauth/client/callback/success?user_id=8228745d--a6d7-4bddf2e4d860&client_id=d6b68e78-afd0-2c4c718d18ee@apps_vw-dilab_com&scopes=openid%20profile%20address%20phone%20email%20birthdate%20nationalIdentifier%20cars%20mbb%20dealers%20badge&consentedScopes=openid%20profile%20address%20phone%20email%20birthdate%20nationalIdentifier%20cars%20mbb%20dealers%20badge&relayState=84b817afa9174e74ea216fe045f5d6&hmac=156c910700e530050678805d166f5251a4da74d852be15261153
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.
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.
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.
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
Repository: https://github.com/Farfar/homeassistant-seatconnect
Correct, it’s not there. The README is sloppily copied from Skoda ditto so not 100% accurate.
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
Thanks for any help