Skip to content

Load a few more attribute qualities from ZCL XML - #1720

Open
paulr34 wants to merge 4 commits into
project-chip:masterfrom
paulr34:feat/attribute-qualities
Open

Load a few more attribute qualities from ZCL XML#1720
paulr34 wants to merge 4 commits into
project-chip:masterfrom
paulr34:feat/attribute-qualities

Conversation

@paulr34

@paulr34 paulr34 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src-electron/generator/helper-zcl.js

@brdandu brdandu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the helper later The xml loader needs to be fixed as well

Comment thread src-shared/db-enum.js
Comment thread src-electron/db/query-loader.js
@paulr34
paulr34 force-pushed the feat/attribute-qualities branch 2 times, most recently from 42f230c to 3f6f378 Compare July 23, 2026 16:50

@brdandu brdandu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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':

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these for endpointTypeAttributeExtended as well

paulr34 and others added 4 commits July 29, 2026 11:34
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>
@paulr34
paulr34 force-pushed the feat/attribute-qualities branch from 3f6f378 to c128bdc Compare July 29, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants