Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIs changed? #46

Open
augmentedtraffic opened this issue Jun 11, 2024 · 94 comments
Open

APIs changed? #46

augmentedtraffic opened this issue Jun 11, 2024 · 94 comments
Labels
breaking Breaking Changes

Comments

@augmentedtraffic
Copy link

On the web site there was a notice about upcoming changes and now when I issue a request I still get data but no useful values
vehicles = await client.getVehicles()
for vehicle in vehicles:
print(json.dumps(vehicle, indent=2))
vins = map(lambda v: v["vin"], vehicles)
for vin in vins:
data = await client.getCurrentOverview(vin)
print(json.dumps(data, indent=2))

Just wondering if anyone else is seeing this?

VIN: xxxxModel: None Year: None
datat is {'vin': 'xxx', 'oilLevel': None, 'fuelLevel': None, 'batteryLevel': None, 'remainingRanges': {'conventionalRange': None, 'electricalRange': None}, 'mileage': None, 'parkingLight': 'INVALID', 'parkingLightStatus': None, 'parkingBreak': 'INVALID', 'parkingBreakStatus': None, 'doors': {'frontLeft': 'INVALID', 'frontRight': 'INVALID', 'backLeft': 'INVALID', 'backRight': 'INVALID', 'frontTrunk': 'INVALID', 'backTrunk': 'INVALID', 'overallLockStatus': 'CLOSED_LOCKED'}, 'serviceIntervals': {'oilService': None, 'inspection': None}, 'tires': {'frontLeft': {'currentPressure': None, 'optimalPressure': None, 'differencePressure': None, 'tirePressureDifferenceStatus': 'UNKNOWN'}, 'frontRight': {'currentPressure': None, 'optimalPressure': None, 'differencePressure': None, 'tirePressureDifferenceStatus': 'UNKNOWN'}, 'backLeft': {'currentPressure': None, 'optimalPressure': None, 'differencePressure': None, 'tirePressureDifferenceStatus': 'UNKNOWN'}, 'backRight': {'currentPressure': None, 'optimalPressure': None, 'differencePressure': None, 'tirePressureDifferenceStatus': 'UNKNOWN'}}, 'windows': {'frontLeft': 'INVALID', 'frontRight': 'INVALID', 'backLeft': 'INVALID', 'backRight': 'INVALID', 'roof': 'INVALID', 'maintenanceHatch': 'INVALID', 'sunroof': {'status': 'INVALID', 'positionInPercent': None}}, 'parkingTime': None, 'overallOpenStatus': 'CLOSED', 'chargingStatus': None, 'carModel': None, 'engineType': None, 'chargingState': None}

IN: WP0CD2A9XRS257470 Model: None Year: None
{
"vin": "xxx",
"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",
"chargingStatus": null,
"carModel": null,
"engineType": null,
"chargingState": null
}

thanks

@fredriklj
Copy link
Collaborator

Indeed, the APIs we used to rely on are retired. So the current version if this library is completely defunct. I've had a first stab at the new APIs in this branch:

https://github.com/CJNE/pyporscheconnectapi/tree/new_api

It currently only supports authentication and retrieving capabilities and status.

@augmentedtraffic
Copy link
Author

OK I can get some valid data - looks like some changes in the JSON but will explore and see what I can for my use cases - thanks and I will let you know if it works

@fredriklj fredriklj added the breaking Breaking Changes label Jun 18, 2024
@fredriklj
Copy link
Collaborator

Can someone with am ICE-based drivetrain please post the output data from the 'overview' command (vin, location etc. redacted) using new_api branch? Would be most helpful, as I only have access to data from an EV.

@augmentedtraffic
Copy link
Author

two ICEs - some parts redacted hope this helps - I think some things are slightly different even between the two cars.

