CJNE / ha-porscheconnect

Porsche Connect custom component for Home Assistant
MIT License
31 stars 14 forks source link

ERROR (MainThread) [custom_components.porscheconnect] Unexpected error fetching porscheconnect data #242

Open barto64 opened 5 months ago

barto64 commented 5 months ago

Version of the custom_component

0.0.18

Configuration


Add your logs here.
``2024-06-12 12:33:55.372 ERROR (MainThread) [custom_components.porscheconnect] Unexpected error fetching porscheconnect data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/porscheconnect/__init__.py", line 211, in _async_update_data
    summary = await self.controller.getSummary(vin)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyporscheconnectapi/client.py", line 484, in getSummary
    data = await self._connection.get(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyporscheconnectapi/connection.py", line 304, in get
    return await resp.json()
           ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 79, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1192, in json
    return loads(stripped.decode(encoding))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/json.py", line 48, in json_loads
    return orjson.loads(__obj)  # type:ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^
orjson.JSONDecodeError: unexpected character: line 1 column 1 (char 0)`

## Describe the bug

Integration does not work, device and entities not available.

## Debug log

<!-- To enable debug logs check this https://www.home-assistant.io/components/logger/ -->

```text

Add your logs here.
augmentedtraffic commented 5 months ago

same with me - looks like Porsche made a big change on their APIs that needs to be reflected

fredriklj commented 5 months ago

What HA versions are you on?

barto64 commented 5 months ago

Latest one

De: Fredrik Ljunggren @.> Enviado el: miércoles, 12 de junio de 2024 15:30 Para: CJNE/ha-porscheconnect @.> CC: barto64 @.>; Author @.> Asunto: Re: [CJNE/ha-porscheconnect] ERROR (MainThread) [custom_components.porscheconnect] Unexpected error fetching porscheconnect data (Issue #242)

What HA versions are you on?

— Reply to this email directly, view it on GitHub https://github.com/CJNE/ha-porscheconnect/issues/242#issuecomment-2163016599 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG263MZTYL5NZKLK6ZQ32LZHBEPHAVCNFSM6AAAAABJGCRIQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRTGAYTMNJZHE . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ALG263I6OAHFG57NT5JRNLDZHBEPHA5CNFSM6AAAAABJGCRIQKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUA5UBZO.gif Message ID: @. @.> >

augmentedtraffic commented 5 months ago

i am using your latest python lib directly. I only stopped by here to see if others are seeing it. I will set up HA later to test as I use it also but just not with this integration. . The normal python lib stopped working Sunday morning early for me EST so I stopped my automatic (hourly) ping. I just realized it actually worked yesterday about 3:40pm EST (I was doing a test), but this morning it had the same error as above. On Sunday I was getting a valid response but effectively empty JSON values. When I log into the Connect web site I get an alert about changes coming (i.e. it looks like they will remove web access and work only via the mobile apps)

fredriklj commented 5 months ago

I just noticed they have scrapped all remote services from the web access, possibly they have retired all those APIs. In which case we might have some trouble.

augmentedtraffic commented 5 months ago

that's what I was afraid of. I suppose someone would need to work from the Android app side to see if the mobile APIs can be used. I won't be able to do this, but I would be willing to pay a bounty to someone

fredriklj commented 5 months ago

This is going to take a while.

fredriklj commented 5 months ago

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. And will require significant changes of the HA integration as well.

augmentedtraffic commented 5 months ago

I can confirm it works thanks so much I will send you an email. Note the JSON is changed quite a bit. I found ChatGPT4o quite useful to rewriting my code and the key functionality is working like before. I still need to do tire pressure and lights control but that is not as key. Really appreciate your efforts on this!

fredriklj commented 5 months ago

For anyone whose life depend on a (somewhat) functional ha integration, and is prepared to file a pull request to fix any discovered issues, there is work in progress in the new_api branch.

Jimnaldo commented 4 months ago

@fredriklj is there something we can help with to get it up an running again?

fredriklj commented 4 months ago

I'd appreciate any help I can get, I have quite limited time to spend on this. I've started to clean up the integration to align it with best current (hass) practices, but could certainly use some help on that. Also, pyporscheconnectapi need an overhaul. So please feel free to dive in!

fredriklj commented 3 weeks ago

FWIW, I have pushed some changes to the new_api branch which seem to work somewhat reliably, and give you a few more entities in hass.

Please note that you will have to manually make sure to install the development version of pyporscheconnectapi (from new_api branch) into your hass environment before you start hass. Hass will not pull this version of the library automatically.

Yura-87 commented 3 weeks ago

Hello Fredrik, thank you for your work 👏 I've tried to manually install the files from _newapi branch via File Manager in Home Assistant. But after the copying of all the files into the requested directory and restart of HA I tried to log in with my Porsche ID credentials, but during the initialization I receive this error message.

Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

scr 2024-11-01 v 13 18 35

What I am doing wrong? 😉

fredriklj commented 3 weeks ago

Not sure what is going wrong here, you would need to dive into the code and add debugging output if its not there already.

Yura-87 commented 3 weeks ago

I don't know how to do that, I am just a normal user, not a developer :-)

Is there someone other, who tried the version from the branch new_api?

barto64 commented 3 weeks ago

Hi @fredriklj , thanks for your continue effort on this.

I have made the following on my DEV HASS instance in trying to test your changes of the custom component

image

fredriklj commented 3 weeks ago

Ah, ok. I see, it is due to the refactoring of the authentication flow in pyporscheconnectapi. We'll have to address that in config_flow.py.

barto64 commented 3 weeks ago

Ok, when you had done that I will continue trying to help on the fine tunning 😃

fredriklj commented 3 weeks ago

@barto64 Please try again with 3213991e5720de0ef97a385043f5d346f0c2a609. Works for me in a clean hass.

barto64 commented 2 weeks ago

@barto64 Please try again with 3213991. Works for me in a clean hass.

Hey,

It works for me too, I can see a few entities now under the device, nine initially and i believe growing and, as I keep the DEBUG enabled can see the myriad of data the integration receives in the "vehicle data dict" JSON file. I will keep running it and will keep you updated on any thing i can see.

Great thanks again

barto64 commented 2 weeks ago

I am pasting the entire vehicle data dict for you to see if this is the expected outcome. I see lot of entires "UNKNOWN" , "NOT_SUPPORTED" and only 10 entities under the device with "UNKNOWN" but the Privacy Mode with status "OFF"

2024-11-03 20:26:59.246 DEBUG (MainThread) [custom_components.porscheconnect] Vehicle data dict for 12345678901234567 is now: { "vin": "12345678901234567", "modelName": "Cayenne E-Hybrid", "customName": "Cayenne E-Hybrid Barto", "modelType": { "code": "9YAAE1", "year": "2019", "steeringPosition": "LEFT_HAND_DRIVE", "body": "SUV", "generation": "E3", "revision": 1, "model": "CAYENNE", "engine": "PHEV" }, "systemInfo": { "driverExperience": "0.5", "privacyStyle": 1 }, "exteriorColorName": "Azul Vizcaya Metalizado/Azul Vizcaya Metalizado", "color": { "primaryExteriorColor": "4F758B" }, "connect": true, "greyConnectStoreURL": "https://connect-store.porsche.com", "pairingCodeV2": "12345678", "timestamp": "2024-11-03T19:26:59Z", "commands": [], "measurements": [ { "key": "OPEN_STATE_CHARGE_FLAP_RIGHT", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "HEATING_STATE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_SPOILER", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "CHARGING_PROFILES", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "ACV_STATE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_TOP", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_CHARGE_FLAP_LEFT", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_SERVICE_FLAP", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "REMOTE_ACCESS_AUTHORIZATION", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-03T19:26:59Z", "isEnabled": true } }, { "key": "GLOBAL_PRIVACY_MODE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-03T19:26:59Z", "isEnabled": false } }, { "key": "BLEID_DDADATA", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "DEPARTURES", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "CHARGING_SUMMARY", "status": { "isEnabled": false, "cause": "UNKNOWN", "code": "25A09" } }, { "key": "BATTERY_LEVEL", "status": { "isEnabled": false, "cause": "UNKNOWN", "code": "25A09" } }, { "key": "BATTERY_CHARGING_STATE", "status": { "isEnabled": false, "cause": "UNKNOWN", "code": "25A09" } }, { "key": "CLIMATIZER_STATE", "status": { "isEnabled": false, "cause": "UNKNOWN", "code": "23A19" } }, { "key": "FUEL_RESERVE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-03T19:26:59Z", "percent": 15 } }, { "key": "GPS_LOCATION", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "PAIRING_CODE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-03T19:26:59Z", "code": "68524352" } }, { "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": "TIMERS", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "MAIN_SERVICE_RANGE", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_WINDOW_FRONT_LEFT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "RANGE", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "MILEAGE", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OIL_LEVEL_MIN_WARNING", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OIL_SERVICE_TIME", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_LID_REAR", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OIL_LEVEL_MAX", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_DOOR_REAR_RIGHT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "MAIN_SERVICE_TIME", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_WINDOW_REAR_LEFT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_LID_FRONT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_DOOR_FRONT_LEFT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_WINDOW_REAR_RIGHT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_DOOR_FRONT_RIGHT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_DOOR_REAR_LEFT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_SUNROOF", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OIL_LEVEL_CURRENT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OIL_SERVICE_RANGE", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "PARKING_BRAKE", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "FUEL_LEVEL", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "OPEN_STATE_WINDOW_FRONT_RIGHT", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "LOCK_STATE_VEHICLE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-03T19:26:59Z", "isLocked": true } }, { "key": "PARKING_LIGHT", "status": { "isEnabled": true }, "value": { "isOn": false } }, { "key": "E_RANGE", "status": { "isEnabled": false, "cause": "UNKNOWN" } }, { "key": "PRED_PRECON_LOCATION_EXCEPTIONS", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "PRED_PRECON_USER_SETTINGS", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "SERVICE_PREDICTIONS", "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" } } ] } 2024-11-03 20:26:59.247 DEBUG (MainThread) [custom_components.porscheconnect] Got base data for vehicle '12345678901234567': { "vin": "12345678901234567", "modelName": "Cayenne E-Hybrid", "customName": "Cayenne E-Hybrid Barto", "modelType": { "code": "9YAAE1", "year": "2019", "steeringPosition": "LEFT_HAND_DRIVE", "body": "SUV", "generation": "E3", "revision": 1, "model": "CAYENNE", "engine": "PHEV" }, "systemInfo": { "driverExperience": "0.5", "privacyStyle": 1 }, "timestamp": "2024-11-03T19:26:59Z" } 2024-11-03 20:26:59.247 DEBUG (MainThread) [custom_components.porscheconnect] Got measurement data for vehicle '012345678901234567': { "REMOTE_ACCESS_AUTHORIZATION": { "lastModified": "2024-11-03T19:26:59Z", "isEnabled": true }, "GLOBAL_PRIVACY_MODE": { "lastModified": "2024-11-03T19:26:59Z", "isEnabled": false }, "FUEL_RESERVE": { "lastModified": "2024-11-03T19:26:59Z", "percent": 15 }, "PAIRING_CODE": { "lastModified": "2024-11-03T19:26:59Z", "code": "1234567" }, "LOCK_STATE_VEHICLE": { "lastModified": "2024-11-03T19:26:59Z", "isLocked": true }, "PARKING_LIGHT": { "isOn": false } }

fredriklj commented 2 weeks ago

@barto64 Looks a bit thin, arguably. I assume you have data in the app which is not reflected here? Do you get the same results when using the pyporscheconnect cli? Have you tried both stored and current overview using the cli?

barto64 commented 2 weeks ago

Hi @fredriklj,

Yes, in the app I can see absolutely all the info that Porsche made available for my car. Also, I was able to see those before Porsche changed the API in your previous integration.

In terms of testing the API directly, I am afraid is something I cannot do. Long ago I do not have an Linux environment I can use, either on windows or in a RPi, and my skills are a bit rusty. I became a bit lazy using the Haas ;)

When I get retired is something I will definitively do :), but for now i am afraid do not have time to do so. Sorry for that. I can keep testing from Haas when I see you add new changes and will let you know what I find out.

devdems commented 2 weeks ago

@fredriklj The update is working well now. Thank you! When do you think it could be "officially" released so we would not have to mess with the pip installation and those things manually? Because when you do HA docker update you need to redo all the steps to get this integration working.

fredriklj commented 2 weeks ago

@devdems Things are quite much in flux right now, I am trying to refactor the code both in this component and the underlying library. And it all depends on when I can find some time to work on it. So honestly don't know. Maybe we can have something reasonably working after the christmas holidays, if I can refrain from "advent of code" and do this instead.

f1dgj commented 2 weeks ago

Could someone post some instructions for those of us that aren’t used to diving into the background of HA I’d love to get this integration working again

devdems commented 2 weeks ago

@f1dgj On HA you need to manually execute 2 steps:

  1. Execute this statement on the console where HA is running: pip3 install git+https://github.com/CJNE/pyporscheconnectapi.git@new_api
  2. Do manual installation like it's written here: https://github.com/CJNE/ha-porscheconnect/tree/new_api?tab=readme-ov-file#manual-installation
a-teece commented 2 weeks ago

@devdems I've tried the steps you listed but I get the same error as @f1dgj.

When I run "pip3 list" after installing the 0.2.0 pyporscheconnectapi it shows. But after rebooting HA it is gone.

Could this be something to do with the install method for HA - I'm running on Hyper-V so it's HAOS.

barto64 commented 2 weeks ago

Not fully an expert, but in HaaS any install made that way disappear after any reboot. The container should not be altered by doing this type of installs, hence after the reboot it goes back to its original content.

And alternative way of doing that is changing the manifest file and replacing the "requirements" with this:

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

it force the custom component to grab the api from the "new_api" branch rather than the "main". It remains in place until the manifest file get changed again with a new version.

Try and let us know the outccome. I made it work although the data and sensor i see does not work, there maybe something else missing.

a-teece commented 2 weeks ago

@barto64 Thanks for that. It gets a little further now.

Still not working fully. I get "Error occurred loading flow for integration porscheconnect: No module named 'pyporscheconnectapi.vehicle'" when trying to configure it.

a-teece commented 2 weeks ago

SUCCESS! I also had to delete the pycache directory

Thanks to @barto64 and @devdems

barto64 commented 2 weeks ago

@a-teece Cool, glad to hear. Are you able to see all the sensors with all your vehicle data ? In my case the API returns all the data empty. But all our tests will help @fredriklj to progress with the changes.

a-teece commented 2 weeks ago

As I only got the car a few weeks ago I can't compare to the old API, so don't know what sensors I should see.

However in HA I get: Sensors Charging power Charging rate Charging status Charging target Mileage Parking brake Privacy mode Remaining range electric State of charge

Diagnositc Taycan 4S (MY22)

The diagnostic identifies as a location and has an Entity ID of device_tracker.taycan_4s_my22 - but I cannot tell if this is working or not - I can't get it to show on the map.

Below is the debug data, with the VIN and GPS sanitized. Strange that the climate temperatures are a bit wild. Our car is not as hot a volcano on the insude. 2024-11-05 20:55:12.104 DEBUG (MainThread) [custom_components.porscheconnect] Vehicle data dict for WP0Z############## is now: { "vin": "WP0Z##############", "modelName": "Taycan 4S (MY22)", "modelType": { "code": "Y1ADB1", "year": "2022", "steeringPosition": "RIGHT_HAND_DRIVE", "body": "SEDAN", "generation": "J1", "revision": 1, "model": "TAYCAN", "engine": "BEV" }, "systemInfo": { "driverExperience": "0.5", "privacyStyle": 1, "cluster": "37" }, "exteriorColorName": "Dolomite Silver Metallic/Dolomite Silver Metallic", "color": { "primaryExteriorColor": "c3cdd3" }, "connect": true, "greyConnectStoreURL": "https://connect-store.porsche.com", "timestamp": "2024-11-05T20:55:11Z", "commands": [], "measurements": [ { "key": "OIL_LEVEL_MIN_WARNING", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_SERVICE_FLAP", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_TOP", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OIL_SERVICE_TIME", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_SPOILER", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "HEATING_STATE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "ACV_STATE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OIL_LEVEL_MAX", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "FUEL_RESERVE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OIL_SERVICE_RANGE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OIL_LEVEL_CURRENT", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "FUEL_LEVEL", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "REMOTE_ACCESS_AUTHORIZATION", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T20:55:11Z", "isEnabled": true } }, { "key": "GLOBAL_PRIVACY_MODE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T20:55:11Z", "isEnabled": false } }, { "key": "BLEID_DDADATA", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "DEPARTURES", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "BATTERY_CHARGING_STATE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:11:12Z", "status": "NOT_PLUGGED", "modeV2": "DIRECT", "directChargingState": "ENABLED_ON", "activeProfileId": 5, "activeTimerId": 2 } }, { "key": "CHARGING_SUMMARY", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:11:12Z", "status": "NOT_PLUGGED", "mode": "DIRECT", "climatization": { "temperature": 293.15, "targetDateTime": "2024-11-06T08:20:00Z" } } }, { "key": "BATTERY_LEVEL", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:57Z", "percent": 87 } }, { "key": "CLIMATIZER_STATE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:11:12Z", "isOn": false, "targetTemperature": 293.15, "climateZonesEnabled": { "frontLeft": true, "frontRight": true, "rearLeft": true, "rearRight": true } } }, { "key": "GPS_LOCATION", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:08Z", "location": "XX.XXXXXX,XX.XXXXXX", "direction": 249 } }, { "key": "PAIRING_CODE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "ALARM_STATE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T20:55:12Z", "isEnabled": false, "socPhoneNumber": "+443331222222" } }, { "key": "THEFT_STATE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T20:55:12Z", "isEnabled": false, "socPhoneNumber": "+443331222222" } }, { "key": "VTS_MODES", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T20:55:11Z", "list": [ { "type": "FORCED_DISARM", "isEnabled": false, "maxDuration": 600 }, { "type": "TRANSPORT", "isEnabled": false, "maxDuration": 600 }, { "type": "GARAGE", "isEnabled": false, "maxDuration": 600 } ] } }, { "key": "TIMERS", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:11:08Z", "timerSubmitType": "CLIMATIZER_CHARGING", "timerSubmitMaxCount": 5, "list": [ { "id": 1, "enabled": false, "type": "CLIMATIZER_CHARGING", "triggerType": "STOP", "triggerDateTime": "2024-11-06T14:50:00", "repeatOn": [ "WEDNESDAY", "THURSDAY", "FRIDAY" ], "metadata": { "targetSoc": 80, "isChargingEnabled": true, "isClimatizationEnabled": true } }, { "id": 2, "enabled": true, "type": "CLIMATIZER_CHARGING", "triggerType": "STOP", "triggerDateTime": "2024-11-06T08:20:00", "repeatOn": [ "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY" ], "metadata": { "targetSoc": 80, "isChargingEnabled": true, "isClimatizationEnabled": true } } ] } }, { "key": "MILEAGE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "kilometers": 87966 } }, { "key": "MAIN_SERVICE_RANGE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:11:14Z", "kilometers": 29934 } }, { "key": "MAIN_SERVICE_TIME", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:11:14Z", "days": 726 } }, { "key": "PARKING_BRAKE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOn": true } }, { "key": "OPEN_STATE_DOOR_FRONT_LEFT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_DOOR_REAR_LEFT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_DOOR_FRONT_RIGHT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_DOOR_REAR_RIGHT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_LID_REAR", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_LID_FRONT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_WINDOW_FRONT_LEFT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_WINDOW_REAR_LEFT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_WINDOW_FRONT_RIGHT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_WINDOW_REAR_RIGHT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOpen": false } }, { "key": "OPEN_STATE_SUNROOF", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "LOCK_STATE_VEHICLE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isLocked": true } }, { "key": "PARKING_LIGHT", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:55Z", "isOn": false } }, { "key": "CHARGING_PROFILES", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:11:13Z", "list": [ { "id": 1, "isEnabled": false, "profileType": "DEFAULT", "name": "Default", "minSoc": 25, "chargingOption": "OTHER" }, { "id": 2, "isEnabled": false, "profileType": "DEFAULT", "name": "Template", "minSoc": 25, "chargingOption": "OPTIMIZED_CHARGING" }, { "id": 3, "isEnabled": false, "profileType": "TCP", "name": "Navigation", "minSoc": 100, "chargingOption": "OTHER" }, { "id": 4, "isEnabled": true, "profileType": "GENERAL", "name": "Allgemein", "minSoc": 80, "chargingOption": "PREF_CHARGING_TIMES", "preferredChargingTimes": { "start": "00:00", "end": "00:00" } }, { "id": 5, "isEnabled": true, "profileType": "CUSTOM", "name": "Home", "minSoc": 80, "chargingOption": "OPTIMIZED_CHARGING", "circle": { "location": { "latitude": 51.885756, "longitude": -2.130105 }, "radius": 250 } } ] } }, { "key": "E_RANGE", "status": { "isEnabled": true }, "value": { "lastModified": "2024-11-05T19:12:57Z", "kilometers": 326 } }, { "key": "PRED_PRECON_LOCATION_EXCEPTIONS", "status": { "isEnabled": true }, "value": { "list": [] } }, { "key": "PRED_PRECON_USER_SETTINGS", "status": { "isEnabled": true }, "value": { "isPredPreconAllowed": true, "heatingTemperatureThreshold": 288.15, "coolingTemperatureThreshold": 295.15, "notifyOnlyWhileCharging": false } }, { "key": "SERVICE_PREDICTIONS", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "INTERMEDIATE_SERVICE_TIME", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_CHARGE_FLAP_RIGHT", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "INTERMEDIATE_SERVICE_RANGE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "OPEN_STATE_CHARGE_FLAP_LEFT", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } }, { "key": "RANGE", "status": { "isEnabled": false, "cause": "NOT_SUPPORTED" } } ] }

barto64 commented 2 weeks ago

@fredriklj , i have refreshed the custom component and stop working, i get the error:

2024-11-06 20:50:55.914 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration porscheconnect: No module named 'pyporscheconnectapi.vehicle'

It maybe WIP, as I see you have just made more changes in the code. So, just for you to know.

fredriklj commented 2 weeks ago

@barto64 Make sure you have updated pyporscheconnectapi to the latest version. There have been more modules added recently.

barto64 commented 2 weeks ago

Hmmmmm !!!! Not sure how I can update it. I mean what I do is to change the manifest file to ensure the "requiremets" section points to the new_api branch for the pyporscheconnectapi. So, supposedly my custom component should use the latest version there is the branch. I do not install it using pip.

a-teece commented 2 weeks ago

@barto64 I got the error your now getting. I believe the issue was that the new API wasn't being used, because the old one was cached. Try deleting the pycache folder from your 'custom_components/porscheconnect/' directory, then restart HA.

barto64 commented 2 weeks ago

I do that 😊, thanks any way.

fredriklj commented 2 weeks ago

Hmmmmm !!!! Not sure how I can update it. I mean what I do is to change the manifest file to ensure the "requiremets" section points to the new_api branch for the pyporscheconnectapi. So, supposedly my custom component should use the latest version there is the branch. I do not install it using pip.

I do not update the version numbers as i commit to the development branch, you have to manually wiggle the latestc oode into your hass environment every time you update the component. Its a pain, I know. But this is WIP.

barto64 commented 2 weeks ago

Noted and understood, that make sense. I will google how it can be done. Honestly, no idea how to do it. Maybe I can cheat HA by swapping the branch and force it to make updates on the api version.

Pretty conscious it is WIP and trying to help. Great thanks for your efforts.

fredriklj commented 2 weeks ago

@barto64 Or just use pip to install directly from the directory where you have cloned the git repo.

git pull; pip install .

a-teece commented 2 weeks ago

Would pip uninstall first help to get rid of the old version?

barto64 commented 2 weeks ago

Hi @fredriklj and thanks again for your support. Will try to explain to the best of my knowledge given that my skills are not so wide as yours by any means in spite of being a tech person sadly much more involve in management at this stage of my career than in tech stuff which is what i would really like.

The point is that my install as the vast mayority of HA users is "Operating system" as opposed to "Container, Core or Supervised". It makes life super much easier but gives you far less degree of control on what you can do or not. So honestly, i have no idea on how i can manipulate internally the code and libraries of HA. I vaguely recall in the past i was able to do it as there are some tools that you can use for that (although they work only up to the time you reboot again the system). I need to refresh those skills to be able to install and unsintall libraries on my HA DEV instance.

I have pasted the below links to illustrate my comment: https://analytics.home-assistant.io/#installations https://www.home-assistant.io/blog/2020/05/26/installation-methods-and-community-guides-wiki/

fredriklj commented 2 weeks ago

@barto64 What you need to do, regardless of type of installation, is to manually install the pyporscheconnect package into the hass environment. You would typically do that by "entering" your environment, meaning launching a shell inside your OS, container or venv, clone or update the repo and then install it using pip. This will overwrite the files of the old version of the package and clean what needs to be cleaned.

Then you need to restart your hass (restarting, not rebooting if you are in a container or similar).

barto64 commented 2 weeks ago

I have gone into my env using Termius terminal, but any command I try says always command not found. Maybe I must do something else before I do not know.

royalidea commented 2 weeks ago

I have gone into my env using Termius terminal, but any command I try says always command not found. Maybe I must do something else before I do not know.

@barto64 You need to install the advanced ssh terminal: https://github.com/hassio-addons/addon-ssh Then run command docker exec -it homeassistant /bin/bash If you run pip list | grep pyporscheconnectapi, you should see which version is installed

barto64 commented 2 weeks ago

@royalidea , lesson learnt, thanks a lot, each day brings something new :)

I made the above, integration works fine now, i can see a few sensors being delivered. Besides, in DEBUG I can see also far more info about my char which are not yet delivered by the integration. WIP ;)

fredriklj commented 2 weeks ago

Put your desires on the wish list :-)

royalidea commented 2 weeks ago

@barto64 or others, is the data being updated for you? For me it seems to only update when i manually reload the integration.