Improve multipan debug logging (#94580)

This commit is contained in:
Erik Montnemery 2023-06-14 10:26:54 +02:00 committed by GitHub
parent 6a75f69e0f
commit bd156bb129
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,19 +96,29 @@ class MultiprotocolAddonManager(AddonManager):
) -> None: ) -> None:
"""Register a multipan platform.""" """Register a multipan platform."""
self._platforms[integration_domain] = platform self._platforms[integration_domain] = platform
if self._channel is not None or not await platform.async_using_multipan(hass):
channel = await platform.async_get_channel(hass)
using_multipan = await platform.async_using_multipan(hass)
_LOGGER.info(
"Registering new multipan platform '%s', using multipan: %s, channel: %s",
integration_domain,
using_multipan,
channel,
)
if self._channel is not None or not using_multipan:
return return
new_channel = await platform.async_get_channel(hass) if channel is None:
if new_channel is None:
return return
_LOGGER.info( _LOGGER.info(
"Setting multipan channel to %s (source: '%s')", "Setting multipan channel to %s (source: '%s')",
new_channel, channel,
integration_domain, integration_domain,
) )
self.async_set_channel(new_channel) self.async_set_channel(channel)
async def async_change_channel( async def async_change_channel(
self, channel: int, delay: float self, channel: int, delay: float