CJNE / ha-porscheconnect

Porsche Connect custom component for Home Assistant
MIT License
28 stars 10 forks source link

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

Open barto64 opened 1 month ago

barto64 commented 1 month 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 1 month ago

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

fredriklj commented 1 month ago

What HA versions are you on?

barto64 commented 1 month 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 1 month 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 1 month 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 1 month 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 1 month ago

This is going to take a while.

fredriklj commented 1 month 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 1 month 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 1 month 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 3 weeks ago

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

fredriklj commented 3 weeks 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!