home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.64k stars 30.4k forks source link

forked-daapd integration doesn't retry #60724

Closed a-marcel closed 1 year ago

a-marcel commented 2 years ago

The problem

Hello,

i develop the addon Owntone server for hassio and in general it works together with the hassio core forked-daapd integration. Unfortunately the addon needs some time to be ready and the forked-daapd integration try to connect to the owntone server way to early and generate an error during the startup:

2021-11-30 22:50:41 ERROR (MainThread) [pyforked_daapd] Can not get http://172.30.33.4:3689/api/config with params None
2021-11-30 22:50:42 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up forked_daapd platform for media_player
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/forked_daapd/media_player.py", line 106, in async_setup_entry
    await forked_daapd_updater.async_init()
  File "/usr/src/homeassistant/homeassistant/components/forked_daapd/media_player.py", line 771, in async_init
    if websocket_port := server_config.get("websocket_port"):
AttributeError: 'NoneType' object has no attribute 'get'

After this one try, this integration never try again to connect and this results in a broken media player.

The current fix is to restart the core (Supervisor -> System -> Core -> Core restart). After the core is restarted, the integration works as expected.

Is there any possibility to implement a retry into the forked-daapd integration ?

Thanks a lot

What version of Home Assistant Core has the issue?

core-2021.11.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

forked-daapd

Link to integration documentation on our website

https://www.home-assistant.io/integrations/forked_daapd/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-11-30 22:50:41 ERROR (MainThread) [pyforked_daapd] Can not get http://172.30.33.4:3689/api/config with params None
2021-11-30 22:50:42 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up forked_daapd platform for media_player
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/forked_daapd/media_player.py", line 106, in async_setup_entry
    await forked_daapd_updater.async_init()
  File "/usr/src/homeassistant/homeassistant/components/forked_daapd/media_player.py", line 771, in async_init
    if websocket_port := server_config.get("websocket_port"):
AttributeError: 'NoneType' object has no attribute 'get'

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @uvjustin, mind taking a look at this issue as it has been labeled with an integration (forked_daapd) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


forked_daapd documentation forked_daapd source (message by IssueLinks)

uvjustin commented 1 year ago

@a-marcel @BenS89 Is this still an issue? Will take a look.

uvjustin commented 1 year ago

See if #96888 helps?

uvjustin commented 1 year ago

@a-marcel As of 2023.8.1 the OwnTone integration should retry on a failed setup. However, as suggested here, the add-on configuration should probably be changed as well. The startup field of the add-on's config.yml can be changed from application to services