pypolestar / polestar_api

Polestar API - Home Assistant Component
MIT License
137 stars 25 forks source link

Image fails initial load #175

Open jschlyter opened 5 days ago

jschlyter commented 5 days ago

After starting hass, the image element does not load correctly. Reloading the integration fixes this, but I cannot see why.

One option would be to expose the URL of the car as a plain sensor as well.

leeyuentuen commented 3 days ago

maybe missing the init of the device? https://github.com/pypolestar/polestar_api/pull/173/files#diff-7572677b071e2c074082f7d9f0f8e2d8c98f561f6105760b266781ee8037ec44L53

jschlyter commented 3 days ago

The device init is called earlier in https://github.com/pypolestar/polestar_api/blob/main/custom_components/polestar_api/__init__.py#L49 ?

jschlyter commented 3 days ago

Do need to update the device before checking the URL?https://github.com/pypolestar/polestar_api/blob/main/custom_components/polestar_api/image.py#L99

It works sometimes so I guess this is a timing issue.

jschlyter commented 3 days ago

async_load_image is never used. On the other hand, we're not forcing update of the device so we might end up with a device not update the first time the image url is requested.