Handle None received from pyforked-daapd (#35830)
* Handle None received from API in forked-daapd * Bump pyforked-daapd version in requirements * Add test
This commit is contained in:
1 parent
53a9d39a81
commit
b3459d9190
5 files changed
+66
-33
No files matched your search
@@ -3,7 +3,7 @@
|
||||
"name": "forked-daapd",
|
||||
"documentation": "https://www.home-assistant.io/integrations/forked-daapd",
|
||||
"codeowners": ["@uvjustin"],
|
||||
"requirements": ["pyforked-daapd==0.1.8", "pylibrespot-java==0.1.0"],
|
||||
"requirements": ["pyforked-daapd==0.1.9", "pylibrespot-java==0.1.0"],
|
||||
"config_flow": true,
|
||||
"zeroconf": ["_daap._tcp.local."]
|
||||
}
|
||||
@@ -794,26 +794,29 @@ class ForkedDaapdUpdater:
|
||||
"queue" in update_types
|
||||
): # update queue, queue before player for async_play_media
|
||||
queue = await self._api.get_request("queue")
|
||||
update_events["queue"] = asyncio.Event()
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
SIGNAL_UPDATE_QUEUE.format(self._entry_id),
|
||||
queue,
|
||||
update_events["queue"],
|
||||
)
|
||||
if queue:
|
||||
update_events["queue"] = asyncio.Event()
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
SIGNAL_UPDATE_QUEUE.format(self._entry_id),
|
||||
queue,
|
||||
update_events["queue"],
|
||||
)
|
||||
# order of below don't matter
|
||||
if not {"outputs", "volume"}.isdisjoint(update_types): # update outputs
|
||||
outputs = (await self._api.get_request("outputs"))["outputs"]
|
||||
update_events[
|
||||
"outputs"
|
||||
] = asyncio.Event() # only for master, zones should ignore
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
SIGNAL_UPDATE_OUTPUTS.format(self._entry_id),
|
||||
outputs,
|
||||
update_events["outputs"],
|
||||
)
|
||||
self._add_zones(outputs)
|
||||
outputs = await self._api.get_request("outputs")
|
||||
if outputs:
|
||||
outputs = outputs["outputs"]
|
||||
update_events[
|
||||
"outputs"
|
||||
] = asyncio.Event() # only for master, zones should ignore
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
SIGNAL_UPDATE_OUTPUTS.format(self._entry_id),
|
||||
outputs,
|
||||
update_events["outputs"],
|
||||
)
|
||||
self._add_zones(outputs)
|
||||
if not {"database"}.isdisjoint(update_types):
|
||||
pipes, playlists = await asyncio.gather(
|
||||
self._api.get_pipes(), self._api.get_playlists()
|
||||
@@ -832,17 +835,18 @@ class ForkedDaapdUpdater:
|
||||
update_types
|
||||
): # update player
|
||||
player = await self._api.get_request("player")
|
||||
update_events["player"] = asyncio.Event()
|
||||
if update_events.get("queue"):
|
||||
await update_events[
|
||||
"queue"
|
||||
].wait() # make sure queue done before player for async_play_media
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
SIGNAL_UPDATE_PLAYER.format(self._entry_id),
|
||||
player,
|
||||
update_events["player"],
|
||||
)
|
||||
if player:
|
||||
update_events["player"] = asyncio.Event()
|
||||
if update_events.get("queue"):
|
||||
await update_events[
|
||||
"queue"
|
||||
].wait() # make sure queue done before player for async_play_media
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
SIGNAL_UPDATE_PLAYER.format(self._entry_id),
|
||||
player,
|
||||
update_events["player"],
|
||||
)
|
||||
if update_events:
|
||||
await asyncio.wait(
|
||||
[event.wait() for event in update_events.values()]
|
||||
|
||||
Reference in new issue
Block a user