From c986b7e5cb8e46bca0f885cbaeb88c60a240ae8f Mon Sep 17 00:00:00 2001 From: David Mulcahey Date: Fri, 20 Sep 2024 14:52:51 -0400 Subject: [PATCH 1/2] Fix startup polling check --- zha/application/gateway.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zha/application/gateway.py b/zha/application/gateway.py index 78bf9379..a1a0d903 100644 --- a/zha/application/gateway.py +++ b/zha/application/gateway.py @@ -387,13 +387,12 @@ async def async_initialize_devices_and_entities(self) -> None: *(dev.async_initialize(from_cache=True) for dev in self.devices.values()) ) - if not self.config.config.device_options.enable_mains_startup_polling: - _LOGGER.debug("Polling of mains powered devices at startup is disabled") - return - async def fetch_updated_state() -> None: """Fetch updated state for mains powered devices.""" - await self.async_fetch_updated_state_mains() + if not self.config.config.device_options.enable_mains_startup_polling: + _LOGGER.debug("Polling of mains powered devices at startup is disabled") + else: + await self.async_fetch_updated_state_mains() _LOGGER.debug("Allowing polled requests") self.config.allow_polling = True From 7b96544cbe79e5840b8c8a4fa84498a3e509b59a Mon Sep 17 00:00:00 2001 From: David Mulcahey Date: Fri, 20 Sep 2024 15:05:36 -0400 Subject: [PATCH 2/2] reverse conditional --- zha/application/gateway.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zha/application/gateway.py b/zha/application/gateway.py index a1a0d903..5fe07b4c 100644 --- a/zha/application/gateway.py +++ b/zha/application/gateway.py @@ -389,10 +389,10 @@ async def async_initialize_devices_and_entities(self) -> None: async def fetch_updated_state() -> None: """Fetch updated state for mains powered devices.""" - if not self.config.config.device_options.enable_mains_startup_polling: - _LOGGER.debug("Polling of mains powered devices at startup is disabled") - else: + if self.config.config.device_options.enable_mains_startup_polling: await self.async_fetch_updated_state_mains() + else: + _LOGGER.debug("Polling of mains powered devices at startup is disabled") _LOGGER.debug("Allowing polled requests") self.config.allow_polling = True