CJNE / pyporscheconnectapi

Python client library for Porsche Connect API
MIT License
44 stars 9 forks source link

porscheconnectapi not working anymore. #12

Closed Jmi91 closed 2 years ago

Jmi91 commented 2 years ago

Hi, It's seems that something has changed in Porsche server side. The API is not working anymore now. Any idea ? Thanks.

CJNE commented 2 years ago

Hi, I just tried and it seems to be working for me. Any error message? Try to run the cli with the debug flag.

Jmi91 commented 2 years ago

I tried your python example:

python3.9 ./test.py VIN: WP0ZZZY1ZMSAXXXXX Model: Taycan Turbo S Year: 2021 Traceback (most recent call last): File "/tmp/./test.py", line 21, in loop.run_until_complete(vehicles()) File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/tmp/./test.py", line 16, in vehicles print(f"Battery at {data['carControlData']['batteryLevel']['value']}%") KeyError: 'carControlData' Unclosed client session client_session: <aiohttp.client.ClientSession object at 0xb5e9d7d8> Unclosed connector connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0xb554d238>, 4812048.479046023)]', '[(<aiohttp.client_proto.ResponseHandler object at 0xb5e2a9e8>, 4812048.819188623)]', '[(<aiohttp.client_proto.ResponseHandler object at 0xb5e01778>, 4812048.882643585)]', '[(<aiohttp.client_proto.ResponseHandler object at 0xb5ea8ef8>, 4812049.87320261)]'] connector: <aiohttp.connector.TCPConnector object at 0xb5e9d7f0>

Also, here is the result with porschecli:

/usr/local/bin/porschecli -e "MYEMAIL" -p "MYPASSWD" overview -v "WP0ZZZY1ZMSAXXXXX" { "vin": "WP0ZZZY1ZMSAXXXXX", "oilLevel": null, "fuelLevel": null, "batteryLevel": null, "remainingRanges": { "conventionalRange": null, "electricalRange": null }, "mileage": null, "parkingLight": "INVALID", "parkingLightStatus": null, "parkingBreak": "INVALID", "parkingBreakStatus": null, "doors": { "frontLeft": "INVALID", "frontRight": "INVALID", "backLeft": "INVALID", "backRight": "INVALID", "frontTrunk": "INVALID", "backTrunk": "INVALID", "overallLockStatus": "CLOSED_LOCKED" }, "serviceIntervals": { "oilService": null, "inspection": null }, "tires": { "frontLeft": { "currentPressure": null, "optimalPressure": null, "differencePressure": null, "tirePressureDifferenceStatus": "UNKNOWN" }, "frontRight": { "currentPressure": null, "optimalPressure": null, "differencePressure": null, "tirePressureDifferenceStatus": "UNKNOWN" }, "backLeft": { "currentPressure": null, "optimalPressure": null, "differencePressure": null, "tirePressureDifferenceStatus": "UNKNOWN" }, "backRight": { "currentPressure": null, "optimalPressure": null, "differencePressure": null, "tirePressureDifferenceStatus": "UNKNOWN" } }, "windows": { "frontLeft": "INVALID", "frontRight": "INVALID", "backLeft": "INVALID", "backRight": "INVALID", "roof": "INVALID", "maintenanceHatch": "INVALID", "sunroof": { "status": "INVALID", "positionInPercent": null } }, "parkingTime": null, "overallOpenStatus": "CLOSED" }

I have no more information about batteryLevel and remainingRanges.electricalRange.distance

CJNE commented 2 years ago

Can you check that you have the permissions required? Is it possible that your Porsche Connect service hasn't been renewed? I have pushed a small update to let you check permission using the CLI: ./cli.py permisssions --all

Jmi91 commented 2 years ago

python3.9 ./cli.py permissions -a { "userIsActive": true, "userRoleStatus": "ENABLED" }

Don't you think it has something to do with the recent migration of the porsche services to new servers/new services ?

Jmi91 commented 2 years ago

So I don't know why but it is working today. I think it was a server side problem. So you can close this ticket. Thanks Regards.

CJNE commented 2 years ago

Good to hear!