{
"vin": "editted",
"modelName": "Panamera editted",
"customName": "",
"modelType": {
"code": "97AFR1",
"year": "2023",
"body": "SEDAN",
"generation": "G2",
"model": "PANAMERA",
"engine": "COMBUSTION"
},
"systemInfo": {
"driverExperience": "0.5",
"privacyStyle": 1
},
"exteriorColorName": "Volcano Grey Metallic/Volcano Grey Metallic",
"color": {
"primaryExteriorColor": "252625"
},
"connect": true,
"greyConnectStoreURL": "https://connect-store.porsche.com",
"timestamp": "2024-06-19T23:15:01Z",
"commands": [],
"measurements": [
{
"key": "OPEN_STATE_TOP",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "CHARGING_PROFILES",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "E_RANGE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_SERVICE_FLAP",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "BATTERY_CHARGING_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "CHARGING_SUMMARY",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "BATTERY_LEVEL",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_CHARGE_FLAP_LEFT",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_SPOILER",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_CHARGE_FLAP_RIGHT",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "DEPARTURES",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "REMOTE_ACCESS_AUTHORIZATION",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:01Z",
"isEnabled": true
}
},
{
"key": "GLOBAL_PRIVACY_MODE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:01Z",
"isEnabled": false
}
},
{
"key": "CLIMATIZER_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "TIMERS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "HEATING_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "BLEID_DDADATA",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "ACV_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "FUEL_RESERVE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:01Z",
"percent": 15
}
},
{
"key": "THEFT_STATE",
"status": {
"isEnabled": false,
"cause": "LICENSE_DEACTIVATED"
}
},
{
"key": "ALARM_STATE",
"status": {
"isEnabled": false,
"cause": "LICENSE_DEACTIVATED"
}
},
{
"key": "VTS_MODES",
"status": {
"isEnabled": false,
"cause": "LICENSE_DEACTIVATED"
}
},
{
"key": "GPS_LOCATION",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T22:27:17Z",
"location": "editted",
"direction": 341
}
},
{
"key": "PAIRING_CODE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "MILEAGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"kilometers": 12130
}
},
{
"key": "OIL_SERVICE_RANGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T18:26:07Z",
"kilometers": 7400
}
},
{
"key": "OIL_SERVICE_TIME",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T18:26:07Z",
"days": 137
}
},
{
"key": "MAIN_SERVICE_RANGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T18:26:07Z",
"kilometers": 17900
}
},
{
"key": "MAIN_SERVICE_TIME",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T18:26:07Z",
"days": 117
}
},
{
"key": "PARKING_BRAKE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOn": false
}
},
{
"key": "RANGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"kilometers": 371
}
},
{
"key": "FUEL_LEVEL",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"percent": 61
}
},
{
"key": "OPEN_STATE_DOOR_FRONT_LEFT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_DOOR_REAR_LEFT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_DOOR_FRONT_RIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_DOOR_REAR_RIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_LID_REAR",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_LID_FRONT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_FRONT_LEFT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_REAR_LEFT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_FRONT_RIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_REAR_RIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_SUNROOF",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOpen": false
}
},
{
"key": "OIL_LEVEL_CURRENT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T22:26:07Z",
"percent": 25
}
},
{
"key": "OIL_LEVEL_MAX",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T18:26:07Z",
"liters": 2.0
}
},
{
"key": "OIL_LEVEL_MIN_WARNING",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T18:26:07Z",
"isEnabled": false
}
},
{
"key": "LOCK_STATE_VEHICLE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:22Z",
"isLocked": true
}
},
{
"key": "PARKING_LIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:30Z",
"isOn": false
}
},
{
"key": "SERVICE_PREDICTIONS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "PRED_PRECON_LOCATION_EXCEPTIONS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "PRED_PRECON_USER_SETTINGS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "INTERMEDIATE_SERVICE_TIME",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "INTERMEDIATE_SERVICE_RANGE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
}
]
}

