Connected VAG/PON cars

PON the importer of VAG (Volkswagen, Audi, Skoda, Seat) cars in the Netherlands is equipping a lot of the new cars they sell with connected technology.

You can check the state of your car and see where it is and where it has been. Really nice, but I wanted to have it in Home Assistant.

So I asked PON nicely, but as expected they were not giving me access to the API.
So I reversed engineered their App and I seems their API is protected very poorly.

So now I have it integrated into my Hass.

At the moment it makes a device_tracker with the location, shows a few binary_sensors (ignition, locked, park break) and a few sensors (fuel, mileage)

A lot more can be added, I just didn’t yet… If you want something added let me know.

Here are the custom components, just drop them in the custom_components folder:
mijnpon.py
sensor/mijnpon.py
binary_sensor/mijnpon.py
device_tracker/mijnpon.py

Config:

mijnpon:
  username: [email protected]
  password: YoUrPaSsWoRd
7 Likes

Hi Bram,

I have setup the mijnpon: statements in my configuration. But it seems it has an issue getting a TOKEN.

2017-09-14 10:07:16 ERROR (MainThread) [homeassistant.setup] Error during setup of component mijnpon
Traceback (most recent call last):
File “/home/homeassistant/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py”, line 194, in _async_setup_component
component.setup, hass, processed_config)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/mijnpon.py”, line 42, in setup
hass.data[DATA_MIJNPON] = MijnPon(hass, conf)
File “/home/homeassistant/.homeassistant/custom_components/mijnpon.py”, line 64, in init
password=conf.get(CONF_PASSWORD), cache_ttl=conf.get(CONF_SCAN_INTERVAL))
File “/home/homeassistant/homeassistant/lib/python3.4/site-packages/mijnpon/init.py”, line 201, in init
self._auth()
File “/home/homeassistant/homeassistant/lib/python3.4/site-packages/mijnpon/init.py”, line 227, in _auth
token = self._mijnPonApi.fetch_token(token_url=TOKEN_URL, username=‘pon\’+self._username, password=self._password, client_id=self._client_id, client_secret=self._client_secret, scope=SCOPE)
File “/home/homeassistant/homeassistant/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py”, line 244, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File “/home/homeassistant/homeassistant/lib/python3.4/site-packages/oauthlib/oauth2/rfc6749/clients/base.py”, line 409, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File “/home/homeassistant/homeassistant/lib/python3.4/site-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 376, in parse_token_response
validate_token_parameters(params)
File “/home/homeassistant/homeassistant/lib/python3.4/site-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 386, in validate_token_parameters
raise MissingTokenError(description=“Missing access token parameter.”)
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

what could be the reason for that? I changed the password to be more “readable” but that does not resolve the thing above.

Thanks a lot!
Remko

To be honest, I don’t know… I think your username/password is not correct?

What car do you have? And what app do you use?

well, I guess I can try to submit the incorrect credentials to find out. I have a VW Golf Variant, and I what you do mean by what app I am using?

I’d guess you mean that there are more apps to see where the car is etc? I use the “Mijn Volkswagen” app. Do you use a different app?

Nope! Same car and same app, so should work I would say. I will check it out tomorrow.

I changed my logins to incorrect ones, and got the exact same error you got.
So I guess you have to double check your login and password…

Hi Bram,

Hmm interesting. I have shortened my password, but that does not work. So something else is off. It might be because I get redirected to the German version of the site. I already asked VW to correct it to the Dutch location, but … no response yet …

Thanks & Cheers,
Remko

German? This is not available for the German market.

You should enter the same login details you use in the app.

Can you login here?
https://mijnvolkswagen.connectedview.info/Account/Login?ReturnUrl=%2F

1 Like

I can now. I used to login to “Car-Net” which apparently has different login credentials then your URL. It seems that my email address was known and I resetted it to the one I use for Car-Net. It works now :slight_smile:

(I never ever logged in to mijnvolkswagen at all, I didn’t even know it existed, thanks for that!)

Cheers
REmko

Hi Bram,

Thanks for this great plugin :slight_smile: You mentioned that a lot can be added. Do you know if the car temperature can be read? Would be nice to be able to configure a notification like “Car temperature is below 0 degrees, possible window frost” or something.

/Frank

I don’t see it in the data, just the Engine Coolant Temperature.
I don’t think anything is updated while the car is not powered, so not sure it would be useful anyway…

Indeed (hi FrankT!), the statistics and information is not updated when the car is off and/or there is no “trigger” (door unlock, open, etc). I see that with my graphs, the statistics are updated because I use the car during the week. but the interval is… interesting. Same goes for the weekend when the car is mostly not in use or much less. The gap between the updates is sometimest too long, making the stats go nuts (in grafana, after them being exported by HASS).

I had contact with VW already, but I did not get an conclusive answer about this yet.

I hope you didn’t tell them about this project, not sure they like it :slight_smile:

No I did not tell them I was gathering the statistics myself. I asked when the statistics and the like are updated :wink:

Hi Bram, Remko!

To bad. this info isn’t available. since most other info doesn’t change when the car is parked, it makes sense the information isn’t updated in the meantime. I’ll find another temperature source to control the block heater.

Cheers,
/Frank

Hi Bram,

Pretty old topic, but i’m trying to get this to work on my Raspberry Pi Home Assistant setup but when enabling mijnpon: in my config i get an error:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 148, in _async_setup_component
    component.setup, hass, processed_config)
  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/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/mijnpon.py", line 42, in setup
    hass.data[DATA_MIJNPON] = MijnPon(hass, conf)
  File "/home/homeassistant/.homeassistant/custom_components/mijnpon.py", line 58, in __init__
    import mijnpon
  File "/srv/homeassistant/lib/python3.5/site-packages/mijnpon/__init__.py", line 9, in <module>
    from requests_oauthlib import OAuth2Session
  File "/srv/homeassistant/lib/python3.5/site-packages/requests_oauthlib/__init__.py", line 9, in <module>
    if requests.__version__ < '2.0.0':
TypeError: unorderable types: module() < str()

Seems to me something is missing from my python setup but i’m not sure what. I did run:

pip3 install requests requests_oauthlib but thats not enough i think?

Thank you!

Is it also possible tot connect tot te bedrijfswagen app
I have a transporter I hope you can help me

M00s

Yes, should work with all the VAG cars with Mijn Volkswagen, Mijn Volkswagen bedrijfswagen, Mijn skoda, Mijn seat, Mijn audi, whatever…

Yeah, seen that before with some people on the Lyric component, not sure what the solution was there, you should check the topic.