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}" diff --git a/zigpy_xbee/api.py b/zigpy_xbee/api.py index 6e488b0..588859b 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 @@ -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):