From 286d45497aa81952bde2779498673ba66b6e7466 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Tue, 3 Dec 2024 21:08:55 +0100 Subject: [PATCH] fix: Fix `Handling of poll check-in failed` for Tuya TS0203 https://github.com/Koenkk/zigbee2mqtt/issues/24938 --- src/devices/adeo.ts | 5 ++++- src/devices/bosch.ts | 4 +++- src/devices/tuya.ts | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/devices/adeo.ts b/src/devices/adeo.ts index 03b4be56862b8..4e34b0bf65a23 100644 --- a/src/devices/adeo.ts +++ b/src/devices/adeo.ts @@ -326,7 +326,10 @@ const definitions: DefinitionWithExtend[] = [ exposes: [e.warning(), e.battery(), e.battery_low(), e.tamper()], extend: [quirkCheckinInterval(0)], configure: async (device, coordinatorEndpoint) => { - await device.getEndpoint(1).unbind('genPollCtrl', coordinatorEndpoint); + const endpoint = device.getEndpoint(1); + if (endpoint.binds.some((b) => b.cluster.name === 'genPollCtrl')) { + await endpoint.unbind('genPollCtrl', coordinatorEndpoint); + } }, }, { diff --git a/src/devices/bosch.ts b/src/devices/bosch.ts index 1a6dd32d30d25..eb1791783a67d 100644 --- a/src/devices/bosch.ts +++ b/src/devices/bosch.ts @@ -1127,7 +1127,9 @@ const definitions: DefinitionWithExtend[] = [ await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'ssIasZone', 'ssIasWd', 'genBasic']); await reporting.batteryVoltage(endpoint); await endpoint.read(0x0502, [0xa000, 0xa001, 0xa002, 0xa003, 0xa004, 0xa005], manufacturerOptions); - await endpoint.unbind('genPollCtrl', coordinatorEndpoint); + if (endpoint.binds.some((b) => b.cluster.name === 'genPollCtrl')) { + await endpoint.unbind('genPollCtrl', coordinatorEndpoint); + } }, exposes: [ e.binary('alarm_state', ea.ALL, 'ON', 'OFF').withDescription('Alarm turn ON/OFF'), diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 89352ddcfd19a..9180381d2d0f1 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -923,6 +923,11 @@ const definitions: DefinitionWithExtend[] = [ } catch { /* Fails for some*/ } + + const endpoint = device.getEndpoint(1); + if (endpoint.binds.some((b) => b.cluster.name === 'genPollCtrl')) { + await endpoint.unbind('genPollCtrl', coordinatorEndpoint); + } }, }, {