GithubHelp home page GithubHelp logo

Comments (13)

mschlenstedt avatar mschlenstedt commented on July 21, 2024 1

Yes, sorry. Works like a charme now :-)

from skodaconnect.

Farfar avatar Farfar commented on July 21, 2024

Yes, the example code has unfortunately not been worked on for a while.
I will see if I can make it work and update with some comments.

I am working on a project in parallel to migrate all code into a more generalized "VW-Group Connect" library that might be used for all VAG brands since most seems to be using the same API (at least VW, Skoda and Seat this far).

from skodaconnect.

mschlenstedt avatar mschlenstedt commented on July 21, 2024

No problem - may be you can just explain how I can grep the data in a simple way. I would like to use the library to send all data to a MQTT broker.

from skodaconnect.

Farfar avatar Farfar commented on July 21, 2024

No problem - may be you can just explain how I can grep the data in a simple way. I would like to use the library to send all data to a MQTT broker.

See the example/examply.py in latest commit. There you should be able to figure out what you can use and how.

If you have the Vehicle class object then you can access the data directly from the object properties, vehicle.charging_cable_connected for instance will then return True/False.

You should implement a update method that periodically calls the Connection update() method to fetch newest data from servers. If not done periodically, or too long between updates, then the tokens might expire and might be non-refreshable. Then a new login is required which will re-init everything.

from skodaconnect.

mschlenstedt avatar mschlenstedt commented on July 21, 2024

Great - thanks a lot!

from skodaconnect.

mschlenstedt avatar mschlenstedt commented on July 21, 2024

Sorry, have to reopen this again... When trying the new example code I got an error regarding missing cryptography module (RSAalgorith is missing). So I used pip to install cryptography (seems that this must be added to requirements.txt).

I installed cryptography-3.4.4 via pip.

Now I get the following error:

DEBUG:skodaconnect.connection:Parse auth code...
DEBUG:skodaconnect.connection:Get tokens...
DEBUG:skodaconnect.connection:User identity token verified OK.
DEBUG:skodaconnect.connection:VW-Group API token verified OK.
DEBUG:skodaconnect.connection:Fetching vehicles associated with account
DEBUG:skodaconnect.connection:HTTP GET "https://msg.volkswagen.de/fs-car/usermanagement/users/v1/skoda/CZ/vehicles"
DEBUG:skodaconnect.connection:Request for "https://msg.volkswagen.de/fs-car/usermanagement/users/v1/skoda/CZ/vehicles" returned with status code [200]
DEBUG:skodaconnect.connection:Found vehicle(s) associated with account.
ERROR:skodaconnect.connection:Failed to login to Skoda Connect, It is required that you pass in a value for the "algorithms" argument when calling decode().

Some discussions on the web shows, that this error seems to be related to pyJWT module, but I have installed latest version via pip:

# pip install pyJWT
Collecting pyJWT
  Downloading PyJWT-2.0.1-py3-none-any.whl (15 kB)
Installing collected packages: pyJWT
Successfully installed pyJWT-2.0.1

Maybe this one? https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst#dropped-deprecated-verify-param-in-jwtdecode

Sorry for all that trouble.... :-)

from skodaconnect.

mschlenstedt avatar mschlenstedt commented on July 21, 2024

Just checked with an older version from the debian repo: python3-jwt (1.7.0-2). This version gave the same error.

from skodaconnect.

Farfar avatar Farfar commented on July 21, 2024

Sorry, have to reopen this again... When trying the new example code I got an error regarding missing cryptography module (RSAalgorith is missing). So I used pip to install cryptography (seems that this must be added to requirements.txt).

I installed cryptography-3.4.4 via pip.

Now I get the following error:

DEBUG:skodaconnect.connection:Parse auth code...
DEBUG:skodaconnect.connection:Get tokens...
DEBUG:skodaconnect.connection:User identity token verified OK.
DEBUG:skodaconnect.connection:VW-Group API token verified OK.
DEBUG:skodaconnect.connection:Fetching vehicles associated with account
DEBUG:skodaconnect.connection:HTTP GET "https://msg.volkswagen.de/fs-car/usermanagement/users/v1/skoda/CZ/vehicles"
DEBUG:skodaconnect.connection:Request for "https://msg.volkswagen.de/fs-car/usermanagement/users/v1/skoda/CZ/vehicles" returned with status code [200]
DEBUG:skodaconnect.connection:Found vehicle(s) associated with account.
ERROR:skodaconnect.connection:Failed to login to Skoda Connect, It is required that you pass in a value for the "algorithms" argument when calling decode().

Some discussions on the web shows, that this error seems to be related to pyJWT module, but I have installed latest version via pip:

# pip install pyJWT
Collecting pyJWT
  Downloading PyJWT-2.0.1-py3-none-any.whl (15 kB)
