8000 Fix: Adding device types through custom XML by dhchandw · Pull Request #1565 · project-chip/zap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: Adding device types through custom XML #1565

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

Merged
merged 2 commits into from
Apr 9, 2025

Conversation

dhchandw
Copy link
Collaborator
@dhchandw dhchandw commented Apr 3, 2025
  • Fix front-end issue for custom XML device types
  • Fix device type reference updating for custom XML device types
  • Fix use case where custom XML device type is being used for different sessions using different zcl files
  • Fix default attributes and commands enabled when custom cluster is enabled

@dhchandw dhchandw force-pushed the bug/customDeviceTypes branch 5 times, most recently from aa3eec8 to 944dfa8 Compare April 4, 2025 17:02
@dhchandw dhchandw marked this pull request as ready for review April 4, 2025 17:02
@dhchandw dhchandw requested a review from ethanzhouyc April 7, 2025 19:50
@dhchandw dhchandw force-pushed the bug/customDeviceTypes branch 2 times, most recently from 985cbc3 to a2c3bb3 Compare April 8, 2025 18:00
- Fix front-end issue for custom XML device types
- Fix device type reference updating for custom XML device types
- Fix use case where custom XML device type is being used for different sessions using different zcl files
- Fix default attributes and commands enabled when custom cluster is enabled
- Fix endpoint-config helper when custom xml device type is used
- Fix file open for .zap file with custom xml device type
- Added tests
@dhchandw dhchandw force-pushed the bug/customDeviceTypes branch from a2c3bb3 to c3f48d9 Compare April 8, 2025 20:06
break
}
if (endpointTypeCategory) {
zclPropertiesPkgs = zclPropertiesPkgs.filter((pkg) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

zclPropertiesPkgs = zclPropertiesPkgs.filter((pkg) => pkg.category == endpointTypeCategory)

packageId = pkgs[i].id
break
}
if (endpointTypeCategory) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a use case where an old stack will not have endpointTypeCategory because categories did not exist from the start of ZAP invention? What happens if an endpoint type has category as null?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Then all zcl properties files will be passed since the if (endpointTypeCategory) will not be true and zclProperties` will not be changed. Since it is an old stack this will not be an issue because there will no multi protocol.

)
// Relevant packages are zcl file (filtered by category) and all custom xmls in the session
let pkgs = zclPropertiesPkgs.concat(zclXmlStandalonePkgs)
if (pkgs == null || pkgs.length < 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this error check be done on zclPropertiesPkgs ? Do we want a session with just custom xml?

return dbApi.dbRemove(
db,
`
DELETE FROM DEVICE_TYPE_CLUSTER
Copy link
Collaborator

Choose a reason for hiding this comment

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

Format this query like the others

)

// clean up unlinked device type clusters
return deleteUnlinkedDeviceTypeClusters(db, packageId)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Avoid delinking. Throw warnings into the notifications pane stating certain device type clusters do not exist.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Throwing warnings but will still need to delete unlinked clusters to avoid duplicates in certain cases.

sessionId,
dbEnum.packageType.zclProperties
)
let zclXmlStandalonePkgs = await queryPackage.getSessionPackagesByType(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of multiple queries should we get packages once and then filter based on type? Would get us out of multiple database interactions.

expect(endpointConfig 8000 ).toContain(
'/* Endpoint: 1, Cluster: Test Cluster - Device Type (server) */ \\'
)
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Recently figured out how to open a file in the browser when zap server is running

http://localhost:9070/?standalone=false&filePath=%2abc%2Fconfig%2Fzcl%2Fzcl_config.zap#/

You could try using this in the cypress tests to open a .zap file with custom xml and check UI elements if you are curious.

@dhchandw dhchandw requested a review from brdandu April 9, 2025 20:50
if (result) {
const existingId = result.DEVICE_TYPE_ID

if ('clusters' in dt) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

For future just create one. Fine for this.

@dhchandw dhchandw merged commit 973efe7 into project-chip:master Apr 9, 2025
13 checks passed
@dhchandw dhchandw deleted the bug/customDeviceTypes branch April 23, 2025 18:54
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.

3 participants
0