Load a few more attribute qualities from ZCL XML - #1720
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for additional Matter attribute qualities, specifically quieter reporting (isQuieterReporting), source attribution (isSourceAttribution), and atomic writes (isAtomic). These qualities are now parsed from XML, stored in the database, and exposed via a new template helper if_attribute_quality. The feedback suggests adding a defensive check in the if_attribute_quality helper to prevent potential runtime TypeError exceptions if the helper is executed outside of an attribute context where 'this' might be null or undefined.
brdandu
left a comment
There was a problem hiding this comment.
Add the helper later The xml loader needs to be fixed as well
42f230c to
3f6f378
Compare
brdandu
left a comment
There was a problem hiding this comment.
You have made changes to the dbmap but you need to update the helper's sql queries to retrieve them and then pass to the dbmap or else they won't be usable
| let hasQuality = false | ||
| if (this != null) { | ||
| switch (quality) { | ||
| case 'fixed': |
There was a problem hiding this comment.
Remove all hardcoded strings and extend existing enums or create a new one if necessary.
| * @param {*} options | ||
| * @returns rendered block content. | ||
| */ | ||
| function if_attribute_quality(quality, options) { |
There was a problem hiding this comment.
Don't believe a helper like this is needed. wondering if existing attribute helpers having these properties would be good enough.
@andreilitvin @bzbarsky-apple @hasty could you let @paulr34 know if you needed any specific helpers?
| persistence: x.PERSISTENCE, | ||
| isQuieterReporting: dbApi.fromDbBool(x.IS_QUIETER_REPORTING), | ||
| isSourceAttribution: dbApi.fromDbBool(x.IS_SOURCE_ATTRIBUTION), | ||
| isAtomic: dbApi.fromDbBool(x.IS_ATOMIC), |
There was a problem hiding this comment.
Add these for endpointTypeAttributeExtended as well
Parse the quieter reporting, source attribution and atomic qualities from the <quality> element, store them on the attribute, and add an if_attribute_quality helper so templates can read them. Defaults to false when the XML does not carry them. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
… in zcl.xsd These attributes are already parsed and used by the attribute-qualities work; without them in the schema, xml-validate fails on color-control-cluster.xml. Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid TypeError when the helper is used outside an attribute iteration by checking this before reading quality fields. Co-authored-by: Cursor <cursoragent@cursor.com>
3f6f378 to
c128bdc
Compare
Parse the quieter reporting, source attribution and atomic qualities from the element, store them on the attribute, and add an if_attribute_quality helper so templates can read them. Defaults to false when the XML does not carry them.