-
Notifications
You must be signed in to change notification settings - Fork 11
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
Comments
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. |
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 |
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. |
two ICEs - some parts redacted hope this helps - I think some things are slightly different even between the two cars. { { |
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 |
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 - 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?? |
Nevermind, I overrode the python library package with the version in the new_api branch. All good. Works again, thanks! |
@fredriklj , super. I have installed via PIP but how do i get the data? Sorry if this seems like a noobie type question. Cheers |
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) |
@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 |
@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. |
@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 |
The repo you need to clone into custom_components is here: |
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 |
@fredriklj just wanted to say that this works great at least for the "read-only" things together with |
@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. |
@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) |
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! 🎉 |
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. |
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 |
@CTRDevelopments this is what worked for me:
Restart homeassistant |
In case anyone has any good ideas, this is where I am currently stuck:
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. |
Which of those data fields show up in the Porsche app? Also, how often were you querying? |
The Porsche app shows all information, the car is not in privacy mode. For example odometer and SOC are displayed. |
And the information is missing right from the first query. |
@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. |
@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? |
I tried and it looks good now (as far as I can tell) |
I can also confirm the latest on new_api continues to work. thanks I appreciate very much the work being done on this library. |
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 Unexpected error fetching porscheconnect data |
@jwinston100 You have not updated ha-porscheconnect to the latest version. |
@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. |
@jwinston100 See second post in this thread. Development is ongoing in this branch: https://github.com/CJNE/pyporscheconnectapi/tree/new_api |
@fredriklj i keep getting this error: Logger: homeassistant.util.package 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 So i'm a bit lost, could you advise or someone else please? |
Hi @fredriklj, |
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:
..or, you could reference the branch by:
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? |
Hi @fredriklj |
@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? |
Hi!!! |
@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. |
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 🤞 |
@WolfImBusch I installed from the new_api (https://github.com/CJNE/pyporscheconnectapi/tree/new_api), but received this error in HA: Logger: homeassistant.setup Setup failed for custom integration 'porscheconnect': No setup or config entry setup function defined. |
@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 |
@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 Setup failed for 'porscheconnect': Integration not found. |
I reinstalled everything. Now when I try to start the integration I get "Error |
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? |
@fredriklj Thanks. I enabled debugging and restarted. When I try to add the integration, I see Error The logs show: Logger: homeassistant.config_entries 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. |
@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. |
@tchavei This as now been implemented. Could you please test it, for example using the cli, to confirm it works as expected? |
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! |
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
The text was updated successfully, but these errors were encountered: