Skip to content

Commit

Permalink
dynamically enabling Matter/Zigbee only components for CMP (project-c…
Browse files Browse the repository at this point in the history
…hip#1427)

* fixing so there are dynamic categories based on the device type when in cmp mode
  • Loading branch information
paulr34 authored Sep 20, 2024
1 parent 309238b commit 2b71747
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/components/ZclAttributeManager.vue
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
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
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
return this.enableMatterFeatures
}
}
}

0 comments on commit 2b71747

Please sign in to comment.