Installing collected packages: pyJWT
Successfully installed pyJWT-2.0.1

Maybe this one? https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst#dropped-deprecated-verify-param-in-jwtdecode

Sorry for all that trouble.... :-)

No worries.
I think it's a bug in pyjwt 2.0.1, just noticed yesterday myself.
Install pyjwt==1.7.1 and it should work fine.

from skodaconnect.

Farfar avatar Farfar commented on July 21, 2024

Just checked with an older version from the debian repo: python3-jwt (1.7.0-2). This version gave the same error.

Can you try install older version via pip instead? And verify which one in use with pip show.

from skodaconnect.

mschlenstedt avatar mschlenstedt commented on July 21, 2024

Great - works with 1.7.1 from pip!

Thanks! I am looking forward if the new lib for all other VW brands is available. I will now include at first the skoda lib in my project.

https://github.com/mschlenstedt/LoxBerry-Plugin-SkodaConnect

This is still based on https://github.com/DBa2016/sc2mqtt, but functionality is quite limited...

from skodaconnect.

mschlenstedt avatar mschlenstedt commented on July 21, 2024

Played a little bit with the example today. It greps the data for the first time very well, but then if it tries to update the data after 20 sec I got the following error:

...
XXXXXXXPXM702XXXX Fuel level - (fuel_level)
        str_state: 79 % - state: 79
        attributes: {}

Sleeping for 20 seconds
Updating ALL values from Skoda Connect...
DEBUG:skodaconnect.connection:Going to call vehicle updates
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/climatisation/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/climater"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/tripstatistics/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/tripdata/shortTerm?newest"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/cf/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/position"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/vsr/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/status"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger"
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/tripstatistics/v1/skoda/CZ/vehicles/TXXXXXXXPXM702XXXX/tripdata/shortTerm?newest" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/cf/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/position" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/climatisation/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/climater" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/vsr/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/status" returned with status code [200]
Success!
Updating INDIVIDUAL values for XXXXXXXPXM702XXXX...
Updating carportdata...
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/promoter/portfolio/v1/skoda/CZ/vehicle/XXXXXXXPXM702XXXX/carportdata"
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/promoter/portfolio/v1/skoda/CZ/vehicle/TXXXXXXXPXM702XXXX/carportdata" returned with status code [200]
Updating charger data...
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger"
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger" returned with status code [200]
Traceback (most recent call last):
  File "./example.py", line 204, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "./example.py", line 166, in main
    await vehicle.get_charger()
  File "/opt/loxberry/.local/lib/python3.7/site-packages/skodaconnect/vehicle.py", line 193, in get_charger
    await self._states.update(data)
TypeError: object NoneType can't be used in 'await' expression

from skodaconnect.

Farfar avatar Farfar commented on July 21, 2024

Played a little bit with the example today. It greps the data for the first time very well, but then if it tries to update the data after 20 sec I got the following error:

...
XXXXXXXPXM702XXXX Fuel level - (fuel_level)
        str_state: 79 % - state: 79
        attributes: {}

Sleeping for 20 seconds
Updating ALL values from Skoda Connect...
DEBUG:skodaconnect.connection:Going to call vehicle updates
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/climatisation/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/climater"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/tripstatistics/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/tripdata/shortTerm?newest"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/cf/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/position"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/vsr/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/status"
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger"
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/tripstatistics/v1/skoda/CZ/vehicles/TXXXXXXXPXM702XXXX/tripdata/shortTerm?newest" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/cf/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/position" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/climatisation/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/climater" returned with status code [200]
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/vsr/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/status" returned with status code [200]
Success!
Updating INDIVIDUAL values for XXXXXXXPXM702XXXX...
Updating carportdata...
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/promoter/portfolio/v1/skoda/CZ/vehicle/XXXXXXXPXM702XXXX/carportdata"
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/promoter/portfolio/v1/skoda/CZ/vehicle/TXXXXXXXPXM702XXXX/carportdata" returned with status code [200]
Updating charger data...
DEBUG:skodaconnect.connection:HTTP GET "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger"
DEBUG:skodaconnect.connection:Request for "https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/skoda/CZ/vehicles/XXXXXXXPXM702XXXX/charger" returned with status code [200]
Traceback (most recent call last):
  File "./example.py", line 204, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "./example.py", line 166, in main
    await vehicle.get_charger()
  File "/opt/loxberry/.local/lib/python3.7/site-packages/skodaconnect/vehicle.py", line 193, in get_charger
    await self._states.update(data)
TypeError: object NoneType can't be used in 'await' expression

Check the latest commit. And you don't need to update the data like in the example, it's only there to show you different ways to do it.

from skodaconnect.

Farfar avatar Farfar commented on July 21, 2024

@mschlenstedt did you resolve this?

from skodaconnect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.