From d1f9efb175f9e0dc9ac83f8c4b05586d69c1977b Mon Sep 17 00:00:00 2001 From: Denis Shulyaka Date: Thu, 14 Sep 2023 16:56:35 +0300 Subject: [PATCH 1/3] Increase AT timeout (#147) --- zigpy_xbee/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zigpy_xbee/api.py b/zigpy_xbee/api.py index 6e488b0..77895fd 100644 --- a/zigpy_xbee/api.py +++ b/zigpy_xbee/api.py @@ -15,7 +15,7 @@ LOGGER = logging.getLogger(__name__) -AT_COMMAND_TIMEOUT = 1 +AT_COMMAND_TIMEOUT = 3 REMOTE_AT_COMMAND_TIMEOUT = 30 PROBE_TIMEOUT = 45 From 685a6646919a808e18a24d4e4796435d95dd5a42 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 26 Sep 2023 22:25:22 -0400 Subject: [PATCH 2/3] Cleanup tasks on disconnect (#148) * Clean up connections and tasks when disconnecting * Fix lint --- zigpy_xbee/api.py | 4 ++++ zigpy_xbee/zigbee/application.py | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/zigpy_xbee/api.py b/zigpy_xbee/api.py index 77895fd..588859b 100644 --- a/zigpy_xbee/api.py +++ b/zigpy_xbee/api.py @@ -347,6 +347,10 @@ async def _reconnect_till_done(self) -> None: ) def close(self): + if self._conn_lost_task: + self._conn_lost_task.cancel() + self._conn_lost_task = None + if self._uart: self._uart.close() self._uart = None diff --git a/zigpy_xbee/zigbee/application.py b/zigpy_xbee/zigbee/application.py index 4b680df..abc52d7 100644 --- a/zigpy_xbee/zigbee/application.py +++ b/zigpy_xbee/zigbee/application.py @@ -49,6 +49,7 @@ async def disconnect(self): """Shutdown application.""" if self._api: self._api.close() + self._api = None async def connect(self): self._api = await zigpy_xbee.api.XBee.new(self, self._config[CONF_DEVICE]) @@ -191,11 +192,11 @@ async def force_remove(self, dev): async def add_endpoint(self, descriptor: zdo_t.SimpleDescriptor) -> None: """Register a new endpoint on the device.""" self._device.replacement["endpoints"][descriptor.endpoint] = { - "device_type": descriptor.device_type, - "profile_id": descriptor.profile, - "input_clusters": descriptor.input_clusters, - "output_clusters": descriptor.output_clusters, - } + "device_type": descriptor.device_type, + "profile_id": descriptor.profile, + "input_clusters": descriptor.input_clusters, + "output_clusters": descriptor.output_clusters, + } self._device.add_endpoint(descriptor.endpoint) async def _get_association_state(self): From a4e3a72df94eb3d996beb5f1a2116dc84d02a5dd Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 26 Sep 2023 22:30:10 -0400 Subject: [PATCH 3/3] Bump version to 0.18.3 --- zigpy_xbee/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zigpy_xbee/__init__.py b/zigpy_xbee/__init__.py index 800504f..c7c8f20 100644 --- a/zigpy_xbee/__init__.py +++ b/zigpy_xbee/__init__.py @@ -1,5 +1,5 @@ MAJOR_VERSION = 0 MINOR_VERSION = 18 -PATCH_VERSION = "2" +PATCH_VERSION = "3" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}"