diff --git a/zigpy_deconz/api.py b/zigpy_deconz/api.py index 0cf8545..0d6e9bc 100644 --- a/zigpy_deconz/api.py +++ b/zigpy_deconz/api.py @@ -73,6 +73,7 @@ class DeviceState(t.Struct): class FirmwarePlatform(t.enum8): Conbee = 0x05 Conbee_II = 0x07 + Conbee_III = 0x09 class FirmwareVersion(t.Struct, t.uint32_t): @@ -689,6 +690,21 @@ async def _data_poller(self): status=rsp["status"], device_state=rsp["device_state"] ) + def _handle_device_state( + self, + status: t.Status, + device_state: DeviceState, + reserved1: t.uint8_t, + reserved2: t.uint8_t, + ) -> None: + if ( + self.firmware_version.platform == FirmwarePlatform.Conbee_III + and self.firmware_version == 0x26450900 + ): + # Initial firmware for the device accidentally used the `device_state` + # command instead of `device_state_changed` to indicate state changes + self._handle_device_state_changed(status=status, device_state=device_state) + def _handle_device_state_changed( self, status: t.Status, @@ -704,6 +720,7 @@ def _handle_device_state_changed( self._device_state = device_state self._data_poller_event.set() + LOGGER.debug("Poking data poller") if ( DeviceStateFlags.APSDE_DATA_REQUEST_FREE_SLOTS_AVAILABLE diff --git a/zigpy_deconz/zigbee/application.py b/zigpy_deconz/zigbee/application.py index ff77633..fc17d2e 100644 --- a/zigpy_deconz/zigbee/application.py +++ b/zigpy_deconz/zigbee/application.py @@ -171,7 +171,10 @@ async def change_loop(): " 2.4GHz routers, motherboards, etc." ) - if self._api.protocol_version < PROTO_VER_WATCHDOG: + if self._api.protocol_version < PROTO_VER_WATCHDOG or ( + self._api.firmware_version.platform == FirmwarePlatform.Conbee_III + and self._api.firmware_version == 0x26450900 + ): return if self._reset_watchdog_task is not None: @@ -286,6 +289,9 @@ async def write_network_info(self, *, network_info, node_info): await self._change_network_state(NetworkState.CONNECTED) async def load_network_info(self, *, load_devices=False): + if self._api.firmware_version.platform == FirmwarePlatform.Conbee_III: + await self._change_network_state(NetworkState.CONNECTED) + network_info = self.state.network_info node_info = self.state.node_info @@ -601,7 +607,11 @@ def __init__(self, version: FirmwareVersion, device_path: str, *args): super().__init__(*args) is_gpio_device = re.match(r"/dev/tty(S|AMA|ACM)\d+", device_path) self._model = "RaspBee" if is_gpio_device else "ConBee" - self._model += " II" if version.platform == FirmwarePlatform.Conbee_II else "" + self._model += { + FirmwarePlatform.Conbee: "", + FirmwarePlatform.Conbee_II: " II", + FirmwarePlatform.Conbee_III: " III", + }[version.platform] async def add_to_group(self, grp_id: int, name: str = None) -> None: group = self.application.groups.add_group(grp_id, name)