Skip to content

Commit

Permalink
Fix startup blocked by bluesound integration (#123483)
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisChrist authored and frenck committed Aug 10, 2024
1 parent d3f8fce commit fb3eae5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions homeassistant/components/bluesound/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,21 +317,24 @@ async def _start_poll_command(self):
await self.async_update_status()

except (TimeoutError, ClientError):
_LOGGER.error("Node %s:%s is offline, retrying later", self.name, self.port)
_LOGGER.error("Node %s:%s is offline, retrying later", self.host, self.port)
await asyncio.sleep(NODE_OFFLINE_CHECK_TIMEOUT)
self.start_polling()

except CancelledError:
_LOGGER.debug("Stopping the polling of node %s:%s", self.name, self.port)
_LOGGER.debug("Stopping the polling of node %s:%s", self.host, self.port)
except Exception:
_LOGGER.exception("Unexpected error in %s:%s", self.name, self.port)
_LOGGER.exception("Unexpected error in %s:%s", self.host, self.port)
raise

async def async_added_to_hass(self) -> None:
"""Start the polling task."""
await super().async_added_to_hass()

self._polling_task = self.hass.async_create_task(self._start_poll_command())
self._polling_task = self.hass.async_create_background_task(
self._start_poll_command(),
name=f"bluesound.polling_{self.host}:{self.port}",
)

async def async_will_remove_from_hass(self) -> None:
"""Stop the polling task."""
Expand Down

0 comments on commit fb3eae5

Please sign in to comment.