Is it possible to add custom attributes to an existing cluster? #2818
-
|
For example, is it possible to add an attribute called time—which does not exist in the Matter specification—to the ReportingOnOffServer class in examples/device-onoff-light? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
|
What exactly is your goal? The clusters defined by the specification are defined. I would need to check specification if "defined clusters" (like OnOff) can have vendor specific enhancements - meaning custom attributes in vendor-id scoped number ranges, but usually such enhancements are only allowed matter wise in vendor specific custom clusters. So from this regard I need to know what exactly you plan ad why? |
Beta Was this translation helpful? Give feedback.
Ok, so in fact Matter specification wise it is allowed when the attribute IDs are in the Vendor specific number areas as discussed above.
To do that in matter.js (and I never did exactly this till now!) you need to ideally create a class extending the OnOffServer class and then you need to:
1.) Adjust the OnOff Tlv Schema
2.) Adjust the internal class schema
And in both add this attribute.
Right now both would be needed. We work on simplifying this but we are not yet there (in fact we already have ways to enhance the internal "state" of a cluster but this only works for "non-matter relevant" data. So for the time being it would be like that.
I do not have a ready to use example but some p…