-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: AttributeReport: Erroneous attribute names #787
Conversation
|
||
interface KeyValue {[s: string]: number | string} | ||
|
||
function attributeKeyValue(frame: ZclFrame): KeyValue { | ||
function attributeKeyValue(frame: ZclFrame, manufacturerID?: number): KeyValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this argument mandatory and name it deviceManfacturerID
payload[attribute.name] = item.attrData; | ||
Debug.log(`Attr: ${item.attrId} (${attribute.name}) -> ${item.attrData}}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to not add any debug logging here, it will pollute the log files a lot.
Looks good! Could you make similar changes to |
src/controller/controller.ts
Outdated
@@ -683,7 +683,13 @@ class Controller extends events.EventEmitter { | |||
if (frame.isGlobal()) { | |||
if (frame.isCommand('report')) { | |||
type = 'attributeReport'; | |||
data = ZclFrameConverter.attributeKeyValue(dataPayload.frame); | |||
// Certain devices (e.g. Legrand/4129) fail to set the manufacturerSpecific flag and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move these comments to zclFrameConverters.ts
, the only change needed here is:
data = ZclFrameConverter.attributeKeyValue(dataPayload.frame, device.manufacturerID);
Thanks for your feedback @Koenkk. |
@FabianMangold no need to hurry, I will merge this after the next z2m release so we have enough time to test this in dev. |
Remap cluster attributes names using the target device's manufacturer ID, as certain devices fail to set the manufacturerSpecific and customerCode data in the ZCL Frame header.
* zclFrameConverter: deviceManufacturerID is now mandatory * Updated calls to ZclFrameConverter due to the method signature change
Hello @Koenkk, |
Looks good! Would you mind adding a test case to |
Of course, let me check how this can be mocked best, not sure how to do this yet :). |
Hi @Koenkk, I've added 4 new tests to the suite, to validate all use-cases. |
Thanks! |
Reparse cluster attributes names using the target device's manufacturer ID, as certain devices fail to set the manufacturerSpecific and customerCode data in the ZCL Frame header.
Hi @Koenkk,
with reference to the issue mentioned here: Koenkk/zigbee-herdsman-converters#6333
What do you think? Is this acceptable ?
Cheers