MTRAttributeIDType not working

MTRAttributeIDType is giving 'unknown cluster' results for every combination of cluster and accessory.

for the same clusters MTRClusterNameForID gives the expected result.

Answered by DTS Engineer in 811432022

I took a deeper look at this based on your forum post and basically, yes, MTRAttributeNameForID is broken. Because the cluster/attribute count is so high, both MTRClusterNameForID and MTRAttributeNameForID are machine generated and a code generation issue ended up breaking MTRAttributeNameForID without effecting MTRClusterNameForID (which is simpler).

There's already a bug on this (r.138551684/FB15579083), so all you can really do for the moment is wait for us to ship a fix.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

MTRAttributeIDType is giving 'unknown cluster' results for every combination of cluster and accessory.

What API are you actually referring to here? Can you provide a documentation link to it so I'm sure we're talking about the same API?

However, if you're talking about "MTRAttributeNameForID()", the what is the cluster ID you're passing in? The string returned from that function are specific to the failing data, so "Unknown clusterID xx" means the function didn't recognizes the cluster ID while "Unknown attributeID xx" means it recognized the cluster ID but that the attribute ID was valid for that cluster.

In terms of code, I'd expect this:

MTRAttributeNameForID(MTRClusterIDTypeBasicInformationID, MTRAttributeIDTypeClusterBasicInformationAttributeVendorNameID);

to return "VendorName". What's happening in your case?

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

sorry. yes. i was talking about MTRAttributeNameForID. but with swift. from the documentation here: https://developer.apple.com/documentation/matter/mtrattributenameforid(::)

if i read the documentation correctly your example should read

MTRAttributeNameForID(MTRClusterIDType.basicInformationID, MTRAttributeIDType.clusterApplicationBasicAttributeVendorNameID

which gives <Unknown clusterID 40> for me.

and i have the same behaviour for every MTRClusterIDType and MTRAttributeIDType initialised from raw values.

on the other hand MTRClusterNameForID with a MTRClusterIDType initialised the same way gives a reasonable result.

Accepted Answer

I took a deeper look at this based on your forum post and basically, yes, MTRAttributeNameForID is broken. Because the cluster/attribute count is so high, both MTRClusterNameForID and MTRAttributeNameForID are machine generated and a code generation issue ended up breaking MTRAttributeNameForID without effecting MTRClusterNameForID (which is simpler).

There's already a bug on this (r.138551684/FB15579083), so all you can really do for the moment is wait for us to ship a fix.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

thank you for checking this out. actually this is my bug report also :)

in the meantime i have implemented my own version. so i can continue while waiting for an official fix.

could you please also have a look here: https://developer.apple.com/forums/thread/757458?answerId=810679022#810679022

i can‘t get subscription to events working.

this is the last puzzle piece and stumbling block for my project now that i can read all attributes and write commands with and without parameters for homekit initialized matter devices.

or would it be better to open a new post instead of reusing the old one?

could you please also have a look here:

Yep, see my response in that thread.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

thank you again. very much appreciated.

i will check and report back / file reports.

thank you again. very much appreciated. i will check and report back / file reports.

One last up date on this. The engineering team let me know that this issue has already been fixed in the public matter framework project as part of this change.

I can't talk about the specifics of our update schedule, but what I can say is that the matter framework has been regularly updated in minor ("18.x") updates , not just major ("18.0") releases , and that this particular fix is not included in 18.2 (which the current update in beta).

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

MTRAttributeIDType not working
 
 
Q