diff --git a/bundles/org.openhab.ui/web/src/assets/definitions/metadata/matter.js b/bundles/org.openhab.ui/web/src/assets/definitions/metadata/matter.js new file mode 100644 index 000000000..6d562d8bd --- /dev/null +++ b/bundles/org.openhab.ui/web/src/assets/definitions/metadata/matter.js @@ -0,0 +1,157 @@ +const thermostatSystemModeOptions = [ + { value: '0', label: 'OFF' }, + { value: '1', label: 'AUTO' }, + { value: '3', label: 'COOL' }, + { value: '4', label: 'HEAT' }, + { value: '5', label: 'EMERGENCY_HEAT' }, + { value: '6', label: 'PRECOOLING' }, + { value: '7', label: 'FAN_ONLY' }, + { value: '8', label: 'DRY' }, + { value: '9', label: 'SLEEP' } +] + +const fanModeOptions = [ + { value: '0', label: 'OFF' }, + { value: '1', label: 'LOW' }, + { value: '2', label: 'MEDIUM' }, + { value: '3', label: 'HIGH' }, + { value: '4', label: 'ON' }, + { value: '5', label: 'AUTO' }, + { value: '6', label: 'SMART' } +] + +export const deviceTypes = { + OnOffLight: { + attributes: [] + }, + DimmableLight: { + attributes: [] + }, + ColorLight: { + attributes: [] + }, + OnOffPlugInUnit: { + attributes: [] + }, + WindowCovering: { + attributes: [] + }, + TemperatureSensor: { + attributes: [] + }, + HumiditySensor: { + attributes: [] + }, + OccupancySensor: { + attributes: [] + }, + ContactSensor: { + attributes: [] + }, + DoorLock: { + attributes: [] + }, + Thermostat: { + attributes: [ + { label: 'Local Temperature', name: 'thermostat.localTemperature', mandatory: true }, + { label: 'Outdoor Temperature', name: 'thermostat.outdoorTemperature', mandatory: false }, + { label: 'Occupied Heating Setpoint', name: 'thermostat.occupiedHeatingSetpoint', mandatory: false }, + { label: 'Occupied Cooling Setpoint', name: 'thermostat.occupiedCoolingSetpoint', mandatory: false }, + { + label: 'System Mode', + name: 'thermostat.systemMode', + mandatory: true, + mapping: { + name: 'systemMode', + label: 'System Mode Mappings', + type: 'TEXT', + limitToOptions: true, + options: thermostatSystemModeOptions + } + }, + { label: 'Running Mode', name: 'thermostat.runningMode', mandatory: false } + ] + }, + Fan: { + attributes: [ + { label: 'On Off', name: 'onOff.onOff', mandatory: false }, + { + label: 'Fan Mode', + name: 'fanControl.fanMode', + mandatory: false, + mapping: { + name: 'fanMode', + label: 'Fan Mode Mappings', + type: 'TEXT', + limitToOptions: true, + options: fanModeOptions + } + }, + { label: 'Percent Setting', name: 'fanControl.percentSetting', mandatory: false } + ], + supportsSimpleMapping: true + } +} + +export const deviceTypesAndAttributes = Object.entries(deviceTypes).flatMap(([type, attributes]) => [ + type, + ...(attributes.length > 0 ? attributes.map(cluster => `${type}.${cluster.label}`) : []) +]) + +export const isComplexDeviceType = (deviceType) => { + return deviceTypes[deviceType]?.length > 0 +} + +const labelParameter = { + name: 'label', + label: 'Custom Label', + type: 'TEXT', + description: 'Override the default item label in Matter' +} + +const fixedLabelsParameter = { + name: 'fixedLabels', + label: 'Fixed Labels', + type: 'TEXT', + description: 'Comma-separated list of key=value pairs for fixed labels (e.g. room=Office, floor=1)' +} + +const thermostatLimitsParameters = [ + { name: 'thermostat-minHeatSetpointLimit', label: 'Min Heat Setpoint', type: 'DECIMAL', description: 'Minimum allowable heat setpoint (in 0.01°C)' }, + { name: 'thermostat-maxHeatSetpointLimit', label: 'Max Heat Setpoint', type: 'DECIMAL', description: 'Maximum allowable heat setpoint (in 0.01°C)' }, + { name: 'thermostat-minCoolSetpointLimit', label: 'Min Cool Setpoint', type: 'DECIMAL', description: 'Minimum allowable cool setpoint (in 0.01°C)' }, + { name: 'thermostat-maxCoolSetpointLimit', label: 'Max Cool Setpoint', type: 'DECIMAL', description: 'Maximum allowable cool setpoint (in 0.01°C)' }, + { name: 'thermostat-minSetpointDeadBand', label: 'Min Setpoint Deadband', type: 'DECIMAL', description: 'Minimum temperature gap between heating and cooling setpoints (in 0.01°C)' } +] + +const fanModeSequenceParameter = { + name: 'fanControl-fanModeSequence', + label: 'Fan Mode Sequence', + type: 'INTEGER', + description: 'The sequence of fan modes to cycle through', + limitToOptions: true, + options: [ + { value: '0', label: 'Off-Low-Med-High' }, + { value: '1', label: 'Off-Low-High' }, + { value: '2', label: 'Off-Low-Med-High-Auto' }, + { value: '3', label: 'Off-Low-High-Auto' }, + { value: '4', label: 'Off-High-Auto' }, + { value: '5', label: 'Off-High' } + ] +} +const windowCoveringInvertParameter = { + name: 'windowCovering-invert', + label: 'Invert Control', + type: 'BOOLEAN' +} + +export const matterParameters = { + global: [labelParameter, fixedLabelsParameter], + OnOffLight: [labelParameter, fixedLabelsParameter], + DimmableLight: [labelParameter, fixedLabelsParameter], + ColorLight: [labelParameter, fixedLabelsParameter], + PlugInUnit: [labelParameter, fixedLabelsParameter], + Thermostat: [labelParameter, fixedLabelsParameter].concat(thermostatLimitsParameters), + WindowCovering: [labelParameter, fixedLabelsParameter].concat(windowCoveringInvertParameter), + Fan: [labelParameter, fixedLabelsParameter, fanModeSequenceParameter] +} diff --git a/bundles/org.openhab.ui/web/src/assets/definitions/metadata/namespaces.js b/bundles/org.openhab.ui/web/src/assets/definitions/metadata/namespaces.js index d02604de0..12c4c5df2 100644 --- a/bundles/org.openhab.ui/web/src/assets/definitions/metadata/namespaces.js +++ b/bundles/org.openhab.ui/web/src/assets/definitions/metadata/namespaces.js @@ -10,6 +10,7 @@ export default [ { name: 'autoupdate', label: 'Auto-update' }, { name: 'expire', label: 'Expiration Timer' }, { name: 'voiceSystem', label: 'Voice System' }, + { name: 'matter', label: 'Matter' }, { name: 'alexa', label: 'Amazon Alexa' }, { name: 'homekit', label: 'Apple HomeKit' }, { name: 'ga', label: 'Google Assistant' }, diff --git a/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-matter.vue b/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-matter.vue new file mode 100644 index 000000000..6e79478db --- /dev/null +++ b/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-matter.vue @@ -0,0 +1,317 @@ + + + + + Multiple + + + + + + + + {{ deviceType }} + + + + + + + + + + Matter Attributes Mapping + + + + Update group members + + + + + {{ deviceType }} + + + + + + + {{ mbr.label }} ({{ mbr.name }}) + + + + + + + + + + Mapping options for {{ attribute.label }} + + + + + + + + + + * indicates mandatory mapping + + + + Update group members + + + + + + Matter integration documentation + + + + + + + Loading... + + + + diff --git a/bundles/org.openhab.ui/web/src/pages/settings/items/metadata/item-metadata-edit.vue b/bundles/org.openhab.ui/web/src/pages/settings/items/metadata/item-metadata-edit.vue index 237a8dcf1..a6db1537e 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/items/metadata/item-metadata-edit.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/items/metadata/item-metadata-edit.vue @@ -77,6 +77,7 @@ import ItemMetadataExpire from '@/components/item/metadata/item-metadata-expire. import ItemMetadataVoiceSystem from '@/components/item/metadata/item-metadata-voicesystem.vue' import ItemMetadataAlexa from '@/components/item/metadata/item-metadata-alexa.vue' import ItemMetadataHomeKit from '@/components/item/metadata/item-metadata-homekit.vue' +import ItemMetadataMatter from '@/components/item/metadata/item-metadata-matter.vue' import ItemMetadataGa from '@/components/item/metadata/item-metadata-ga.vue' import ItemMetadataLinktomore from '@/components/item/metadata/item-metadata-linktomore.vue' import DirtyMixin from '../../dirty-mixin' @@ -131,6 +132,8 @@ export default { return ItemMetadataExpire case 'voiceSystem': return ItemMetadataVoiceSystem + case 'matter': + return ItemMetadataMatter case 'alexa': return ItemMetadataAlexa case 'homekit':
+ + Matter integration documentation + +