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: if self._remote is None:
# We need to create a new instance to reconnect. # We need to create a new instance to reconnect.
try: try:
LOGGER.debug("Create SamsungRemote") LOGGER.debug(
"Create SamsungTVLegacyBridge for %s (%s)", CONF_NAME, self.host
)
self._remote = Remote(self.config.copy()) self._remote = Remote(self.config.copy())
# 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
@ -199,7 +201,7 @@ class SamsungTVLegacyBridge(SamsungTVBridge):
def stop(self): def stop(self):
"""Stop Bridge.""" """Stop Bridge."""
LOGGER.debug("Stopping SamsungRemote") LOGGER.debug("Stopping SamsungTVLegacyBridge")
self.close_remote() self.close_remote()
@ -272,7 +274,7 @@ class SamsungTVWSBridge(SamsungTVBridge):
# We need to create a new instance to reconnect. # We need to create a new instance to reconnect.
try: try:
LOGGER.debug( LOGGER.debug(
"Create SamsungTVWS for %s (%s)", VALUE_CONF_NAME, self.host "Create SamsungTVWSBridge for %s (%s)", CONF_NAME, self.host
) )
self._remote = SamsungTVWS( self._remote = SamsungTVWS(
host=self.host, host=self.host,
@ -293,5 +295,5 @@ class SamsungTVWSBridge(SamsungTVBridge):
def stop(self): def stop(self):
"""Stop Bridge.""" """Stop Bridge."""
LOGGER.debug("Stopping SamsungTVWS") LOGGER.debug("Stopping SamsungTVWSBridge")
self.close_remote() 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): async def async_step_ssdp(self, discovery_info: DiscoveryInfoType):
"""Handle a flow initialized by ssdp discovery.""" """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]) self._udn = _strip_uuid(discovery_info[ATTR_UPNP_UDN])
await self._async_set_unique_id_from_udn() await self._async_set_unique_id_from_udn()
await self._async_start_discovery_for_host( 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): async def async_step_dhcp(self, discovery_info: DiscoveryInfoType):
"""Handle a flow initialized by dhcp discovery.""" """Handle a flow initialized by dhcp discovery."""
LOGGER.debug("Samsung device found via DHCP: %s", discovery_info)
self._mac = discovery_info[MAC_ADDRESS] self._mac = discovery_info[MAC_ADDRESS]
await self._async_start_discovery_for_host(discovery_info[IP_ADDRESS]) await self._async_start_discovery_for_host(discovery_info[IP_ADDRESS])
await self._async_set_device_unique_id() 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): async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType):
"""Handle a flow initialized by zeroconf discovery.""" """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"]) self._mac = format_mac(discovery_info[ATTR_PROPERTIES]["deviceid"])
await self._async_start_discovery_for_host(discovery_info[CONF_HOST]) await self._async_start_discovery_for_host(discovery_info[CONF_HOST])
await self._async_set_device_unique_id() await self._async_set_device_unique_id()