mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 16:17:20 +00:00
Add extra logging in samsungtv (#143933)
* Cache and reuse REST client in samsungtv * Add logging
This commit is contained in:
parent
09518b1a71
commit
98cbc2a182
@ -566,17 +566,25 @@ class SamsungTVWSBridge(
|
|||||||
"""Try to gather infos of this TV."""
|
"""Try to gather infos of this TV."""
|
||||||
if self._rest_api is None:
|
if self._rest_api is None:
|
||||||
assert self.port
|
assert self.port
|
||||||
rest_api = SamsungTVAsyncRest(
|
self._rest_api = SamsungTVAsyncRest(
|
||||||
host=self.host,
|
host=self.host,
|
||||||
session=async_get_clientsession(self.hass),
|
session=async_get_clientsession(self.hass),
|
||||||
port=self.port,
|
port=self.port,
|
||||||
timeout=TIMEOUT_WEBSOCKET,
|
timeout=TIMEOUT_WEBSOCKET,
|
||||||
)
|
)
|
||||||
|
|
||||||
with contextlib.suppress(*REST_EXCEPTIONS):
|
try:
|
||||||
device_info: dict[str, Any] = await rest_api.rest_device_info()
|
device_info: dict[str, Any] = await self._rest_api.rest_device_info()
|
||||||
LOGGER.debug("Device info on %s is: %s", self.host, device_info)
|
LOGGER.debug("Device info on %s is: %s", self.host, device_info)
|
||||||
self._device_info = device_info
|
self._device_info = device_info
|
||||||
|
except REST_EXCEPTIONS as err:
|
||||||
|
LOGGER.debug(
|
||||||
|
"Failed to load device info from %s:%s: %s",
|
||||||
|
self.host,
|
||||||
|
self.port,
|
||||||
|
str(err),
|
||||||
|
)
|
||||||
|
else:
|
||||||
return device_info
|
return device_info
|
||||||
|
|
||||||
return None if force else self._device_info
|
return None if force else self._device_info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user