Connected VAG/PON cars

Skoda should work I think… can’t test it… Could you check the Authorization header of the login request? Maybe they use a different client id.

Something like:

Authorization: Basic Q09NUEFOWVhcdXNlcjE6cGFzc3dvcmQxMjM=

And could you share your lovelace config? :slight_smile:

I’ve tried to find the authorization header, but I’m not sure if I get the right call since I got a totally different header for the VW app. I was looking at the following call: https://mind-oauth2-provider.eu.cloudhub.io/external/access_token

Lovelace code:

resources:
- url: /local/custom-lovelace/gauge-card/gauge-card.js?v=1
  type: js

- icon: mdi:car
  title: Auto
  cards:
  - type: vertical-stack
    cards:
    - type: picture-entity
      image: /local/images/vwpolo01.jpg
      entity: sensor.{LICENSEPLATE}_mileage
    - type: custom:gauge-card
      title: Brandstof
      entity: sensor.{LICENSEPLATE}_fuel_left
      min: 0
      max: 40
      severity:
        green: 20
        yellow: 10
        red: 0
    - type: glance
      entities:
      - sensor.{LICENSEPLATE}_mileage_left
      - binary_sensor.{LICENSEPLATE}_doors
      - binary_sensor.{LICENSEPLATE}_ignition
      - binary_sensor.{LICENSEPLATE}_parking_brake
      - sensor.{LICENSEPLATE}_battery
    - type: map
      aspect_ratio: 70%
      default_zoom: 18
      entities:
      - device_tracker.{LICENSEPLATE}

btw, do you have any nice ui components or scripts for the car?

Yeah that’s the one. what I posted was just an example, not sure what it would be on the volkswagen app.
You can also give me the complete request header.

The client id for Skoda is: c030ad63a0e4433d86e4a36fc4047ce2
The client secret for Skoda is: E97F8294804c49Cd83b0b9f0552577B2

I updated the code so you can now specify the client_id and client_secret:

The default is the volkswagen. Let me know if that is the trick.

Config:

mind:
  username: [email protected]
  password: YoUrPaSsWoRd
  client_id: c030ad63a0e4433d86e4a36fc4047ce2
  client_secret: E97F8294804c49Cd83b0b9f0552577B2
1 Like

When I’m back from vacation I will try it!

Do we have to specify the client_id and client_secret? If so how are we able to get the id? I have a Seat car using the MijnSeat app (new app).

I’m not sure, let’s wait for @FireFly his tests.

But it is not working for you with Seat?
To get the client_id and client_secret you have to setup a proxy between the app and the internet so you can listen to the requests that are made by the app. If FireFly succeeds I will document them for VW, Seat, Skoda, Audi and VW bedrijfswagen.

Wednesday I’m going back home. I’d rather not try it now in case something goes wrong :stuck_out_tongue:.
If it works I can also help out and decompile the Android apps to see if I can extract the IDs.

I’m getting the following in the Home-Assistant.log file. So not sure if it is something with the Client_ID / Secret. Running HA 0.78.2 at the moment.

Traceback (most recent call last):
File “/usr/lib/python3.5/asyncio/tasks.py”, line 241, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 56, in async_setup_component
return await task # type: ignore
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/asyncio/tasks.py”, line 239, in _step
result = coro.send(None)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 103, in _async_setup_component
component = loader.get_component(hass, domain)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py”, line 94, in get_component
module = importlib.import_module(path)
File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 958, in _find_and_load_unlocked
File “”, line 673, in _load_unlocked
File “”, line 669, in exec_module
File “”, line 775, in get_code
File “”, line 735, in source_to_code
File “”, line 222, in _call_with_frames_removed
File “/home/homeassistant/.homeassistant/custom_components/mind.py”, line 65
username=conf.get(CONF_USERNAME),
^
SyntaxError: invalid syntax

Is there a comma at the end of line 64?
I remember I had a similar issue.

this line needs a comma at the end:
client_id=conf.get(CONF_CLIENT_ID), client_secret=conf.get(CONF_CLIENT_SECRET)

The comma was missing indeed. Added it and now it is complaining about some dependencies?

2018-09-24 15:14:24 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.mind. Make sure all dependencies are installed
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py”, line 94, in get_component
module = importlib.import_module(path)
File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 958, in _find_and_load_unlocked
File “”, line 673, in _load_unlocked
File “”, line 673, in exec_module
File “”, line 222, in _call_with_frames_removed
File “/home/homeassistant/.homeassistant/custom_components/mind.py”, line 12, in
from homeassistant.const import (
ImportError: cannot import name ‘CONF_CLIENT_ID’

Sorry my bad, been sloppy… should be fixed now, both the comma and the imports.

Updated the files and think i’m now hitting the error for the car as i’m getting an Access Denied. The login provided in the mind: component is the same as using in the Seat app. Last line of the home-assistant.log file:

oauthlib.oauth2.rfc6749.errors.AccessDeniedError: (access_denied)

try:

  client_id: 8ba04cb3869f4b568ea54fc57154d957
  client_secret: b7fD6c394a7c4aFd998afA70Cb5fED86

That seems to work! Great job! :slight_smile:

If you want me to check something else because of the Seat brand let me know

I was also able to get it working for Skoda this morning. :smiley:
And for my Polo it says that the parking brake is “onveilig”.

Also here the Parking brake is “Onveilig” and my doors are always “Locked” even when i’m driving (but might be the autolock while driving)?

Also i notice my GPS is not updated that often, yesterday my car was 400m away from where it was actually parked. After getting back to the car unlock it (had to take something out the car) and lock it the GPS suddenly got updated.
This morning my car is halfway between home and work, while i’m at work, so not sure how I got at work but seems the car is still halfway :stuck_out_tongue:

How does it compare to the official app? And does the doorstatus actually work for you in the app?