diff --git a/src/components/ZclCreateModifyEndpoint.vue b/src/components/ZclCreateModifyEndpoint.vue index 93144ab3c7..2185f373bf 100644 --- a/src/components/ZclCreateModifyEndpoint.vue +++ b/src/components/ZclCreateModifyEndpoint.vue @@ -376,6 +376,27 @@ export default { // New temporary variable this.deviceTypeTmp = value + // Get first item package reference + const packageRefTmp = + this.zclDeviceTypes[this.deviceTypeTmp[0].deviceTypeRef]?.packageRef + + // Get readable device category by packageRef + const categoryTmp = this.getDeviceCategory(packageRefTmp) + + // 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 + } else { + this.enableMultipleDevice = true + this.enableParentEndpoint = true + this.enablePrimaryDevice = true + this.enableProfileId = false + } + } // Create default device version if not exists for (const dt of value) { if (dt && dt.deviceVersion === undefined) { diff --git a/src/components/ZclEndpointCard.vue b/src/components/ZclEndpointCard.vue index 969f93fd33..82de32d63b 100644 --- a/src/components/ZclEndpointCard.vue +++ b/src/components/ZclEndpointCard.vue @@ -182,7 +182,7 @@ limitations under the License. {{ parentEndpointIdentifier[endpointReference] }} - +
Profile ID
@@ -300,23 +300,6 @@ export default { } }, methods: { - /** - * Calculate readable category - * - * @param {*} packageRef - * @returns Returns a string value for category - */ - getDeviceCategory(packageRef) { - let category = '' - let zclProperty = - this.$store.state.zap.selectedZapConfig.zclProperties.find( - (item) => item.id === packageRef && item.category - ) - if (zclProperty) { - category = zclProperty.category - } - return category - }, openDeviceLibraryDocumentation() { if ( this.$store.state.zap.genericOptions[ @@ -504,6 +487,15 @@ export default { return this.$store.state.zap.endpointView.profileId }, }, + showProfileId: { + get() { + return ( + this.getDeviceCategory(this.deviceType[0].packageRef) === 'zigbee' && + this.$store.state.zap.isProfileIdShown && + this.enableProfileId + ) + }, + }, deviceId: { get() { return this.$store.state.zap.endpointTypeView.deviceIdentifier diff --git a/src/util/common-mixin.js b/src/util/common-mixin.js index 115a1c70ff..41a1906d3b 100644 --- a/src/util/common-mixin.js +++ b/src/util/common-mixin.js @@ -311,5 +311,26 @@ export default { return logos }, + /** + * Calculate readable category + * + * @param {*} packageRef + * @returns Returns a string value for category + */ + getDeviceCategory(packageRef) { + let zclProperty = '' + if (this.$store.state.zap.isMultiConfig) { + zclProperty = + this.$store.state.zap.selectedZapConfig.zclProperties.find( + (item) => item.id === packageRef && item.category + ) + return zclProperty.category + } else { + zclProperty = this.$store.state.zap.packages.find( + (item) => item.pkg.id === packageRef && item.pkg.category + ) + return zclProperty.pkg?.category + } + }, }, }