mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +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."""
|
||||
if self._rest_api is None:
|
||||
assert self.port
|
||||
rest_api = SamsungTVAsyncRest(
|
||||
self._rest_api = SamsungTVAsyncRest(
|
||||
host=self.host,
|
||||
session=async_get_clientsession(self.hass),
|
||||
port=self.port,
|
||||
timeout=TIMEOUT_WEBSOCKET,
|
||||
)
|
||||
|
||||
with contextlib.suppress(*REST_EXCEPTIONS):
|
||||
device_info: dict[str, Any] = await rest_api.rest_device_info()
|
||||
try:
|
||||
device_info: dict[str, Any] = await self._rest_api.rest_device_info()
|
||||
LOGGER.debug("Device info on %s is: %s", self.host, 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 None if force else self._device_info
|
||||
|
Loading…
x
Reference in New Issue
Block a user