GithubHelp home page GithubHelp logo

skodaconnect's Introduction

Version PyPi Downloads PyPi

Maintainers and contributors needed

Keeping up with changes made by Skoda/VAG to the API requires coders with access to various cars and the ability to reverse engineer changes and new features into this project. Contributions in the form of raised issues and pull requests are much needed in order to maintain the functionality for all different models of Skoda cars.

Contributors and maintainers will naturally drift away from the project once they either no longer own a Skoda or move away from Home Assistant. As a results, there aren't really any long-term maintainers or contributors still active. But we do what we can to keep the project alive and up to date.

For questions, further help or contributions you can join the Discord server at https://discord.gg/826X9jEtCh.

Skoda Connect

UNOFFICIAL library for communicating with Skoda Connect.

This project is a fork of https://github.com/robinostlund/volkswagencarnet, modified to support Skoda Connect, mimicking the MySkoda mobile app.

This is an API library for Skoda connected cars. The library is reverse engineered by intercepting HTTP requests from MySkoda app, there is no official API. Use at your own risk. If the Skoda API changes, this library may stop working without warning.

While it might work for other use-cases, the primary purpose for this library is to be consumed by the https://github.com/skodaconnect/homeassistant-skodaconnect project.

Information

Retrieve statistics about your Skoda from the Skoda Connect online service.

  • Support for Skoda Connect services
  • Support for SmartLink
  • All (native) Skoda cars supported though newer cars (Skoda Enyaq iV) use newer API that's under development
  • If your Skoda car don't work with the MySkoda app it won't work with this integration

Breaking changes

  • From version 1.1.0 and onwards there has been changes to token handling, login procedure and overall mode streamlined code. Logins should now be significantly faster and reliable.

  • From version 1.0.40 and onwards there has been changes to Skoda API and this might break the integration for some cars.

  • From version 1.0.30 and onwards there might be breaking changes for the combustion heating/climatisation.

  • Parking Heater is the auxiliary/parking heater for non-PHEV vehicles. This uses the "legacy" remotestandheizung API function. Heating is what it sounds like and ventilation is used to ventilate/cool the car.

  • Auxiliary Heater is the auxiliary/parking heater for PHEV vehicles. This uses the climater API function, same as electric climatisation.

Installation

[venv-python3] user@localhost:~
$ pip install skodaconnect

Example

For an extensive example, please use the code found in example/example.py. When logged in the library will automatically create a vehicle object for every car registered to the account. Initially no data is fetched at all. Use the doLogin method and it will signin with the credentials used for the class constructor. Method get_vehicles will fetch vehicle basic information and create Vehicle class objects for all associated vehicles in account. To update all available data use the update_all method of the Connect class. This will call the update function for all registered vehicles, which in turn will fetch data from all available API endpoints.

Attributes

The Vehicle class contains all of the attributes with values fetched from the API. To access a single attribute, please see and use the example/example.py. This will print all available methods, variables and properties as well as a list of supported attributes for discovered car.

Methods

Vehicle, in the following example the car object is an object of Vehicle class:

