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

Images not provided anymore #289

Open
jbvs01 opened this issue Jan 10, 2025 · 10 comments
Open

Images not provided anymore #289

jbvs01 opened this issue Jan 10, 2025 · 10 comments

Comments

@jbvs01
Copy link

jbvs01 commented Jan 10, 2025

Version of the custom_component

0.1.2

Configuration

No Integration specific entry ?

Describe the bug

After updating to homeassistant to 2025.1.2 i noticed, that the images provided by the Integration are not available anymore
(maybe it's independant to the update, noticed it just afterwards)

Debug log

(VIN manually replaced)
2025-01-10 08:45:02.215 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration porscheconnect which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 08:45:28.885 ERROR (MainThread) [pyporscheconnectapi.vehicle] Could not get capabilities, error communicating with API: UNKNOWN_ERROR_502
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 96, in request
resp.raise_for_status() # A common error seem to be: httpx.HTTPStatusError: Server error '504 Gateway Time-out'
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '502 Bad Gateway' for url 'https://api.ppa.porsche.com/app//connect/v1/vehicles/>VIN</pictures'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/vehicle.py", line 308, in get_picture_locations
resp = await self.connection.get(
^^^^^^^^^^^^^^^^^^^^^^^^^^
f"/connect/v1/vehicles/{self.vin}/pictures",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 69, in get
return await self.request("GET", url, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 99, in request
raise PorscheExceptionError(exc.response.status_code) from exc
pyporscheconnectapi.exceptions.PorscheExceptionError
2025-01-10 08:45:30.487 WARNING (ImportExecutor_0) [py.warnings] /usr/local/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior
Bool = partial(_str2bool)

2025-01-10 08:45:33.771 ERROR (MainThread) [homeassistant.components.image] Error while setting up porscheconnect platform for image
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 366, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/porscheconnect/image.py", line 75, in async_setup_entry
PorscheImage(hass, coordinator, vehicle, description)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/porscheconnect/image.py", line 103, in init
self._attr_image_url = vehicle.picture_locations[description.view]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'frontView'
2025-01-10 09:00:36.181 ERROR (MainThread) [pyporscheconnectapi.vehicle] Could not get capabilities, error communicating with API: UNKNOWN_ERROR_502
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 96, in request
resp.raise_for_status() # A common error seem to be: httpx.HTTPStatusError: Server error '504 Gateway Time-out'
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '502 Bad Gateway' for url 'https://api.ppa.porsche.com/app//connect/v1/vehicles/>VIN</pictures'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/vehicle.py", line 308, in get_picture_locations
resp = await self.connection.get(
^^^^^^^^^^^^^^^^^^^^^^^^^^
f"/connect/v1/vehicles/{self.vin}/pictures",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 69, in get
return await self.request("GET", url, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 99, in request
raise PorscheExceptionError(exc.response.status_code) from exc
pyporscheconnectapi.exceptions.PorscheExceptionError

Screenshot_20250110_091341_Home Assistant

@fredriklj
Copy link
Collaborator

HTTP error 504 usually indicates server-side problems. Can you confirm that this problem is temporary? Is the problem still there If you restart you home assistant now, a few days later?

@jbvs01
Copy link
Author

jbvs01 commented Jan 12, 2025

Hi @fredriklj,
I Tried several times to reload the integration and today an restart of complete HA as well. Nothing changed.

@fredriklj
Copy link
Collaborator

Do you still get Server error '504 Gateway Time-out'?

@jbvs01
Copy link
Author

jbvs01 commented Jan 12, 2025

Yes, i do.

In the meanwhile the porsche app itself works fine (all picture in "car details" are available),
also each other value coming from the API (e.g. chariging state & speed) are active & real-time.

2025-01-12 10:28:17.403 ERROR (MainThread) [pyporscheconnectapi.vehicle] Could not get capabilities, error communicating with API: UNKNOWN_ERROR_502
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 96, in request
resp.raise_for_status() # A common error seem to be: httpx.HTTPStatusError: Server error '504 Gateway Time-out'
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '502 Bad Gateway' for url 'https://api.ppa.porsche.com/app//connect/v1/vehicles/>VIN</pictures'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/vehicle.py", line 308, in get_picture_locations
resp = await self.connection.get(
^^^^^^^^^^^^^^^^^^^^^^^^^^
f"/connect/v1/vehicles/{self.vin}/pictures",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 69, in get
return await self.request("GET", url, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 99, in request
raise PorscheExceptionError(exc.response.status_code) from exc
pyporscheconnectapi.exceptions.PorscheExceptionError

2025-01-12 10:28:21.913 ERROR (MainThread) [homeassistant.components.image] Error while setting up porscheconnect platform for image
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 366, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/porscheconnect/image.py", line 75, in async_setup_entry
PorscheImage(hass, coordinator, vehicle, description)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/porscheconnect/image.py", line 103, in init
self._attr_image_url = vehicle.picture_locations[description.view]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'frontView'

2025-01-12 12:00:11.408 ERROR (MainThread) [pyporscheconnectapi.vehicle] Could not get current overview, error communicating with API: 'UPSTREAM_TIMEOUT
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 96, in request
resp.raise_for_status() # A common error seem to be: httpx.HTTPStatusError: Server error '504 Gateway Time-out'
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '504 Gateway Time-out' for url 'https://api.ppa.porsche.com/app//connect/v1/vehicles/>VIN<?mf=ACV_STATE&mf=ALARM_STATE&mf=BATTERY_CHARGING_STATE&mf=BATTERY_LEVEL&mf=BLEID_DDADATA&mf=CHARGING_PROFILES&mf=CHARGING_SETTINGS&mf=CHARGING_SUMMARY&mf=CLIMATIZER_STATE&mf=DEPARTURES&mf=E_RANGE&mf=FUEL_LEVEL&mf=FUEL_RESERVE&mf=GLOBAL_PRIVACY_MODE&mf=GPS_LOCATION&mf=HEATING_STATE&mf=HVAC_STATE&mf=INTERMEDIATE_SERVICE_RANGE&mf=INTERMEDIATE_SERVICE_TIME&mf=LOCK_STATE_VEHICLE&mf=MAIN_SERVICE_RANGE&mf=MAIN_SERVICE_TIME&mf=MILEAGE&mf=OIL_LEVEL_CURRENT&mf=OIL_LEVEL_MAX&mf=OIL_LEVEL_MIN_WARNING&mf=OIL_SERVICE_RANGE&mf=OIL_SERVICE_TIME&mf=OPEN_STATE_CHARGE_FLAP_LEFT&mf=OPEN_STATE_CHARGE_FLAP_RIGHT&mf=OPEN_STATE_DOOR_FRONT_LEFT&mf=OPEN_STATE_DOOR_FRONT_RIGHT&mf=OPEN_STATE_DOOR_REAR_LEFT&mf=OPEN_STATE_DOOR_REAR_RIGHT&mf=OPEN_STATE_LID_FRONT&mf=OPEN_STATE_LID_REAR&mf=OPEN_STATE_SERVICE_FLAP&mf=OPEN_STATE_SPOILER&mf=OPEN_STATE_SUNROOF&mf=OPEN_STATE_SUNROOF_REAR&mf=OPEN_STATE_TOP&mf=OPEN_STATE_WINDOW_FRONT_LEFT&mf=OPEN_STATE_WINDOW_FRONT_RIGHT&mf=OPEN_STATE_WINDOW_REAR_LEFT&mf=OPEN_STATE_WINDOW_REAR_RIGHT&mf=PAIRING_CODE&mf=PARKING_BRAKE&mf=PARKING_LIGHT&mf=PRED_PRECON_LOCATION_EXCEPTIONS&mf=PRED_PRECON_USER_SETTINGS&mf=RANGE&mf=REMOTE_ACCESS_AUTHORIZATION&mf=SERVICE_PREDICTIONS&mf=THEFT_STATE&mf=TIMERS&mf=TIRE_PRESSURE&mf=VTS_MODES&wakeUpJob=5ac69f28-d5d2-42d6-87ad-7431706e33f7'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/vehicle.py", line 263, in get_current_overview
self.status = await self.connection.get(
^^^^^^^^^^^^^^^^^^^^^^^^^^
f"/connect/v1/vehicles/{self.vin}?{measurements+wakeup}",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 69, in get
return await self.request("GET", url, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyporscheconnectapi/connection.py", line 99, in request
raise PorscheExceptionError(exc.response.status_code) from exc
pyporscheconnectapi.exceptions.PorscheExceptionError

@fredriklj
Copy link
Collaborator

I see you are getting 502 Bad Gateway on the call for the image uris and then 504 Gateway Time-out when trying to get the current overview.

Would it be possible for you to try the cli, to see if that works?

porschecli -d -e [your e-mail adress] -p [your password] pictures -v [vin]

@mik99git
Copy link

I have the same problem that the images are not available in HA. Here is my output from the cli:

DEBUG:pyporscheconnectapi.account:Building vehicle list
DEBUG:httpcore.connection:connect_tcp.started host='api.ppa.porsche.com' port=443 local_address=None timeout=90 socket_options=None
DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x000001E327E98590>
DEBUG:httpcore.connection:start_tls.started ssl_context=<ssl.SSLContext object at 0x000001E327D75E20> server_hostname='api.ppa.porsche.com' timeout=90
DEBUG:httpcore.connection:start_tls.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x000001E327D8BC50>
DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore.http11:send_request_headers.complete
DEBUG:httpcore.http11:send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore.http11:send_request_body.complete
DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Tue, 14 Jan 2025 10:13:52 GMT'), (b'Content-Type', b'application/json'), (b'Content-Length', b'532'), (b'Connection', b'keep-alive'), (b'cache-control', b'no-cache, no-store, max-age=0, must-revalidate'), (b'pragma', b'no-cache'), (b'expires', b'0'), (b'x-content-type-options', b'nosniff'), (b'strict-transport-security', b'max-age=31536000 ; includeSubDomains'), (b'x-frame-options', b'DENY'), (b'x-xss-protection', b'0'), (b'referrer-policy', b'no-referrer')])
INFO:httpx:HTTP Request: GET https://api.ppa.porsche.com/app//connect/v1/vehicles "HTTP/1.1 200 OK"
DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore.http11:receive_response_body.complete
DEBUG:httpcore.http11:response_closed.started
DEBUG:httpcore.http11:response_closed.complete
DEBUG:pyporscheconnectapi.account:Got vehicle {'vin': '###VIN###', 'modelName': 'Taycan 4S', 'customName': 'mik-taycan', 'modelType': {'code': 'Y1ADJ1', 'year': '2025', 'steeringPosition': 'LEFT_HAND_DRIVE', 'body': 'SEDAN', 'generation': 'J1', 'revision': 2, 'model': 'TAYCAN', 'engine': 'BEV'}, 'systemInfo': {'driverExperience': '1.0', 'privacyStyle': 2, 'cluster': '3B'}, 'exteriorColorName': 'provence/provence', 'color': {'primaryExteriorColor': '94849c'}, 'connect': True, 'greyConnectStoreURL': 'https://connect-store.porsche.com', 'timestamp': '2025-01-14T10:13:52Z', 'commands': [], 'measurements': []}
DEBUG:pyporscheconnectapi.vehicle:Getting picture urls for vehicle ###VIN###
DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore.http11:send_request_headers.complete
DEBUG:httpcore.http11:send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore.http11:send_request_body.complete
DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 502, b'Bad Gateway', [(b'Date', b'Tue, 14 Jan 2025 10:13:52 GMT'), (b'Content-Type', b'application/json'), (b'Content-Length', b'219'), (b'Connection', b'keep-alive'), (b'cache-control', b'no-cache, no-store, max-age=0, must-revalidate'), (b'pragma', b'no-cache'), (b'expires', b'0'), (b'x-content-type-options', b'nosniff'), (b'strict-transport-security', b'max-age=31536000 ; includeSubDomains'), (b'x-frame-options', b'DENY'), (b'x-xss-protection', b'0'), (b'referrer-policy', b'no-referrer')])
INFO:httpx:HTTP Request: GET https://api.ppa.porsche.com/app//connect/v1/vehicles/###VIN###/pictures "HTTP/1.1 502 Bad Gateway"
DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore.http11:receive_response_body.complete
DEBUG:httpcore.http11:response_closed.started
DEBUG:httpcore.http11:response_closed.complete
ERROR:pyporscheconnectapi.vehicle:Could not get capabilities, error communicating with API: 'UNKNOWN_ERROR_502
{}
DEBUG:httpcore.connection:close.started
DEBUG:httpcore.connection:close.complete

@fredriklj
Copy link
Collaborator

Thanks for the cli output as well. I can't reproduce this myself, and a 502 Bad Gateway does indicate something is wrong upstreams. Can you confirm that your VIN is correct in the redacted lines above? In particular the GET request for pictures? Does it (the VIN) contain any other characters than [0-9A-Z]?

@mik99git
Copy link

yes, the VIN is correct. The API was able to get the information about the vehicle, it's just the images that are not working.

@fredriklj
Copy link
Collaborator

Yup, I can see that, was just wondering if there were some characters in the VIN that messed up the URI. I still think this may be an error on the server side, in perhaps one of the instances (but not others). The app could perhaps cache the images, making it harder for them to detect it.

For the time being, I think we will just have to wait and see if it resolves itself or if this is a change that gets rolled out globally.

@Dominik-Notzon
Copy link

I got the same problem, the images are not showing up in the app and not in HA. It's probably a server-side issue - is there a way that we could add caching into HA? Maybe save the pic locally and only refresh it periodically? I don't think the image of the car is going to change that often 😁

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

No branches or pull requests

4 participants