From c6ff266f66c47d6b46745040eaaa973cd7a84407 Mon Sep 17 00:00:00 2001 From: koenkk Date: Sun, 25 Feb 2024 14:53:19 +0100 Subject: [PATCH] fix(ignore): Add `DISABLE_TUYA_DEFAULT_RESPONSE` option --- src/controller/model/device.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controller/model/device.ts b/src/controller/model/device.ts index 531ea94744..3da6f712d0 100755 --- a/src/controller/model/device.ts +++ b/src/controller/model/device.ts @@ -308,10 +308,12 @@ class Device extends Entity { const isDefaultResponse = frame.isGlobal() && frame.getCommand().name === 'defaultRsp'; const commandHasResponse = frame.getCommand().hasOwnProperty('response'); const disableDefaultResponse = frame.Header.frameControl.disableDefaultResponse; + /* istanbul ignore next */ + const disableTuyaDefaultResponse = endpoint.getDevice().manufacturerName?.startsWith('_TZ') && process.env['DISABLE_TUYA_DEFAULT_RESPONSE']; // Sometimes messages are received twice, prevent responding twice const alreadyResponded = this._lastDefaultResponseSequenceNumber === frame.Header.transactionSequenceNumber; if (this.type !== 'GreenPower' && !dataPayload.wasBroadcast && !disableDefaultResponse && !isDefaultResponse && - !commandHasResponse && !this._skipDefaultResponse && !alreadyResponded) { + !commandHasResponse && !this._skipDefaultResponse && !alreadyResponded && !disableTuyaDefaultResponse) { try { this._lastDefaultResponseSequenceNumber = frame.Header.transactionSequenceNumber; // In the ZCL it is not documented what the direction of the default response should be