Skip to content

Commit

Permalink
fix(ignore): Add DISABLE_TUYA_DEFAULT_RESPONSE option
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Feb 25, 2024
1 parent 4ed739b commit c6ff266
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controller/model/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c6ff266

Please sign in to comment.