Improve logging for SamsungTV (#51477)

This commit is contained in:
Simone Chemelli 2021-06-04 18:02:39 +02:00 committed by GitHub
parent 12f2482c9b
commit 3d8804bbcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -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()

View file

@ -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()