Skip to content

Commit

Permalink
Add extra logging for quirks. Koenkk/zigbee2mqtt#8331
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Aug 13, 2021
1 parent 6afe18f commit 1acde90
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/controller/model/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ 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
// 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.
Expand All @@ -394,11 +396,11 @@ class Device extends Entity {
// 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_.*$')) {
debug.log(`Interview procedure failed but got enough for TuYa end device`);
this._powerSource = 'Battery';
this._interviewing = false;
this._interviewCompleted = true;
this.save();
debug.log(`Interview - quirks matched for TuYa end device`);
return true;
}

Expand Down Expand Up @@ -430,8 +432,10 @@ class Device extends Entity {
this._interviewing = false;
this._interviewCompleted = true;
this.save();
debug.log(`Interview - quirks matched on '${match}'`);
return true;
} else {
debug.log('Interview - quirks did not match');
return false;
}
}
Expand Down

2 comments on commit 1acde90

@sjorge
Copy link
Contributor

@sjorge sjorge commented on 1acde90 Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Koenkk something popped into my head checking out this change, do we need to account for _type == "Unknown" for the availability filter?

@Koenkk
Copy link
Owner Author

@Koenkk Koenkk commented on 1acde90 Aug 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjorge type unknown shouldn't happen, either interview is ok and type is known OR interview fails and quirks kicks in which sets type type.

Please sign in to comment.