skodaconnect / homeassistant-skodaconnect

Skoda Connect - A home assistant plugin to add integration with your car
Apache License 2.0
233 stars 27 forks source link

Image can't be loaded #276

Closed ChristophCaina closed 6 months ago

ChristophCaina commented 7 months ago

After restarting my System, it seems that the images can't be loaded anymore. All entities are available, except the car-images

grafik grafik

After reloading the config, all entities were unavailable - and the following error could be seen in the logs.

Logger: homeassistant.components.switch
Quelle: helpers/entity_platform.py:356
Integration: Schalter ([Dokumentation](https://rc.home-assistant.io/integrations/switch), [Probleme](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+switch%22))
Erstmals aufgetreten: 19:45:41 (2 Vorkommnisse)
Zuletzt protokolliert: 19:46:38

Error while setting up skodaconnect platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/skodaconnect/switch.py", line 25, in async_setup_entry
    data = hass.data[DOMAIN][entry.entry_id][DATA]
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'b9414cf02e2eb912fbb7407fea826e2c'

After installing beta 02 from HA 2024.5 - the integration came back, but the images are still not available.

dvx76 commented 7 months ago

At first sight the debug doesn't seem related to the issue (the image entities are sensors, not switches).

The image issue reminds me of #191 which turned out to be a temporary glitch in the API responses.

UnsignedLong commented 7 months ago

I have the same kind of error. I have two cars configured but there is only one car at a time that'll work. For the not working car I have the same key error as @ChristophCaina for switch, binary_sensor and device_tracker. If I reload the non working instance it starts working but the other one stops working with the mentioned key errors.

UnsignedLong commented 7 months ago

Downgrading the custom component to 1.2.8 solves my issue, bug was introduces in 1.2.9. Most obvious change here is the bump of skodaconnect to 1.3.10, but I don't spot anything right now that'll explain this behaviour.

homeassistant-skodaconnect 1.2.8 vs 1.2.9: https://github.com/skodaconnect/homeassistant-skodaconnect/compare/1.2.8...1.2.9

skodaconnect 1.3.9 vs 1.3.10: https://github.com/skodaconnect/skodaconnect/compare/1.3.9...1.3.10

dvx76 commented 7 months ago

It might be that the fact of re-installing, rather than the downgrade itself, fixed your issue.

Either way, none of this would be related to the missing model image URL sensors reported in this issue. I am still convinced that is due to a server-side issue. I regularly see owners on forums complain about missing model images in the MySkoda app as well.

If you have persisting issues with KeyErrors in hass.data[DOMAIN][entry.entry_id][DATA] please create a separate issue.

dvx76 commented 7 months ago

FWIW same KeyError was seen in #206

UnsignedLong commented 7 months ago

Can reproduce it by installing a version > 1.2.8 again. Will create a new issue later on.

stickpin commented 6 months ago

I think in volkswagencarnet we are hitting the same issue after HA 2024.5.x. It's easily reproducible once you have multiple vehicles configured in the integration. I am trying to find the root cause as well.

dvx76 commented 6 months ago

Thanks for sharing! I can only test with one car myself. Upgraded to HA 2024.5.1 and no issue (with one car).

dvx76 commented 6 months ago

@ChristophCaina do you still have the issue with the model image URL sensors? I can't reproduce. If you still have the problem please look for matching debug logs.

ChristophCaina commented 6 months ago

For a couple of days it seems to work now - anyway, I have removed the Image from the Dashboard recently, so I don't see it immediately - If it would fail

dvx76 commented 6 months ago

Thanks for the update. Please reopen or open a new issue if it happens again and you have logs which suggest it's a client side issue.

stickpin commented 6 months ago

@dvx76 just to let you know, I believe you have the same issue as we are in the volkwagencarnet:

https://github.com/skodaconnect/homeassistant-skodaconnect/blob/dab59668d619debe9f633473855aaf75cc4b6403/custom_components/skodaconnect/__init__.py#L245-L258

The use of hass.data by the components is happening before it's actually getting assigned. You need to change the order, see my PR for more details: https://github.com/robinostlund/homeassistant-volkswagencarnet/pull/617

The issue will be visible only if you have more than one vehicle configured in the integration.