Skip to content
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

dynamically enabling Matter/Zigbee only components for CMP #1427

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/components/ZclAttributeManager.vue
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am confused. Which JIRA or Github issue is this solving?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there is no ticket for this because while I was solving the 1499 I noticed the whole thing was broken

Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ export default {
sortBy: 'clientServer'
},
columns: [],
forcedExternal: [],
enableSingleton: false,
enableBounded: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are attribute manager settings changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because that code is out of date with the changes to ui-options.js

forcedExternal: []
}
},
mounted() {
Expand Down
12 changes: 4 additions & 8 deletions src/components/ZclCreateModifyEndpoint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,11 @@ export default {
// Set / unset multiple device option in mcp
if (this.$store.state.zap.isMultiConfig) {
if (categoryTmp === 'zigbee') {
this.enableMultipleDevice = false
this.enableParentEndpoint = false
this.enablePrimaryDevice = false
this.enableProfileId = true
this.$store.state.zap.cmpEnableZigbeeFeatures = true
this.$store.state.zap.cmpEnableMatterFeatures = false
} else {
this.enableMultipleDevice = true
this.enableParentEndpoint = true
this.enablePrimaryDevice = true
this.enableProfileId = false
this.$store.state.zap.cmpEnableZigbeeFeatures = false
this.$store.state.zap.cmpEnableMatterFeatures = true
}
}
// Create default device version if not exists
Expand Down
2 changes: 2 additions & 0 deletions src/store/zap/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const restApi = require('../../../src-shared/rest-api.js')
export default function () {
return {
selectedZapConfig: null,
cmpEnableZigbeeFeatures: false,
cmpEnableMatterFeatures: false,
isMultiConfig: false,
isProfileIdShown: null,
clusterDataForTutorial: [],
Expand Down
18 changes: 17 additions & 1 deletion src/util/ui-options.js
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add cypress tests to make sure that client clusters of zigbee endpoint is still configurable but not matter endpoints in the case of CMP.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we do not have the framework to make Zigbee or matter specific cypress tests, do you think that should block this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we definitely need cypress tests you're right!

Copy link
Collaborator

@tbrkollar tbrkollar Sep 18, 2024

Choose a reason for hiding this comment

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

Maybe you know, but I had started to implement a solution for detecting zigbee and matter cases in cypress. It has not been finished yet but it is working now. So we have an attribute that helps me detect which mode is active in the Cypress test. This is the "mode" attribute. 

cy.fixture('data').then((data) => { if(data.mode === 'matter') { //code } if(data.mode === 'zigbee') { //code } })

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's great!

Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,27 @@ export default {
}
},
enableMatterFeatures() {
// Check if cmpEnableMatterFeatures is true
if (this.$store.state.zap.cmpEnableMatterFeatures) {
return true
} else if (this.$store.state.zap.cmpEnableZigbeeFeatures) {
return false
}

// Proceed with the next set of conditions
return this.zclPropertiesNonEmpty
? this.multiDeviceCategories.includes('matter')
: this.multiDeviceCategories == 'matter'
},
enableZigbeeFeatures() {
// Check if cmpEnableZigbeeFeatures is true
if (this.$store.state.zap.cmpEnableZigbeeFeatures) {
return true
} else if (this.$store.state.zap.cmpEnableMatterFeatures) {
return false
}

// Proceed with the next set of conditions
return this.zclPropertiesNonEmpty
? this.multiDeviceCategories.includes('zigbee')
: this.multiDeviceCategories === 'zigbee' || !this.multiDeviceCategories
Expand Down Expand Up @@ -90,7 +106,7 @@ export default {
return this.enableMatterFeatures
},
enableServerOnly() {
return this.enableMatterFeatures && !this.enableZigbeeFeatures
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about client clusters which belong to endpoints with Zigbee's zcl device types? Those should still be configurable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes it appears there is a bigger problem here

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this change not disable Zigbee client cluster configuration?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it does not disable it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to be clear, ZAP master branch, as of now, when running CMP mode never distinguishes between Zigbee and Matter. That logic is broken. So this PR fixes that.

return this.enableMatterFeatures
}
}
}
Loading