{
"vin": "editted",
"modelName": "911 editted",
"customName": "",
"modelType": {
"code": "992650",
"year": "2024",
"body": "CABRIO",
"generation": "992",
"model": "911",
"engine": "COMBUSTION"
},
"systemInfo": {
"driverExperience": "0.5",
"privacyStyle": 1
},
"exteriorColorName": "Jet Black Metallic/Cabriolet Roof in Black",
"color": {
"primaryExteriorColor": "000000"
},
"connect": true,
"greyConnectStoreURL": "https://connect-store.porsche.com",
"timestamp": "2024-06-19T23:15:23Z",
"commands": [],
"measurements": [
{
"key": "OPEN_STATE_LID_REAR",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_DOOR_REAR_RIGHT",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "CHARGING_PROFILES",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "E_RANGE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "BATTERY_CHARGING_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "CHARGING_SUMMARY",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "BATTERY_LEVEL",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_CHARGE_FLAP_LEFT",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_SPOILER",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_DOOR_REAR_LEFT",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_CHARGE_FLAP_RIGHT",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "DEPARTURES",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "OPEN_STATE_SUNROOF",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "REMOTE_ACCESS_AUTHORIZATION",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:23Z",
"isEnabled": true
}
},
{
"key": "GLOBAL_PRIVACY_MODE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:23Z",
"isEnabled": false
}
},
{
"key": "CLIMATIZER_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "TIMERS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "HEATING_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "BLEID_DDADATA",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "ACV_STATE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "FUEL_RESERVE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:23Z",
"percent": 15
}
},
{
"key": "THEFT_STATE",
"status": {
"isEnabled": false,
"cause": "LICENSE_DEACTIVATED"
}
},
{
"key": "ALARM_STATE",
"status": {
"isEnabled": false,
"cause": "LICENSE_DEACTIVATED"
}
},
{
"key": "VTS_MODES",
"status": {
"isEnabled": false,
"cause": "LICENSE_DEACTIVATED"
}
},
{
"key": "GPS_LOCATION",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T20:59:27Z",
"location": "editted",
"direction": 165
}
},
{
"key": "PAIRING_CODE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "MILEAGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"kilometers": 2673
}
},
{
"key": "OIL_SERVICE_RANGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T16:58:27Z",
"kilometers": 12400
}
},
{
"key": "OIL_SERVICE_TIME",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T16:58:27Z",
"days": 198
}
},
{
"key": "MAIN_SERVICE_RANGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T16:58:27Z",
"kilometers": 27400
}
},
{
"key": "MAIN_SERVICE_TIME",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T16:58:27Z",
"days": 563
}
},
{
"key": "PARKING_BRAKE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOn": true
}
},
{
"key": "RANGE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"kilometers": 473
}
},
{
"key": "FUEL_LEVEL",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"percent": 93
}
},
{
"key": "OPEN_STATE_DOOR_FRONT_LEFT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_DOOR_FRONT_RIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_LID_FRONT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_FRONT_LEFT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_REAR_LEFT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_FRONT_RIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_WINDOW_REAR_RIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_TOP",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OPEN_STATE_SERVICE_FLAP",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOpen": false
}
},
{
"key": "OIL_LEVEL_CURRENT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T15:25:05Z",
"percent": 100
}
},
{
"key": "OIL_LEVEL_MAX",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T15:25:05Z",
"liters": 1.0
}
},
{
"key": "OIL_LEVEL_MIN_WARNING",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-18T15:25:05Z",
"isEnabled": false
}
},
{
"key": "LOCK_STATE_VEHICLE",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isLocked": true
}
},
{
"key": "PARKING_LIGHT",
"status": {
"isEnabled": true
},
"value": {
"lastModified": "2024-06-19T23:15:45Z",
"isOn": false
}
},
{
"key": "SERVICE_PREDICTIONS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "PRED_PRECON_LOCATION_EXCEPTIONS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "PRED_PRECON_USER_SETTINGS",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "INTERMEDIATE_SERVICE_TIME",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
},
{
"key": "INTERMEDIATE_SERVICE_RANGE",
"status": {
"isEnabled": false,
"cause": "NOT_SUPPORTED"
}
}
]
}

@CTRDevelopments
Copy link

Hopefully you can help. How do i install this updated version?