car.set_charger(action = "start")                          # action = "start" or "stop"
car.set_charger_current(value=<int/str>                    # value = integer 1-255 or Maximum/Reduced (For PHEV: 252=Reduced and 254=Maximum)
car.set_charge_limit(value=<int>)                          # value = integer 0-100 in 10 increments. Valid values is PHEV: 0-50, EV: 50-100.
car.set_battery_climatisation(mode = False)                # mode = False or True
car.set_climatisation(mode = "auxilliary", spin="1234")    # mode = "auxilliary", "electric", "off". SPIN only needed for aux heating
car.set_climatisation_temp(temperature = 22)               # temperature = integer from 16 to 30
car.set_window_heating(action = "start")                   # action = "start" or "stop"
 - car.set_window_heating(action = "enabled")              # action = "enabled/disabled", enable/disable window heating for climatisation
car.set_lock(action = "unlock", spin = "1234")             # action = "unlock" or "lock". spin = SPIN, needed for both
car.set_plug_autounlock(setting = "on")                    # setting = "on"/"off". Enable/disable auto unlock of plug when charged
car.set_pheater(mode = "heating", spin = "1234")           # action = "heating", "ventilation" or "off". spin = SPIN, not needed for off
car.set_charge_limit(limit = 30)                           # limit = 0,10,20,30,40,50
car.set_timer_active(id = 1, action = "on"}                # id = 1, 2, 3, action = "on" or "off".
car.set_timer_schedule(id = 1,  schedule = dict)           # id = 1, 2, 3, see example for full information about schedule variable
car.set_refresh()                                          # Takes no arguments, will trigger force update

Connection:

session = aiohttp.ClientSession(headers={'Connection': 'keep-alive'})   # Create a aiohttp session object
conn = Connection(session, username, password, fulldebug)               #
conn.doLogin()                                                         # Attempt a login, returns true/false, variable conn.
conn.get_vehicles()                                                     # Attempts to fetch all vehicles associated to account.
conn.update_all()                                                       # Calls update for all vehicle objects.
conn.logout()                                                           # Logout from API, call for revoke of tokens.
conn.terminate()                                                        # Terminate session, calls logout().
conn.get<method>                                                        # The get methods calls on API endpoints and returns data. See example.
conn.set<method>                                                        # The set methods calls on API endpoints to set config for vehicle.

Refrain from using methods starting with _, they are intended for internal use only.

Building

We are using a pyproject.toml style of building, with flit. To build your own version of skodaconnect, use the following steps:

  1. Get the current source from GitHub
  2. Make sure you have flit installed:
pip install flit
  1. Build the project
flit build

Thanks to

  • RobinostLund for initial project for Volkswagen Carnet which this is based on initially
  • lendy007 for the initial release for Skoda cars
  • Farfar for modifications related to electric cars
  • tanelvakker for modifications related to correct SPIN handling for various actions and using correct URLs also for MY2021
  • wieshka for help with Skoda Enyaq iV development
  • WebSpider and GAEvakYD from Discord for their help with fixing login form handling

skodaconnect's People

Contributors

badrpc avatar dmakreshanski avatar dvx76 avatar fabaff avatar farfar avatar fbuescher avatar fhempy avatar flopp999 avatar fursov avatar hhoefling avatar jd1 avatar lendy007 avatar loeffelpan avatar pes100a500or avatar phkehl avatar scoutice avatar tanelvakker avatar webspider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skodaconnect's Issues

Unable to install

stuart@ubuntuvm:~$ uname -a
Linux ubuntuvm 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
pip install skodaconnect
Defaulting to user installation because normal site-packages is not writeable
Collecting skodaconnect
  Downloading skodaconnect-1.3.6.tar.gz (63 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.3/63.3 KB 1.9 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      /tmp/pip-install-k92nr5od/skodaconnect_ed028321ff4042638d179a603923d1d0/skodaconnect/connection.py:397: SyntaxWarning: "is" with a literal. Did you mean "=="?
        if user_form.get('type', None) is 'html':
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-k92nr5od/skodaconnect_ed028321ff4042638d179a603923d1d0/setup.py", line 5, in <module>
          from skodaconnect.__version__ import __version__ as lib_version
        File "/tmp/pip-install-k92nr5od/skodaconnect_ed028321ff4042638d179a603923d1d0/skodaconnect/__init__.py", line 7, in <module>
          from skodaconnect.connection import Connection
        File "/tmp/pip-install-k92nr5od/skodaconnect_ed028321ff4042638d179a603923d1d0/skodaconnect/connection.py", line 22, in <module>
          from bs4 import BeautifulSoup
      ModuleNotFoundError: No module named 'bs4'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Add Seat support in this library

Hey.

Right now there are different libraries for VWConnect (which you started from), Skodaconnect and Seatconnect (which started from your work). From what I can see the skodaconnect library has been most actively updated, and from small experimentation it seems that just changing const.py allows for this library to talk to Seatconnect just as well.

Would it be an idea / option to somehow merge some of the work @Farfar has done on @Farfar/seatconnect with this library to have one library that supports both Seat and Skoda?

The updated const file for Seat is basically this:

"""Constants for Seat Connect library."""

BASE_SESSION = 'https://msg.volkswagen.de'
BASE_AUTH = 'https://identity.vwgroup.io'
BRAND = 'seat'
COUNTRY = 'ES'

# Data used in communication
CLIENT = {
    'Legacy': {
        'CLIENT_ID':    '50f215ac-4444-4230-9fb1-fe15cd1a9bcc@apps_vw-dilab_com',     # client id for VWG API, legacy Skoda Connect/MySkoda
        'SCOPE':        'openid mbb profile cars birthdate nickname address phone',
        'TOKEN_TYPES':  'code id_token'
    }
}

XCLIENT_ID = '3516bc10-fabd-4eb2-b41c-b38e21e9d8f6'
XAPPVERSION = '1.2.0'
XAPPNAME = 'SEATConnect'
USER_AGENT = 'okhttp/3.10.0'
APP_URI = 'seatconnect://identity-kit/login'

# Used when fetching data
HEADERS_SESSION = {
    'Connection': 'keep-alive',
    'Content-Type': 'application/json',
    'Accept-charset': 'UTF-8',
    'Accept': 'application/json',
    'X-Client-Id': XCLIENT_ID,
    'X-App-Version': XAPPVERSION,
    'X-App-Name': XAPPNAME,
    'User-Agent': USER_AGENT,
    'tokentype': 'IDK_TECHNICAL'
}

# Used for authentication
HEADERS_AUTH = {
    'Connection': 'keep-alive',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Accept-Encoding': 'gzip, deflate',
    'Content-Type': 'application/x-www-form-urlencoded',
    'x-requested-with': XAPPNAME,
    'User-Agent': USER_AGENT,
    'X-App-Name': XAPPNAME
}

Thanks for all the work you've put into this so far. It made entering my mileage information for work so much easier ;)

Issue with Enyaq last_connected parsing

Hi,

I'm (indirectly) using skodaconnect from Home Assistant. Many thanks for the work by the way, it's great to have this library.

With Enyaq, there is this recurrent issue happening quite often:

File "/usr/local/lib/python3.10/site-packages/skodaconnect/dashboard.py", line 127, in state val = super().state File "/usr/local/lib/python3.10/site-packages/skodaconnect/dashboard.py", line 58, in state if hasattr(self.vehicle, self.attr): File "/usr/local/lib/python3.10/site-packages/skodaconnect/vehicle.py", line 1542, in last_connected last_connected = datetime.strptime(last_connected_utc,'%Y-%m-%dT%H:%M:%S.%fZ').astimezone().replace(tzinfo=None).replace(microsecond=0) TypeError: strptime() argument 1 must be str, not None

Thanks!

please help to add into fhem

can you help me to use this in fhem.
i have install it with putty and pip, but how i can use it?
sorry, i not a expert user ,-)

My car is not listed

Today there was an update or error with Skoda server.
My car didn't show up in Skoda app.
Now I can see my car again in Skoda app, but with Skodaconnect my car is not listed.
Debian 10, python 3.7.3, PyJWT 2.1.0

image

Question: how do you get CONNECT token without username/pw

Hi,

We're currently trying to implement Škoda authentication to Node.js while trying to use a pure oAuth flow. It seems to work fine to get either a CONNECT token OR a TECHNICAL token but we don't see how we can get both without the user having to enter his email + password twice:

APP => Redirect to https://identity.vwgroup.io/oidc/v1/authorize with CONNECT|TECHNICAL client id => User provides email+password => Redirect to APP with code

From my understanding, you only parse the html on https://identity.vwgroup.io/oidc/v1/authorize once and only enter the email+password once to get the first token. How are you able to get the second token? Is it because of a cookie jar?

Hope you can help us figure this out. Thanks a lot!

Implement auto publishing to PyPI

  • #119
  • Deploy to Test PyPI on all pushes to master
  • Mark as pre-release when appropriate. Beta version for Test PyPI
  • Validate version match between release tag and version in code

Got unhandled error from server: 412

Today skodaconnect (Skoda Octavia RS 2019 Model) stopped working with this error:

Login success!
2021-10-14 13:46:52.628594
Fetching vehicles associated with account.
ERROR:skodaconnect.connection:Got unhandled error from server: 412
DEBUG:skodaconnect.connection:Checking vehicle status_code
Traceback (most recent call last):
File "C:\Users\me\PycharmProjects\skodaconnect-1.1.6\skodaconnect\connection.py", line 683, in get_vehicles
vin = vehicle.get('vin', '')
AttributeError: 'str' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/me/PycharmProjects/skodaconnect-1.1.6/example/example.py", line 289, in
loop.run_until_complete(main())
File "C:\Users\me\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:/Users/me/PycharmProjects/skodaconnect-1.1.6/example/example.py", line 130, in main
await connection.get_vehicles()
File "C:\Users\me\PycharmProjects\skodaconnect-1.1.6\skodaconnect\connection.py", line 714, in get_vehicles
raise SkodaLoginFailedException("Unable to fetch associated vehicles for account")
skodaconnect.exceptions.SkodaLoginFailedException: Unable to fetch associated vehicles for account

Process finished with exit code 1

Yesterday I had to login again with my android skoda app... hopefully they did not change anything again ...

No vehicle found

Hi

I would like to use your script. But what I try I get an error about no vehicle. On the MySkoda App I see my Enyaq
Any Idea what could be wrong?

Log:
########################################

Logging on to Skoda Connect

########################################
Initiating new session to Skoda Connect with [email protected] as username
INFO:skodaconnect.connection:Init Skoda Connect library, version 1.1.11
DEBUG:skodaconnect.connection:Using service https://msg.volkswagen.de
Attempting to login to the Skoda Connect service
2021-11-05 11:11:15.081136
INFO:skodaconnect.connection:Initiating new login
DEBUG:skodaconnect.connection:Starting authorization process for client skoda
DEBUG:skodaconnect.connection:Got redirect to signin-service
DEBUG:skodaconnect.connection:Start authorization for user [email protected]
DEBUG:skodaconnect.connection:Finalizing login
DEBUG:skodaconnect.connection:Received authorization code, exchange for tokens.
DEBUG:skodaconnect.connection:Verifying token for f9a2359a-b776-46d9-bd0c-db1904343117@apps_vw-dilab_com
DEBUG:skodaconnect.connection:Token for skoda verified OK.
Login success!
2021-11-05 11:11:16.890504
Fetching vehicles associated with account.
DEBUG:skodaconnect.connection:Client "connect" token is missing, call to authorize the client.
DEBUG:skodaconnect.connection:Starting authorization process for client connect
DEBUG:skodaconnect.connection:Received authorization code, exchange for tokens.
DEBUG:skodaconnect.connection:Verifying token for 7f045eee-7003-4379-9968-9355ed2adb06@apps_vw-dilab_com
DEBUG:skodaconnect.connection:Token for connect verified OK.
DEBUG:skodaconnect.connection:Request for "https://profileintegrityservice.apps.emea.vwapps.io/iaa/pic/v1/users/146229d6-e583-429f-9624-980185a7269b/check-profile" returned with status code [200]
DEBUG:skodaconnect.connection:Consent returned {'consentInfo': {'scopeId': 'commonMandatoryFields', 'ssoId': '146229d6-e583-429f-9624-980185a7269b', 'missingMandatoryFields': [], 'mbbUserId': '0TuRRJZZAXFR5dYwbdlWNmR4AQG', 'mbbIdStatus': True, 'mandatoryFieldsStatus': True, 'spinStatus': True, 'mandatoryConsentInfo': [{'id': 'termsOfUse', 'status': 'VALID'}]}}
DEBUG:skodaconnect.connection:User consent is valid, no missing information for profile
DEBUG:skodaconnect.connection:Got non HTTP related error: Cannot connect to host api.connect.skoda-auto.cz:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)')]
DEBUG:skodaconnect.connection:Skoda native API returned no vehicles. Using fallback VW-Group API.
DEBUG:skodaconnect.connection:Client "vwg" token is missing, call to authorize the client.
DEBUG:skodaconnect.connection:Trying to fetch api tokens.
DEBUG:skodaconnect.connection:Verifying token for mal.prd.ece.vwg-connect.com
DEBUG:skodaconnect.connection:VW-Group API token verified OK.
DEBUG:skodaconnect.connection:Request for "https://msg.volkswagen.de/fs-car/usermanagement/users/v1/skoda/CZ/vehicles" returned with status code [200]
Traceback (most recent call last):
File "example.py", line 289, in
loop.run_until_complete(main())
File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "example.py", line 130, in main
await connection.get_vehicles()
File "C:\Users\Werner\Downloads\skodaconnect-1.1.11\skodaconnect-1.1.11\skodaconnect\connection.py", line 690, in get_vehicles
if response.get('userVehicles', {}).get('vehicle', False):
AttributeError: 'NoneType' object has no attribute 'get'

