From 3d8804bbcfd968b23eaf858d9a8ebd004ecf1318 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Fri, 4 Jun 2021 18:02:39 +0200 Subject: [PATCH] Improve logging for SamsungTV (#51477) --- homeassistant/components/samsungtv/bridge.py | 10 ++++++---- homeassistant/components/samsungtv/config_flow.py | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/samsungtv/bridge.py b/homeassistant/components/samsungtv/bridge.py index 84b518a4633..7e1c24c6d2f 100644 --- a/homeassistant/components/samsungtv/bridge.py +++ b/homeassistant/components/samsungtv/bridge.py @@ -184,7 +184,9 @@ class SamsungTVLegacyBridge(SamsungTVBridge): if self._remote is None: # We need to create a new instance to reconnect. try: - LOGGER.debug("Create SamsungRemote") + LOGGER.debug( + "Create SamsungTVLegacyBridge for %s (%s)", CONF_NAME, self.host + ) self._remote = Remote(self.config.copy()) # 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 @@ -199,7 +201,7 @@ class SamsungTVLegacyBridge(SamsungTVBridge): def stop(self): """Stop Bridge.""" - LOGGER.debug("Stopping SamsungRemote") + LOGGER.debug("Stopping SamsungTVLegacyBridge") self.close_remote() @@ -272,7 +274,7 @@ class SamsungTVWSBridge(SamsungTVBridge): # We need to create a new instance to reconnect. try: LOGGER.debug( - "Create SamsungTVWS for %s (%s)", VALUE_CONF_NAME, self.host + "Create SamsungTVWSBridge for %s (%s)", CONF_NAME, self.host ) self._remote = SamsungTVWS( host=self.host, @@ -293,5 +295,5 @@ class SamsungTVWSBridge(SamsungTVBridge): def stop(self): """Stop Bridge.""" - LOGGER.debug("Stopping SamsungTVWS") + LOGGER.debug("Stopping SamsungTVWSBridge") self.close_remote() diff --git a/homeassistant/components/samsungtv/config_flow.py b/homeassistant/components/samsungtv/config_flow.py index 46800e1653b..7c6dea56b96 100644 --- a/homeassistant/components/samsungtv/config_flow.py +++ b/homeassistant/components/samsungtv/config_flow.py @@ -224,6 +224,7 @@ class SamsungTVConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async def async_step_ssdp(self, discovery_info: DiscoveryInfoType): """Handle a flow initialized by ssdp discovery.""" + LOGGER.debug("Samsung device found via SSDP: %s", discovery_info) self._udn = _strip_uuid(discovery_info[ATTR_UPNP_UDN]) await self._async_set_unique_id_from_udn() await self._async_start_discovery_for_host( @@ -242,6 +243,7 @@ class SamsungTVConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async def async_step_dhcp(self, discovery_info: DiscoveryInfoType): """Handle a flow initialized by dhcp discovery.""" + LOGGER.debug("Samsung device found via DHCP: %s", discovery_info) self._mac = discovery_info[MAC_ADDRESS] await self._async_start_discovery_for_host(discovery_info[IP_ADDRESS]) await self._async_set_device_unique_id() @@ -250,6 +252,7 @@ class SamsungTVConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType): """Handle a flow initialized by zeroconf discovery.""" + LOGGER.debug("Samsung device found via ZEROCONF: %s", discovery_info) self._mac = format_mac(discovery_info[ATTR_PROPERTIES]["deviceid"]) await self._async_start_discovery_for_host(discovery_info[CONF_HOST]) await self._async_set_device_unique_id()