-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Inovelli: fix parsing of custom cluster attribute - fix parsing of 0xFF values of custom cluster #10065
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
Conversation
|
About the Number.parse, these were added after the new typing was added (previously was not typed - See Koenkk/zigbee-herdsman#1503 about the ZCL non-values. |
|
Will be fixed by Koenkk/zigbee-herdsman#1510 |
|
Doesn't the zigbee-hersman change only fix one issue? This still needs fixing:
This literally breaks all of the configuration values on these devices (and there's a huge number of them). Rewriting the converter to be more type safe and less dynamic seems like a pretty big ask to fix this functionality. |
|
@rohankapoorcom you are right, @InovelliUSA could you update the PR? |
|
I updated the PR to remove the code that was converting NaN to 255. |
Agreed, not to fix this specifically, but overall, it would be better for the future. The new converters typing should allow pretty decent compile-time checks, avoid issues slipping through due to @Koenkk we might want to check if other occurrences of this got through in the typing PR (cases where |
src/devices/inovelli.ts
Outdated
| if (msg.type === "readResponse") { | ||
| return Object.keys(msg.data).reduce((p, c) => { | ||
| const key = splitValuesByEndpoint ? `${c}_${msg.endpoint.ID}` : c; | ||
| const obj = typeof msg.data === "string" ? JSON.parse(msg.data) : msg.data; |
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 think this alone should work:
const raw = (msg.data as Record<string | number, unknown>)[c];(msg.data is either Record or Buffer)
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.
Ok, I made that change.
Sure, I think that's a good improvement to work towards. I am not a typescript expert though, do you maybe have a suggestion for where to start with this? |
|
@rohankapoorcom replied on Discord to avoid crowding here. |
|
@Nerivec I checked other occurrences of Thanks @InovelliUSA ! |
This PR covers two issues. The first is @Nerivec
We noticed that the some changes in this commit: #9867
msg.data[c] changed to msg.data[Number.parseInt(c, 10)]
Caused some problems with the configuration value parsing for our devices.
The second is when the value of the attribute of an UINT8 is 255, it seems to reach the converter as NaN (or null?). There is a workaround in this PR for that issue as well, but I think this issue is new and am curious what might have caused it.
[2025-09-22 12:08:06] debug: zh:zstack:znp: <-- AREQ: AF - incomingMsg - {"groupid":0,"clusterid":64561,"srcaddr":27383,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":116,"securityuse":0,"timestamp":5253037,"transseqnumber":0,"len":10,"data":{"type":"Buffer","data":[28,47,18,11,1,14,0,0,32,255]}}
[2025-09-22 12:08:06] debug: zh:controller: Received payload: clusterID=64561, address=27383, groupID=0, endpoint=1, destinationEndpoint=1, wasBroadcast=false, linkQuality=116, frame={"header":{"frameControl":{"frameType":0,"manufacturerSpecific":true,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"manufacturerCode":4655,"transactionSequenceNumber":11,"commandIdentifier":1},"payload":[{"attrId":14,"status":0,"dataType":32,"attrData":null}],"command":{"ID":1,"name":"readRsp","parameters":[{"name":"attrId","type":33},{"name":"status","type":32},{"name":"dataType","type":32,"conditions":[{"type":"fieldEquals","field":"status","value":0}]},{"name":"attrData","type":1000,"conditions":[{"type":"fieldEquals","field":"status","value":0}]}]}}
[2025-09-22 12:08:06] debug: zh:zstack:unpi:parser: --- parseNext []
[2025-09-22 12:08:06] debug: z2m: Received Zigbee message from '0x94deb8fffef4cf5e', type 'readResponse', cluster 'manuSpecificInovelli', data '{"defaultLevelRemote":null}' from endpoint 1 with groupID 0