Do I need the original HACS integration and then install this over the top? Or do I just install this (then how do I access the date in HA?)

sorry for being a bit simple

cheers

@fredriklj
Copy link
Collaborator

Thanks @augmentedtraffic . Helps a lot to know the units and attributes for oil, fuel, etc.

@CTRDevelopments, if you want to test it out, check out the new_api branch and install using pip. But for know I got what is needed. No need to go through the hass integration at this point.

@moballa
Copy link

moballa commented Jun 20, 2024

@fredriklj - I'm unable to get your new_api branch working. I tried example2.py and am getting the following "401 Unathorized" on the vehicles endpoint

DEBUG:pyporscheconnectapi.connection:TraceRequestEndParams(method='GET', url=URL('https://api.ppa.porsche.com/app/connect/v1/vehicles/WPXXXXXXXXXX'), headers=<CIMultiDict()>, response=<ClientResponse(https://api.ppa.porsche.com/app/connect/v1/vehicles/WPXXXXXXXXXXX?mf=BATTERY_LEVEL&mf=LOCK_STATE_VEHICLE) [401 Unauthorized]>

It seems to be logging in because it is able to retrieve the VIN associated with my account.

The pip install pyporscheconnectapi is installing 0.1.7 from November 2023 ... is this correct??

@moballa
Copy link

moballa commented Jun 20, 2024

Nevermind, I overrode the python library package with the version in the new_api branch. All good. Works again, thanks!

@CTRDevelopments
Copy link

Thanks @augmentedtraffic . Helps a lot to know the units and attributes for oil, fuel, etc.

@CTRDevelopments, if you want to test it out, check out the new_api branch and install using pip. But for know I got what is needed. No need to go through the hass integration at this point.

@fredriklj , super. I have installed via PIP but how do i get the data? Sorry if this seems like a noobie type question. Cheers

@augmentedtraffic
Copy link
Author

if a new install this should work

pip3 install git+https://github.com/CJNE/pyporscheconnectapi.git@new_api

(or just pip ... if you only have python 3 installed)

@CTRDevelopments
Copy link

@augmentedtraffic - thanks.

I then got the message below. Should this now appear in the integrations page on Home Assistant? Cheers

➜ ~ pip3 install git+https://github.com/CJNE/pyporscheconnectapi.git@new_api
Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Collecting git+https://github.com/CJNE/pyporscheconnectapi.git@new_api
Cloning https://github.com/CJNE/pyporscheconnectapi.git (to revision new_api) to /tmp/pip-req-build-2puhbg35
Running command git clone --filter=blob:none --quiet https://github.com/CJNE/pyporscheconnectapi.git /tmp/pip-req-build-2puhbg35
Running command git checkout -b new_api --track origin/new_api
branch 'new_api' set up to track 'origin/new_api'.
Switched to a new branch 'new_api'
Resolved https://github.com/CJNE/pyporscheconnectapi.git to commit e3d6bd2
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: aiohttp<4 in /usr/lib/python3.12/site-packages (from pyporscheconnectapi==0.2.0) (3.9.5)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/lib/python3.12/site-packages (from aiohttp<4->pyporscheconnectapi==0.2.0) (1.3.1)
Requirement already satisfied: attrs>=17.3.0 in /usr/lib/python3.12/site-packages (from aiohttp<4->pyporscheconnectapi==0.2.0) (23.2.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/lib/python3.12/site-packages (from aiohttp<4->pyporscheconnectapi==0.2.0) (1.4.1)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/lib/python3.12/site-packages (from aiohttp<4->pyporscheconnectapi==0.2.0) (6.0.5)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/lib/python3.12/site-packages (from aiohttp<4->pyporscheconnectapi==0.2.0) (1.9.4)
Requirement already satisfied: idna>=2.0 in /usr/lib/python3.12/site-packages (from yarl<2.0,>=1.0->aiohttp<4->pyporscheconnectapi==0.2.0) (3.7)
Building wheels for collected packages: pyporscheconnectapi
Building wheel for pyporscheconnectapi (pyproject.toml) ... done
Created wheel for pyporscheconnectapi: filename=pyporscheconnectapi-0.2.0-py3-none-any.whl size=10317 sha256=6db70634844efc29b3543b79f408b23f38576bc1e7ad910d98174a5404612c56
Stored in directory: /tmp/pip-ephem-wheel-cache-zkzipvsw/wheels/47/0d/4b/31eaf25a388cd6bdb42f73be9b38019628c96cf6a441c20b54
Successfully built pyporscheconnectapi
Installing collected packages: pyporscheconnectapi
Attempting uninstall: pyporscheconnectapi
Found existing installation: pyporscheconnectapi 0.1.7
Uninstalling pyporscheconnectapi-0.1.7:
Successfully uninstalled pyporscheconnectapi-0.1.7
Successfully installed pyporscheconnectapi-0.2.0

@fredriklj
Copy link
Collaborator

@CTRDevelopments No, you would need to clone the "new_api" branch from the ha-porscheconnect repo into custom_components of your config directory for hass as well, to override the current (non-functional) version of the integration from HACS.

But beware, it is in very early stage of development and currently only have a few read-only entities. It will take some time before we (hopefully) can have a functional integration again.

@CTRDevelopments
Copy link

@fredriklj Thanks for the info. I have now installed the original integration,

then run - pip3 install git+https://github.com/CJNE/pyporscheconnectapi.git@new_api

Then copied the files from the github sub folder - pyporscheconnectapi to home assistant (init.py, cli.py, client.py, connection.py, const.py exceptions.py) - do i need any others? I replaced all original files with the new ones

It is now giving me an error 'config flow could not be loaded, unknown error'

not sure what I have missed.

Cheers

@fredriklj
Copy link
Collaborator

The repo you need to clone into custom_components is here:

https://github.com/CJNE/ha-porscheconnect

@CTRDevelopments
Copy link

The repo you need to clone into custom_components is here:

https://github.com/CJNE/ha-porscheconnect

ahh so the original repo. Does installing this from HACS do this automatically?

I am manually downloading files to my PC and then uploading through 'studio code viewer' in Home Assistant. Should this work?

cheers

@normanmaurer
Copy link

@fredriklj just wanted to say that this works great at least for the "read-only" things together with ha-porscheconnect. Now I can again have the charge level of my taycan on my watch. Thanks a lot!

@fredriklj
Copy link
Collaborator

@normanmaurer Thanks for letting me know. There are some issues with getting response code 429 (too many requests) after a while. I'm looking into that issue.

@normanmaurer
Copy link

@fredriklj thanks a lot! Maybe you could also help out the evcc project by providing some the traffic data that you used to reengineer the API: evcc-io/evcc#14371 (comment)

@wisq
Copy link

wisq commented Jul 4, 2024

Yeah, I too am definitely interested in figuring out the new API — I wrote https://github.com/wisq/porsche_conn_ex (largely based on this library), and https://github.com/wisq/tay_calendar to sync my Google Calendar events to car timers, and of course a few months later, they discontinue the API and break everything. 🤦

I've not got much experience reverse engineering APIs or MitMing apps, so I was sorta waiting to see what happened with this project, but I can give it a go myself when I get a bit of spare time. Glad to see we're back to at least basic authentication and read-only access, though! 🎉

@fredriklj
Copy link
Collaborator

I need to work out the basics first, and as I think I wrote, I have quite limited time to spend on this currently. Will try to do whatever I can, but any help would be much appreciated.

@CTRDevelopments
Copy link

Hi, I am still very keen, but unfortunately I cannot get this working, although I suspect this is me rather than any error! Is it possible to describe the install steps again? I thought I understood, but I guess not :) Cheers

@normanmaurer
Copy link

@CTRDevelopments this is what worked for me:

pip3 install git+https://github.com/CJNE/pyporscheconnectapi.git@new_api
git clone https://github.com/CJNE/ha-porscheconnect.git
cd ha-porscheconnect
git checkout new_api
cp -r custom_components/porscheconnect homeassistant_directory/custom_components

Restart homeassistant

@fredriklj
Copy link
Collaborator

In case anyone has any good ideas, this is where I am currently stuck:

  1. It seems one can keep refreshing the tokens for about three hours. After this time window has elapsed, you'll get a 429 (Too many requests) error.
  2. The query rate does not seem to matter, changing the polling interval from 15 to 30 minutes still gives you a three hour window. Also, it doesn't matter if you are getting the stored or request current overview.
  3. There is no Retry-After header, which could have indicated for how long the server wants you back-off. Which leads me to believe there is something else bothering the server side.

Closing the session entirely and starting all over will give you a new three-hour window, but that does not seem to be the proper way to do it. As we are trying our best to be nice and polite to the API.

I just saw that we didn't set the User-Agent header properly, but that's a long-shot. Ideas welcome.

@wingrunr21
Copy link

wingrunr21 commented Nov 2, 2024

Which of those data fields show up in the Porsche app? Also, how often were you querying?

@MarkusGH
Copy link

MarkusGH commented Nov 2, 2024

The Porsche app shows all information, the car is not in privacy mode. For example odometer and SOC are displayed.

@MarkusGH
Copy link

MarkusGH commented Nov 2, 2024

And the information is missing right from the first query.

@fredriklj
Copy link
Collaborator

@MarkusGH Can you post the output from when you do get some readings ("some values are there showin isEnabled = true")? I have seen cases where the car goes offline, and then it looks quite like output you have posted. In those cases the App seem to show last known values, but is also unable to update to current/actual readings.

@fredriklj
Copy link
Collaborator

fredriklj commented Nov 3, 2024

@MarkusGH @wingrunr21 I can replicate this as well with the new auth-flow and httpx. It still works using the old client, so there is something that was introduced here. I added a timeout parameter to account to requests that takes longer than 5 seconds. Will also double-check all headers etc, to see they are set correctly.

Edit: Ok, I found it I think, see ed1b51c .. can you please pull and try again?

@MarkusGH
Copy link

MarkusGH commented Nov 3, 2024

I tried and it looks good now (as far as I can tell)

@augmentedtraffic
Copy link
Author

I can also confirm the latest on new_api continues to work. thanks I appreciate very much the work being done on this library.

@jwinston100
Copy link

Thank you for everyone's work, but it doesn't doesn't seem to work for me. I am using the API via Home Assistant's Porsche integration, so perhaps that integration still needs to be updated. I still receive this error:

This error originated from a custom integration.

Logger: custom_components.porscheconnect
Source: helpers/update_coordinator.py:354
integration: Porsche Connect (documentation, issues)
First occurred: November 3, 2024 at 7:21:40 AM (21 occurrences)
Last logged: 1:51:56 PM

Unexpected error fetching porscheconnect data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/porscheconnect/init.py", line 213, in _async_update_data
vehicle["name"] = summary["nickName"] or summary["modelDescription"]
~~~~~~~^^^^^^^^^^^^
KeyError: 'nickName'

@fredriklj
Copy link
Collaborator

@jwinston100 You have not updated ha-porscheconnect to the latest version.

@jwinston100
Copy link

@fredriklj Thanks for your answer, but I am using the latest version of ha-porscheconnect, version 0.0.18, from 12/2/2023. I don't see any updates beyond that version at https://github.com/CJNE/ha-porscheconnect/releases.

@fredriklj
Copy link
Collaborator

@jwinston100 See second post in this thread. Development is ongoing in this branch:

https://github.com/CJNE/pyporscheconnectapi/tree/new_api

@Jimnaldo
Copy link

Jimnaldo commented Nov 7, 2024

@fredriklj i keep getting this error:

Logger: homeassistant.util.package
Source: util/package.py:150
First occurred: 11:36:38 AM (3 occurrences)
Last logged: 11:36:38 AM

Unable to install package pyporscheconnectapi==0.2.0: × No solution found when resolving dependencies: ╰─▶ Because there is no version of pyporscheconnectapi==0.2.0 and you require pyporscheconnectapi==0.2.0, we can conclude that your requirements are unsatisfiable.

But when i check in SSH pyporscheconnectapi 0.2.0 is installed:

➜ ~ pip3 install git+https://github.com/CJNE/pyporscheconnectapi.git@new_api
Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Collecting git+https://github.com/CJNE/pyporscheconnectapi.git@new_api
Cloning https://github.com/CJNE/pyporscheconnectapi.git (to revision new_api) to /tmp/pip-req-build-67bf2bu7
Running command git clone --filter=blob:none --quiet https://github.com/CJNE/pyporscheconnectapi.git /tmp/pip-req-build-67bf2bu7
Running command git checkout -b new_api --track origin/new_api
branch 'new_api' set up to track 'origin/new_api'.
Switched to a new branch 'new_api'
Resolved https://github.com/CJNE/pyporscheconnectapi.git to commit 50e50e6
Installing build dependencies ... |^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: httpx<1 in /usr/lib/python3.12/site-packages (from pyporscheconnectapi==0.2.0) (0.27.2)
Requirement already satisfied: anyio in /usr/lib/python3.12/site-packages (from httpx<1->pyporscheconnectapi==0.2.0) (4.6.2.post1)
Requirement already satisfied: certifi in /usr/lib/python3.12/site-packages (from httpx<1->pyporscheconnectapi==0.2.0) (2024.8.30)
Requirement already satisfied: httpcore==1.* in /usr/lib/python3.12/site-packages (from httpx<1->pyporscheconnectapi==0.2.0) (1.0.6)
Requirement already satisfied: idna in /usr/lib/python3.12/site-packages (from httpx<1->pyporscheconnectapi==0.2.0) (3.10)
Requirement already satisfied: sniffio in /usr/lib/python3.12/site-packages (from httpx<1->pyporscheconnectapi==0.2.0) (1.3.1)
Requirement already satisfied: h11<0.15,>=0.13 in /usr/lib/python3.12/site-packages (from httpcore==1.*->httpx<1->pyporscheconnectapi==0.2.0) (0.14.0)

So i'm a bit lost, could you advise or someone else please?

@WolfImBusch
Copy link

Hi @fredriklj,
first of all: thank you very much for your work!!! I really appreciate that!!!
I know this comment won't really help but I'm getting the same error as Jimnaldo. What I can offer is to test it with Home Assistant as soon as we get rid of this error message or - of course - "new_api" is pushed to the main branch.
Thank you very much!

@fredriklj
Copy link
Collaborator

fredriklj commented Nov 17, 2024

Thanks for your kind words. I think we have a somewhat working library and hass integration by now. There is still a lot of cleanup to do (and some functionality still missing), but to facilitate testing I am contemplating to publish a pre-release. I'd like to get hold of @CJNE to hear what he thinks as well.

@Jimnaldo I am not exactly sure what went wrong, but presumably you could pin the requirements in manifest.json to a specific commit in the new_api branch by something like this:

"requirements": ["pyporscheconnectapi @ git+https://github.com/CJNE/pyporscheconnectapi.git@41b3735"]

..or, you could reference the branch by:

"requirements": ["pyporscheconnectapi @ git+https://github.com/CJNE/pyporscheconnectapi.git@new_api"]

See documentation here: https://developers.home-assistant.io/docs/creating_integration_manifest#custom-requirements-during-development--testing

EDIT: I have updated manifest.json in the ha-porcheconnect repo to reference the current branch, which should ease testing a bit a think. Please update and see if it works?

@WolfImBusch
Copy link

Hi @fredriklj
I changed the file "manifest.json" manually according to your proposal
"requirements": ["pyporscheconnectapi @ git+https://github.com/CJNE/pyporscheconnectapi.git@new_api"]
and: it works!!!!!!!!! So happy now!!!!!
Thank you very much for your help and greeting from Stuttgart/Germany!!!

@jwinston100
Copy link

@WolfImBusch I updated my manifest.json (located in /custom_components/porscheconnect) as you did, but it still doesn't work for me. Am I missing something?

@WolfImBusch
Copy link

Hi!!!
Hm - super strange!!! I swear I did not modify anything else... The only thing I did was a completely new install according to the installation guide (create folder, copy files, ...) and modify the file "manifest.json" manually... Do you still get the same error message? Sorry to ask you that but you are using the files from the "new_api" branch?

@jwinston100
Copy link

@WolfImBusch I installed Porsche Connect via HACS and then edited manifest.json as you did. I never created a folder, etc. I'm not sure if I'm using the files from the "new_api" branch beyond editing manifest.json as you mentioned which includes ...pyporscheconnectapi.git@new_api.

@WolfImBusch
Copy link

Ah - I see - hmmm ... Really quiet unsure but I assume you get the branch "main" if you install it via hacs. So I decided to download the files from the "new_api" branch via GitHub and then followed the instructions for manual installation". Would you give that a try? Fingers crossed 🤞

@jwinston100
Copy link

@WolfImBusch I installed from the new_api (https://github.com/CJNE/pyporscheconnectapi/tree/new_api), but received this error in HA:

Logger: homeassistant.setup
Source: setup.py:269
First occurred: 10:34:05 AM (1 occurrences)
Last logged: 10:34:05 AM

Setup failed for custom integration 'porscheconnect': No setup or config entry setup function defined.

@fredriklj
Copy link
Collaborator

@jwinston100 And you have checked out and installed the corresponding version of the ha-porscheconnect custom component (new_api branch)?

https://github.com/CJNE/ha-porscheconnect/tree/new_api

@jwinston100
Copy link

@fredriklj Yes, I installed the new_api, typed git clone --branch new_api https://github.com/CJNE/ha-porscheconnect.git

Still get this when I restart:

Logger: homeassistant.setup
Source: setup.py:269
First occurred: 11:24:55 AM (1 occurrences)
Last logged: 11:24:55 AM

Setup failed for 'porscheconnect': Integration not found.

@jwinston100
Copy link

I reinstalled everything. Now when I try to start the integration I get "Error
Config flow could not be loaded: {"message":"Invalid handler specified"}"

@fredriklj
Copy link
Collaborator

I'm afraid I would need a bit more debug output to tell what is going on. Can you enable debugging and post the relevant log output?

@jwinston100
Copy link

@fredriklj Thanks. I enabled debugging and restarted. When I try to add the integration, I see

Error
Config flow could not be loaded: {"message":"Invalid handler specified"}

The logs show:

Logger: homeassistant.config_entries
Source: config_entries.py:3249
First occurred: 3:29:32 PM (1 occurrences)
Last logged: 3:29:32 PM

Error occurred loading flow for integration porscheconnect: No module named 'pyporscheconnectapi.vehicle'

@fredriklj
Copy link
Collaborator

Error occurred loading flow for integration porscheconnect: No module named 'pyporscheconnectapi.vehicle'

This error indicates you have not got the latest version of the library installed. I will try to do a proper (pre)release of both the ha integration and the library, possibly later this week or during the weekend. Then you should be able to get the things installed the HACS-way.

@jwinston100
Copy link

@fredriklj Thanks for clarifying. I tried to install the new APIs of Porsche Connect and HA-Porsche Connect via the command line, but I obviously screwed something up.

@fredriklj
Copy link
Collaborator

But then I'm unable to retrieve specific data like daily consumptions (which I used in the past to calculate REAL consumption). Any plans in adressing this new API beyond basic auth/data?

@tchavei This as now been implemented. Could you please test it, for example using the cli, to confirm it works as expected?

@fredriklj
Copy link
Collaborator

Folks, we are about to make a new release one of these days. I believe we have a reasonably working library at this point, but we need testers.

So, for anyone interested, please check out the new_api branch and test it with your vehicle in your application. Bugs can be filed as new issues, to make them a bit easier to keep track of.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking Changes
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.