From 29969cbdcc4983d74e825d3790392a8b13873889 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sun, 15 Aug 2021 20:47:17 +0200 Subject: [PATCH] Fix interview failing for TuYa routers. https://github.com/Koenkk/zigbee2mqtt/issues/8331 --- src/controller/model/device.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/controller/model/device.ts b/src/controller/model/device.ts index 0ce4197a7b..dd25ef0516 100755 --- a/src/controller/model/device.ts +++ b/src/controller/model/device.ts @@ -389,7 +389,7 @@ class Device extends Entity { private interviewQuirks(): boolean { debug.log(`Interview - quirks check for '${this.modelID}'-'${this.manufacturerName}'-'${this.type}'`); - // TuYa end devices are typically hard to interview. They also don't require a full interview to work correctly + // TuYa devices are typically hard to interview. They also don't require a full interview to work correctly // e.g. no ias enrolling is required for the devices to work. // Assume that in case we got both the manufacturerName and modelID the device works correctly. // https://github.com/Koenkk/zigbee2mqtt/issues/7564: @@ -397,9 +397,8 @@ class Device extends Entity { // https://github.com/Koenkk/zigbee2mqtt/issues/4655 // Device does not change zoneState after enroll (event with original gateway) // modelID is mostly in the form of e.g. TS0202 and manufacturerName like e.g. _TYZB01_xph99wvr - if (this.modelID && this.modelID.match('^TS\\d*$') && this.type === 'EndDevice' && this.manufacturerName && - this.manufacturerName.match('^_TYZB01_.*$')) { - this._powerSource = 'Battery'; + if (this.modelID?.match('^TS\\d*$') && this.manufacturerName?.match('^_TYZB01_.*$')) { + this._powerSource = this._powerSource || 'Battery'; this._interviewing = false; this._interviewCompleted = true; this.save();