Suppress UpnpResponseError in SamsungTV (#69984)

pull/69991/head
epenet 2022-04-13 18:20:44 +02:00 committed by GitHub
parent 85fc1aebfe
commit 2b69dffe57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -214,9 +214,7 @@ class SamsungTVDevice(MediaPlayerEntity):
startup_tasks.append(self._async_startup_app_list())
if self._dmr_device and not self._dmr_device.is_subscribed:
startup_tasks.append(
self._dmr_device.async_subscribe_services(auto_resubscribe=True)
)
startup_tasks.append(self._async_resubscribe_dmr())
if not self._dmr_device and self._ssdp_rendering_control_location:
startup_tasks.append(self._async_startup_dmr())
@ -274,7 +272,7 @@ class SamsungTVDevice(MediaPlayerEntity):
# NETWORK,NONE
upnp_factory = UpnpFactory(upnp_requester, non_strict=True)
upnp_device: UpnpDevice | None = None
with contextlib.suppress(UpnpConnectionError):
with contextlib.suppress(UpnpConnectionError, UpnpResponseError):
upnp_device = await upnp_factory.async_create_device(
self._ssdp_rendering_control_location
)
@ -309,6 +307,11 @@ class SamsungTVDevice(MediaPlayerEntity):
LOGGER.debug("Error while subscribing during device connect: %r", err)
raise
async def _async_resubscribe_dmr(self) -> None:
assert self._dmr_device
with contextlib.suppress(UpnpConnectionError):
await self._dmr_device.async_subscribe_services(auto_resubscribe=True)
async def _async_shutdown_dmr(self) -> None:
"""Handle removal."""
if (dmr_device := self._dmr_device) is not None: