mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Adjust websocket bridge logging in SamsungTV (#67809)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
d1ef92c17a
commit
c70bed86ff
@ -435,7 +435,7 @@ class SamsungTVWSBridge(SamsungTVBridge):
|
|||||||
"""Create or return a remote control instance."""
|
"""Create or return a remote control instance."""
|
||||||
if self._remote is None or not self._remote.is_alive():
|
if self._remote is None or not self._remote.is_alive():
|
||||||
# We need to create a new instance to reconnect.
|
# We need to create a new instance to reconnect.
|
||||||
LOGGER.debug("Create SamsungTVWSBridge for %s (%s)", CONF_NAME, self.host)
|
LOGGER.debug("Create SamsungTVWSBridge for %s", self.host)
|
||||||
assert self.port
|
assert self.port
|
||||||
self._remote = SamsungTVWSAsyncRemote(
|
self._remote = SamsungTVWSAsyncRemote(
|
||||||
host=self.host,
|
host=self.host,
|
||||||
@ -449,20 +449,24 @@ class SamsungTVWSBridge(SamsungTVBridge):
|
|||||||
# This is only happening when the auth was switched to DENY
|
# This is only happening when the auth was switched to DENY
|
||||||
# A removed auth will lead to socket timeout because waiting for auth popup is just an open socket
|
# A removed auth will lead to socket timeout because waiting for auth popup is just an open socket
|
||||||
except ConnectionFailure as err:
|
except ConnectionFailure as err:
|
||||||
LOGGER.debug("ConnectionFailure %s", err.__repr__())
|
LOGGER.info(
|
||||||
|
"Failed to get remote for %s, re-authentication required: %s",
|
||||||
|
self.host,
|
||||||
|
err.__repr__(),
|
||||||
|
)
|
||||||
self._notify_reauth_callback()
|
self._notify_reauth_callback()
|
||||||
except (WebSocketException, AsyncioTimeoutError, OSError) as err:
|
except (WebSocketException, AsyncioTimeoutError, OSError) as err:
|
||||||
LOGGER.debug("WebSocketException, OSError %s", err.__repr__())
|
LOGGER.debug(
|
||||||
|
"Failed to get remote for %s: %s", self.host, err.__repr__()
|
||||||
|
)
|
||||||
self._remote = None
|
self._remote = None
|
||||||
else:
|
else:
|
||||||
LOGGER.debug(
|
LOGGER.debug("Created SamsungTVWSBridge for %s", self.host)
|
||||||
"Created SamsungTVWSBridge for %s (%s)", CONF_NAME, self.host
|
|
||||||
)
|
|
||||||
if self._device_info is None:
|
if self._device_info is None:
|
||||||
# Initialise device info on first connect
|
# Initialise device info on first connect
|
||||||
await self.async_device_info()
|
await self.async_device_info()
|
||||||
if self.token != self._remote.token:
|
if self.token != self._remote.token:
|
||||||
LOGGER.debug(
|
LOGGER.info(
|
||||||
"SamsungTVWSBridge has provided a new token %s",
|
"SamsungTVWSBridge has provided a new token %s",
|
||||||
self._remote.token,
|
self._remote.token,
|
||||||
)
|
)
|
||||||
@ -477,5 +481,7 @@ class SamsungTVWSBridge(SamsungTVBridge):
|
|||||||
# Close the current remote connection
|
# Close the current remote connection
|
||||||
await self._remote.close()
|
await self._remote.close()
|
||||||
self._remote = None
|
self._remote = None
|
||||||
except OSError:
|
except OSError as err:
|
||||||
LOGGER.debug("Could not establish connection")
|
LOGGER.debug(
|
||||||
|
"Error closing connection to %s: %s", self.host, err.__repr__()
|
||||||
|
)
|
||||||
|
@ -695,7 +695,7 @@ async def test_turn_off_ws_os_error(
|
|||||||
assert await hass.services.async_call(
|
assert await hass.services.async_call(
|
||||||
DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_ID}, True
|
DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_ID}, True
|
||||||
)
|
)
|
||||||
assert "Could not establish connection" in caplog.text
|
assert "Error closing connection" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_volume_up(hass: HomeAssistant, remote: Mock) -> None:
|
async def test_volume_up(hass: HomeAssistant, remote: Mock) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user