From 39ac680c9c441d37b82af3ea4e76f4695cd96ac1 Mon Sep 17 00:00:00 2001 From: Guy Martin Date: Thu, 10 Oct 2024 07:06:13 +0000 Subject: [PATCH 1/3] Send fast_poll_stop even if checkin doesn't get an answer. --- zha/zigbee/cluster_handlers/general.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zha/zigbee/cluster_handlers/general.py b/zha/zigbee/cluster_handlers/general.py index e103f1199..08cb33f06 100644 --- a/zha/zigbee/cluster_handlers/general.py +++ b/zha/zigbee/cluster_handlers/general.py @@ -627,9 +627,12 @@ def cluster_command( async def check_in_response(self, tsn: int) -> None: """Respond to checkin command.""" - await self.checkin_response(True, self.CHECKIN_FAST_POLL_TIMEOUT, tsn=tsn) - if self._endpoint.device.manufacturer_code not in self._IGNORED_MANUFACTURER_ID: - await self.set_long_poll_interval(self.LONG_POLL) + try: + await self.checkin_response(True, self.CHECKIN_FAST_POLL_TIMEOUT, tsn=tsn) + if self._endpoint.device.manufacturer_code not in self._IGNORED_MANUFACTURER_ID: + await self.set_long_poll_interval(self.LONG_POLL) + except Exception: + self.error(traceback.format_exc()) await self.fast_poll_stop() def skip_manufacturer_id(self, manufacturer_code: int) -> None: From 27a282820339d3acf14ab70e8bdc22940b40cc46 Mon Sep 17 00:00:00 2001 From: Guy Martin Date: Thu, 10 Oct 2024 07:07:47 +0000 Subject: [PATCH 2/3] Import traceback. --- zha/zigbee/cluster_handlers/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/zha/zigbee/cluster_handlers/__init__.py b/zha/zigbee/cluster_handlers/__init__.py index 321b9e194..d787796b9 100644 --- a/zha/zigbee/cluster_handlers/__init__.py +++ b/zha/zigbee/cluster_handlers/__init__.py @@ -10,6 +10,7 @@ import logging from typing import TYPE_CHECKING, Any, Final, ParamSpec, TypedDict +import traceback import zigpy.exceptions import zigpy.util import zigpy.zcl From 498fe22023f14f2251212244c67da88d93478673 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:26:17 +0000 Subject: [PATCH 3/3] Apply pre-commit auto fixes --- zha/zigbee/cluster_handlers/__init__.py | 2 +- zha/zigbee/cluster_handlers/general.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/zha/zigbee/cluster_handlers/__init__.py b/zha/zigbee/cluster_handlers/__init__.py index d787796b9..a2c1e321b 100644 --- a/zha/zigbee/cluster_handlers/__init__.py +++ b/zha/zigbee/cluster_handlers/__init__.py @@ -8,9 +8,9 @@ from enum import Enum import functools import logging +import traceback from typing import TYPE_CHECKING, Any, Final, ParamSpec, TypedDict -import traceback import zigpy.exceptions import zigpy.util import zigpy.zcl diff --git a/zha/zigbee/cluster_handlers/general.py b/zha/zigbee/cluster_handlers/general.py index 08cb33f06..46bbbccca 100644 --- a/zha/zigbee/cluster_handlers/general.py +++ b/zha/zigbee/cluster_handlers/general.py @@ -629,7 +629,10 @@ async def check_in_response(self, tsn: int) -> None: """Respond to checkin command.""" try: await self.checkin_response(True, self.CHECKIN_FAST_POLL_TIMEOUT, tsn=tsn) - if self._endpoint.device.manufacturer_code not in self._IGNORED_MANUFACTURER_ID: + if ( + self._endpoint.device.manufacturer_code + not in self._IGNORED_MANUFACTURER_ID + ): await self.set_long_poll_interval(self.LONG_POLL) except Exception: self.error(traceback.format_exc())