Enyaq - wrong information

Seat Heating - (seat_heating)
str_state: On - state: True
attributes: {'last_result': 'None'}

I tried to start the climate with and without seat heat ON, it says "str_state: On - state: True" both times

Do you see anything wrong in the code?

Trying to set chargeMinLimit

Hi and thanks for your great work in this matter.
I'd like to set the mimimum value of SOC, so I've been trying to enable the departureTimer part in the code. I was succesful in reading it but I couldn't set the mimimum value of soc. It always replys 'Bad Request'. I've tried all the possible requests that I can imagine but no luck.
The url I'm sending the request is: 'fs-car/bs/departuretimer/v1/Seat/ES/vehicles/$vin/timer/actions'
and I think the type of action is : 'setChargeMinLimit' (I've used inverse engineering for that)
The request is supposed to be: {'action': {'type': 'setChargeMinLimit','timersAndProfiles': {'timerBasicSetting': {'chargeMinLimit': int(value)}}}}
Any clue that could help me??
Thank you in advance

No data due to "deactivation"?

Hi,
i'm using the latest commit of skodaconnect and importing farfar/seatconnect to connect to my Mii electric BEV. Although the code is running I do not get any data (except for the static data VIN, Model, etc.).
Logging shows me this:

DEBUG:seatconnect.connection:Going to call vehicle updates
INFO:seatconnect.vehicle:Vehicle with VIN VSSZZZAAXXX123456 is deactivated from Seat Connect

but I cant figure out what that means. Data in my iPhone Seat Connect app and on the web is available and gets updated.
Its not a number of requests issue as this is shown even if I do not any data updates for a whole day. Any clues?
BR, A

Error 429: Token exchange failed

Since todays Skoda Connect outage I receive an error 429 with the DEBUG error message „Token exchange failed“.

This happens with TOKENS set and with TOKENS = NONE.

It appears that it is not possible to get a TECHNICAL token.

The MySkoda app is working again meanwhile.

Preheater actions failing

In version 1.0.30 this was working just fine, but the following commit (98b5118) breaks this functionality. {BRAND}/{COUNTRY} does not get subsituted for skoda/CZ in the request url. When hardcoding it in line 851 of connection.py the preheater functions as expected again.

Other requests, such as fetching status seem to work just fine according to the log though.

Working:

DEBUG (MainThread) [skodaconnect.connection] HTTP POST "https://msg.volkswagen.de/fs-car/bs/rs/v1/skoda/CZ/vehicles/vin/action"
DEBUG (MainThread) [skodaconnect.connection] Request for "https://msg.volkswagen.de/fs-car/bs/rs/v1/skoda/CZ/vehicles/vin/action" returned with status code [202], response: {'performActionResponse': {'requestId': '19643149', 'vin': 'vin'}, 'rate_limit_remaining': '14'}

Not working:

DEBUG (MainThread) [skodaconnect.connection] HTTP POST "https://msg.volkswagen.de/fs-car/bs/rs/v1/{BRAND}/{COUNTRY}/vehicles/vin/action"
ERROR (MainThread) [skodaconnect.connection] Bad request
WARNING (MainThread) [skodaconnect.vehicle] Failed to set parking heater mode to heating - Invalid or no response
  File "/config/custom_components/skodaconnect/switch.py", line 32, in async_turn_on
  File "/usr/local/lib/python3.8/site-packages/skodaconnect/dashboard.py", line 526, in turn_on
  File "/usr/local/lib/python3.8/site-packages/skodaconnect/vehicle.py", line 431, in set_pheater

I own a Skoda Enyaq

I can get some charging data but not so much more, since Skoda has not make all available.

When I run example.py I do get some data that might help you to develop this script.

DEBUG:skodaconnect.vehicle:Creating Vehicle class object with data {'vin': 'xxxxxxxxxxxxxxxx', 'connectivities': ['REMOTE'], 'capabilities': ['DCS', 'AUTOMATION', 'CHARGING', 'CHARGING_STATIONS', 'AIR_CONDITIONING', 'DESTINATIONS', 'FUEL_STATUS', 'MAP_UPDATE', 'ONLINE_SPEECH', 'PARKING_INFORMATION', 'ROUTING', 'TRAFFIC_INFORMATION', 'WEB_RADIO'], 'specification': {'title': 'ŠKODA ENYAQ iV', 'brand': 'ŠKODA', 'model': 'ENYAQ iV', 'body': 'SUV', 'systemCode': 'ENYAQ iV 60 132/62 E1H', 'systemModelId': '5AZFF2', 'engine': {'type': 'iV', 'powerInKW': 132}, 'battery': {'capacityInKWh': 62}, 'gearbox': {'type': 'E1H'}, 'trimLevel': '60', 'manufacturingDate': '2021-mm-dd', 'devicePlatform': 'WCAR', 'maxChargingPowerInKW': 100}, 'nickname': None, 'deactivated': False}

Is this something that you can use?

My thought is that you use CHARGING in here https://github.com/lendy007/skodaconnect/blob/37a7dd905ca9416ee3508b435b671ccaced59bf1/skodaconnect/vehicle.py#L80.
so maybe it possible to add all above from capabilities, like DCS, FUEL_STATUS etc?

my own code giving "Failed to authorize client skoda"

I am using your code inside my own code for Domoticz.

When I start Domoticz I get this error, if I restart my code it start to work. So my code is working and I am trying to find a way to solve the error.

Do you know a command that I can use with your code to restart the get_vehicles?

Thanks

Traceback (most recent call last):
File "/home/debian/domoticz/plugins/Skoda/plugin.py", line 70, in main
await connection.get_vehicles()
File "/usr/local/lib/python3.9/dist-packages/skodaconnect/connection.py", line 670, in get_vehicles
await self.set_token('skoda')
File "/usr/local/lib/python3.9/dist-packages/skodaconnect/connection.py", line 1666, in set_token
raise SkodaAuthenticationException(f'Failed to authorize client {client}')
skodaconnect.exceptions.SkodaAuthenticationException: Failed to authorize client skoda
<class 'skodaconnect.exceptions.SkodaAuthenticationException'>

Error when Execute Example.py

This is what i get:

python3 example.py

DEBUG:asyncio:Using selector: EpollSelector
Initiating new session to Skoda Connect with [email protected] as username
DEBUG:skodaconnect.connection:Using service https://msg.volkswagen.de
Attempting to login to the Skoda Connect service
Traceback (most recent call last):
File "example.py", line 205, in
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 101, in main
if await connection.doLogin():
AttributeError: 'Connection' object has no attribute 'doLogin'

I only filled in my credentials and thought there should be a result.

Enyaq: token exchange fails

As of today for Enyaq:

########################################
#      Logging on to Skoda Connect     #
########################################
Initiating new session to Skoda Connect with [email protected] as username
INFO:skodaconnect.connection:Init Skoda Connect library, version 1.2.5
DEBUG:skodaconnect.connection:Using service https://msg.volkswagen.de
Attempting to login to the Skoda Connect service
2023-01-01 17:44:04.262910
INFO:skodaconnect.connection:Initiating new login
DEBUG:skodaconnect.connection:Starting authorization process for client skoda
DEBUG:skodaconnect.connection:Got redirect to signin-service
DEBUG:skodaconnect.connection:Start authorization for user ...
DEBUG:skodaconnect.connection:Found dynamic credentials form, extracting attributes
DEBUG:skodaconnect.connection:JSON: ...
DEBUG:skodaconnect.connection:Finalizing login
DEBUG:skodaconnect.connection:Received authorization code, exchange for tokens.
ERROR:skodaconnect.connection:An API error was encountered during login, try again later
Traceback (most recent call last):
  File "/Users/andig/htdocs/evcc/test.py", line 319, in <module>
    loop.run_until_complete(main())
  File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/andig/htdocs/evcc/test.py", line 154, in main
    if await connection.doLogin():
  File "/opt/homebrew/lib/python3.10/site-packages/skodaconnect/connection.py", line 136, in doLogin
    return await self._authorize('skoda')
  File "/opt/homebrew/lib/python3.10/site-packages/skodaconnect/connection.py", line 276, in _authorize
    raise SkodaException(f'Token exchange failed. Request status: {req.status}')
skodaconnect.exceptions.SkodaException: Token exchange failed. Request status: 400

I'm having the same issue in evcc-io/evcc#5647

Code/ID Token are received but exchange via POST https://tokenrefreshservice.apps.emea.vwapps.io/exchangeAuthCode fails:

HTTP/2.0 400 Bad Request
Content-Length: 76
Content-Type: application/json
Date: Sun, 01 Jan 2023 16:46:33 GMT

{"description":"Invalid identity token.","errorCode":"REQUEST_DATA_INVALID"}

The requets looks as I'd expect it.

Charging cable locked showing wrong data

Request for "https://api.connect.skoda-auto.cz/api/v1/charging/TMBXXXXXX/status" returned with status code [200], response: {'plug': {'connectionState': 'Connected', 'lockState': 'Unlocked'}

DEBUG:skodaconnect.connection:Got vehicle data {'plug': {'connectionState': 'Connected', 'lockState': 'Unlocked'}

TMBJXxxxxxxxxxxxx Charging cable locked - (charging_cable_locked)
str_state: Locked - state: None
attributes: {}

https://github.com/lendy007/skodaconnect/blob/d86ce730199fdb66ec91c01cfc38b0ce094477ee/skodaconnect/dashboard.py#L145

https://github.com/lendy007/skodaconnect/blob/6525f3d112cb8be52dc190a72fc039de389b7801/skodaconnect/vehicle.py#L1037

Transfer ownership

Hi @lendy007,

I couldn't find any other way of contacting you.
To further improve and maintain this code I need to be able to add new members.
Easiest way forward, since maintainers probably will change in the future as well, is if you can transfer ownership to me so I can add new members as well.

-BR

TypeError: getRealCarData() takes 1 positional argument but 2 were given

I am finding some trouble after the initial data fetch with an Enyaq, which results in the following output

########## 09:54:23 AM - NEW LOOP ##########
TMBJC7NY1MFxxxxxx Charging time left - (charging_time_left)
	str_state: 0 h - state: 0
	attributes: {}

TMBJC7NY1MFxxxxxx Electric range - (electric_range)
	str_state: 344 km - state: 344
	attributes: {}

TMBJC7NY1MFxxxxxx Battery level - (battery_level)
	str_state: 78 % - state: 78
	attributes: {}

TMBJC7NY1MFxxxxxx External power - (external_power)
	str_state: On - state: True
	attributes: {}

TMBJC7NY1MFxxxxxx Charging cable connected - (charging_cable_connected)
	str_state: Charging - state: True
	attributes: {}

TMBJC7NY1MFxxxxxx Charging - (charging)
	str_state: Off - state: 0
	attributes: {'last_result': ''}

TMBJC7NY1MFxxxxxx Charging cable locked - (charging_cable_locked)
	str_state: Locked - state: None
	attributes: {}

Sleeping for 20 seconds
Updating ALL values from Skoda Connect...
Success!
Updating INDIVIDUAL values for TMBJC7NY1MFxxxxxx...
Updating carportdata...
Updating charger data...
Updating climater data...
Updating position data...
Updating pre-heater data...
Updating realcardata...
Traceback (most recent call last):
  File "skoda.py", line 315, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "skoda.py", line 285, in main
    await vehicle.get_realcardata()
  File "xxxxxxx/skodaconnect/vehicle.py", line 154, in get_realcardata
    data = await self._connection.getRealCarData(self.vin)
TypeError: getRealCarData() takes 1 positional argument but 2 were given

Phyton Error

Hello i try to use these code with Phyton3.9

at "Departure timer 1 departure1 "
-->
Traceback (most recent call last):
File "/var/www/html/callskoda.py", line 240, in
loop.run_until_complete(main())
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/var/www/html/callskoda.py", line 204, in main
print(f'{instrument.full_name} {instrument.attr} - ({val})\tstr_state: ({instrument.str_state})\tattributes: {instrument.attributes}')
File "/var/www/html/skodaconnect/dashboard.py", line 295, in str_state
str(datetime.strptime(ts,'%Y-%m-%dT%H:%M:%SZ').astimezone(tz=None)) if ts else None,
TypeError: strptime() argument 1 must be str, not datetime.datetime

any Idee?
with python Version are used?

lg
Heinz

Charging cable connected showing wrong data

response from myskoda
Request for "https://api.connect.skoda-auto.cz/api/v1/charging/TMBJBxxxxxxxxxxxx/status" returned with status code [200], response: {'plug': {'connectionState': 'Connected'

DEBUG:skodaconnect.connection:Got vehicle data {'plug': {'connectionState': 'Connected',

printout

TMBXXXXXXXXX Charging cable connected - (charging_cable_connected)
        str_state: Charging - state: True
        attributes: {}

cable is connected but it doesn't charge right now, variable "instrument.str_state" seems to be wrong.

can it be this row?
https://github.com/lendy007/skodaconnect/blob/d86ce730199fdb66ec91c01cfc38b0ce094477ee/skodaconnect/dashboard.py#L149

Login issue with Skoda CityGo

This is what the debug log shows for current master:

DEBUG:skodaconnect.connection:Failed to verify connect token, error: module 'jwt.algorithms' has no attribute 'RSAAlgorithm'
DEBUG:skodaconnect.connection:The Connect services token is invalid
ERROR:skodaconnect.connection:Failed to fetch VW-Group API tokens, Invalid connect token

Syntax error v1.1.10

Hello, I receive error when I try run example from github on ubuntu.

Do you have any idea where is problem?

Thanks

$ ./example.py 
Traceback (most recent call last):
  File "./example.py", line 17, in <module>
    from skodaconnect import Connection
  File "skodaconnect/skodaconnect/__init__.py", line 7, in <module>
    from skodaconnect.connection import Connection
  File "<fstring>", line 1
    (await req.text())
             ^
SyntaxError: invalid syntax
$ python3 --version
Python 3.6.9

Implement flexible poll frequency

Summarizing some Discord discussions so they are visible outside of discord.

Following multiple problems where the Skoda/VW APIs go down (HTTP 500) or temporarily block requests (HTTP 429) there is a desire to allow more flexibility in how poll frequency works.

Two ideas being explored:

  1. Allow to update the configured poll frequency through a service call
  2. Allow the poll itself to be triggered through a service call. In this case auto-polling would be completely disabled.

In both cases the goal is to allow for example to reduce poll frequency during periods where the user doesn't care about up-to-date data (e.g. at night).

after using example.py once - some data in the app got deleted

i used the example.py once and was successfully able to login and get info.
later i checked the app on my mobile refreshed the main screen and it showed an error saying "car deleted", clicking ok most information was still there but the dealer setting was gone.
do you know what could be the reason for this?

Škoda Enyaq - start / stop for charge does not work

Hi @lendy007, thanks for this package,

Trying to figure out why start/stop commands are not working on my Enyaq, and wanted to ask what's the status around this functionality from your side?

At the same time, in MyŠkoda app, which, I assume, uses the very same API, start/stop buttons for charging are working.

Eager to help, just let me know how can I help.

Exception on Dashboard is_parking_light_supported

See attached File
skodaconnect_exception.txt

########################################

Setting up dashboard

########################################
Traceback (most recent call last):
File "C:\Users\User.p2\pool\plugins\org.python.pydev.core_10.0.1.202210281537\pysrc\pydevd.py", line 3477, in
main()
File "C:\Users\User.p2\pool\plugins\org.python.pydev.core_10.0.1.202210281537\pysrc\pydevd.py", line 3470, in main
globals = debugger.run(setup['file'], None, None, is_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User.p2\pool\plugins\org.python.pydev.core_10.0.1.202210281537\pysrc\pydevd.py", line 2507, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User.p2\pool\plugins\org.python.pydev.core_10.0.1.202210281537\pysrc\pydevd.py", line 2514, in _exec
globals = pydevd_runpy.run_path(file, globals, 'main')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User.p2\pool\plugins\org.python.pydev.core_10.0.1.202210281537\pysrc_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User.p2\pool\plugins\org.python.pydev.core_10.0.1.202210281537\pysrc_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\User.p2\pool\plugins\org.python.pydev.core_10.0.1.202210281537\pysrc_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "U:\Projekte\Raspberry PI\Workspace\WallboxController_Python\src\skoda_connect_example_1_1_26.py", line 293, in
loop.run_until_complete(main())
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "U:\Projekte\Raspberry PI\Workspace\WallboxController_Python\src\skoda_connect_example_1_1_26.py", line 142, in main
dashboard = vehicle.dashboard(mutable=True, miles=MILES)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "U:\Projekte\Raspberry PI\Workspace\Github\scoutice_skodaconnect\skodaconnect\vehicle.py", line 1197, in dashboard
self._dashboard = Dashboard(self, **config)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "U:\Projekte\Raspberry PI\Workspace\Github\scoutice_skodaconnect\skodaconnect\dashboard.py", line 1422, in init
self.instruments = [
^
File "U:\Projekte\Raspberry PI\Workspace\Github\scoutice_skodaconnect\skodaconnect\dashboard.py", line 1425, in
if instrument.setup(vehicle, **config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "U:\Projekte\Raspberry PI\Workspace\Github\scoutice_skodaconnect\skodaconnect\dashboard.py", line 31, in setup
if not self.is_supported:
^^^^^^^^^^^^^^^^^
File "U:\Projekte\Raspberry PI\Workspace\Github\scoutice_skodaconnect\skodaconnect\dashboard.py", line 68, in is_supported
if hasattr(self.vehicle, supported):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "U:\Projekte\Raspberry PI\Workspace\Github\scoutice_skodaconnect\skodaconnect\vehicle.py", line 1374, in is_parking_light_supported
if 'overallStatus' in self.attrs.get('vehicle_remote', {}).get('lights', {}):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

activate DEBUG

I am using skodaconnect in my own python script.

After ~9 hours it fails.

Where can I find log files and how can I activate DEBUG mode?

Window-Heater not working for Skoda Enyaq

hi there. i think t the dection of the window-heater for the skoda enyaq. does not work. here i have an examle of the full debug-log:

here it is off (this is correct)

DEBUG:skodaconnect.connection:Request for "https://api.connect.skoda-auto.cz/api/v1/air-conditioning/<VIN>/settings" returned with status code [200] DEBUG:skodaconnect.connection:Request for "https://api.connect.skoda-auto.cz/api/v1/air-conditioning/<VIN>/status" returned with status code [200] INFO:skodaconnect.connection:Returning with data {'airConditioning': {'remainingTimeToReachTargetTemperatureInSeconds': 0, 'state': 'Off', 'trigger': 'OFF', 'windowsHeatingStatuses': [{'windowLocation': 'Front', 'state': 'Off'}, {'windowLocation': 'Rear', 'state': 'Off'}], 'seatHeatingSupport': {'frontLeftAvailable': True, 'frontRightAvailable': True, 'rearLeftAvailable': False, 'rearRightAvailable': False}}, 'airConditioningSettings': {'targetTemperatureInKelvin': 295.15, 'temperatureConversionTableUsed': 'CELSIUS_KELVIN', 'airConditioningAtUnlock': False, 'windowHeatingEnabled': True, 'zonesSettings': {'frontLeftEnabled': True, 'frontRightEnabled': False}}} but here it was turned on before: DEBUG:skodaconnect.connection:Request for "https://api.connect.skoda-auto.cz/api/v1/air-conditioning/<VIN>/settings" returned with status code [200] DEBUG:skodaconnect.connection:Request for "https://api.connect.skoda-auto.cz/api/v1/air-conditioning/<VIN>/status" returned with status code [200] INFO:skodaconnect.connection:Returning with data {'airConditioning': {'remainingTimeToReachTargetTemperatureInSeconds': 0, 'state': 'Off', 'trigger': 'OFF', 'windowsHeatingStatuses': [{'windowLocation': 'Front', 'state': 'On'}, {'windowLocation': 'Rear', 'state': 'On'}], 'seatHeatingSupport': {'frontLeftAvailable': True, 'frontRightAvailable': True, 'rearLeftAvailable': False, 'rearRightAvailable': False}}, 'airConditioningSettings': {'targetTemperatureInKelvin': 295.15, 'temperatureConversionTableUsed': 'CELSIUS_KELVIN', 'airConditioningAtUnlock': False, 'windowHeatingEnabled': True, 'zonesSettings': {'frontLeftEnabled': True, 'frontRightEnabled': False}}}
as you can see, the window-front-state is "on".

however, in both cases the vehicle dasboard says "off"
<VIN>Window Heater - (window_heater) str_state: Off - state: False attributes: {'last_result': 'None', 'last_timestamp': '1970-01-01T00:00:00'}
did I miss something? i have not tried yet to set it using the API, but this would be the next step (as my python is very bad, i always test it reading first)

1.1.0 getOperationsList issue

Hi,

unfortunately I get the following error with 1.1.0

2021-09-04 09:09:06,434 - ERROR    - skodaconnect.connection: Got HTTP 400 400, message='Bad Request', url=URL('https://msg.volkswagen.de/api/rolesrights/operationlist/v3/vehicles/xxxxxxxxxx')"Bad Request" from server, this request might be malformed or not implemented correctly for this vehicle

I couldn't get the root cause of this one, maybe it has something to do with the new token handling?

Skoda Connect Lite support ?

https://www.skoda-auto.com/connectivity/skoda-connect-lite

I have a Kodiaq and a Enyaq where i use this Skoda Connect integration. But i jus saw a commercial for the above Skoda Connect Lite that consists of an ODB dongle and a seperate Skoda Lite App (Has the MySkoda and My Skoda Essential already - and only the later support both cars.)

But would be interested in getting our older Citigo into HA as well

DataPlug for Connect LITE 000051629A (<40€in the Czech Republic)

No vehicles found

I can successfully authenticate and login, however it is not returning any vehicles. The debug log shows

DEBUG:connection:Using service https://msg.volkswagen.de
Attempting to login to the Skoda Connect service
DEBUG:connection:Got authorization endpoint, logging on.
DEBUG:connection:Authenticating with email and password.
DEBUG:connection:Parsing login response.
DEBUG:connection:Login successful, received authorization code.
DEBUG:connection:Trying to fetch user identity tokens.
DEBUG:connection:User identity token verified OK.
DEBUG:connection:Trying to fetch api tokens.
DEBUG:connection:VW-Group API token verified OK.
DEBUG:connection:Fetching vehicles associated with accounts
DEBUG:connection:HTTP GET "https://msg.volkswagen.de/fs-car/usermanagement/users/v1/skoda/GB/vehicles"
DEBUG:connection:Request for "https://msg.volkswagen.de/fs-car/usermanagement/users/v1/skoda/GB/vehicles" returned with status code [200]
ERROR:connection:Login failed for skoda account, 'NoneType' object has no attribute 'get'

So I added _LOGGER.debug(loaded_vehicles) to line 274 of connection.py and it logs out DEBUG:connection:{'userVehicles': None}.

I have an Enyaq that I can access via the Skoda Connect website and MySkoda app, so i'm not sure why it would not show any vehicles here?

Login failed with latest v1.2.3 release

Login failed. Error messages below.

Integration -> Retrying setup: 'NoneType' object has no attribute 'get'
Log -> Config entry 'xxxxxxxxxxxxxxxxx' for skodaconnect integration not ready yet: 'NoneType' object has no attribute 'get'; Retrying in background

Package update requested

Hi,

could you please update the pip package to version 0.1.43. Unfortunately there were some bugs in the 0.1.42 version related to climatisation which doesn't allow to activate it (e.g. set_climater instead of _set_climater).

Many thanks for your work!

Example code not working

Hey!

You made a pull request to my repo some time ago, but I still stuck with my own implementation. Since your implementation seems to be much more detailed, I would like to use your library for my project. Unfortunately, the example code does not work (and I also could not find any other documentation:

$ ./example.py
Traceback (most recent call last):
  File "./example.py", line 81, in <module>
    - window_heater
NameError: name 'charging_cable_connected' is not defined
$

Could you please help?

pheater "off" and honkandflash error

Switching pheater off vehicle.set_pheater(mode="off", spin="1234") results in error:
ERROR - skodaconnect.connection: Unhandled HTTP exception: 403, message='Forbidden', url=URL('https://msg.volkswagen.de/fs-car/bs/rs/v1/skoda/CZ/vehicles/Tasdfasdfasasdfasdfasdfasf3/action')

heating or ventilation on are ok, only off does not work.

Switching honkandflash vehicle.set_honkandflash(action = "flash") results in error:
WARNING:skodaconnect.vehicle:Failed to flash vehicle - name 'latitude' is not defined

Update all vs. individual API endpoints

In the example.py 'while' loop you first "Updating ALL values from Skoda Connect..." then "Sleep for a given amount of time and update individual API endpoints for each vehicle". Do I need to do both to get updates, or if I just would like to get some specific instrument data, can I skip the connection.update() that updates ALL values and only update individual instrument API?

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.