outadoc / immich-home-assistant

Home Assistant component to display random pictures from your Immich library.
20 stars 7 forks source link

Integration stopped working after latest updates ( API error? ) #8

Closed se7entynine closed 1 month ago

se7entynine commented 1 month ago

Hey, the integration stopped working after the latest updates for immich. This is the error message in my home assistant logs:

Logger: custom_components.immich.config_flow
Quelle: custom_components/immich/config_flow.py:67
Integration: immich (Dokumentation, Probleme)
Erstmals aufgetreten: 13:11:30 (4 Vorkommnisse)
Zuletzt protokolliert: 13:21:11

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/immich/config_flow.py", line 67, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/immich/config_flow.py", line 44, in validate_input
    user_info = await hub.get_my_user_info()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/immich/hub.py", line 61, in get_my_user_info
    raise ApiError()
custom_components.immich.hub.ApiError

and this error message:

Logger: custom_components.immich.hub
Quelle: custom_components/immich/hub.py:60
Integration: immich (Dokumentation, Probleme)
Erstmals aufgetreten: 13:11:30 (4 Vorkommnisse)
Zuletzt protokolliert: 13:21:11

Error from API: body={"message":"Cannot GET /api/user/me","error":"Not Found","statusCode":404,"correlationId":"i7x75o8g"}
Error from API: body={"message":"Cannot GET /api/user/me","error":"Not Found","statusCode":404,"correlationId":"t22c5jyj"}
Error from API: body={"message":"Cannot GET /api/user/me","error":"Not Found","statusCode":404,"correlationId":"o95prepr"}
Error from API: body={"message":"Cannot GET /api/user/me","error":"Not Found","statusCode":404,"correlationId":"dlnt09vj"}

I'm using these versions: Immich: 1.106.3 HA Core 2024.6.2 Supervisor 2024.06.0 Operating System 12.3 Frontend 20240610.0

Apparently the integration can't properly call the immich api anymore. It's also referenced in their changelog:

BREAKING CHANGES Warning

  1. Underlying API changes

Anyone else has these issues?

LZStealth commented 1 month ago

This does appear to have been affected by the recent API changes.

I've listed the relevant changes below and submitted a pull request https://github.com/outadoc/immich-home-assistant/pull/9 /api/user/me -> /api/users/me /api/album -> /api/albums

Get all assets has been removed completely and can be replaced by the below /api/asset?isFavorite=true -> /api/search/metadata (with the search criteria of isFavorite)

Downloading images changed from serveFile to downloadAsset /api/asset/file/{asset_id} -> /api/assets/{asset_id}/original

These are as best I could see these changes and is working for myself now. Hope this helps 🙂

se7entynine commented 1 month ago

~I tried to change the hub.py with the visual studio code in HA, but unfortunatly I still get the same error message. My edited hub.py: https://pastebin.com/PX4s16Lv~ Do I have to refresh anything or reload ha? Future me: Yes I had to, it's working :D

Thanks for the help!