diff --git a/bundles/org.openhab.ui/web/src/assets/definitions/metadata/alexa.js b/bundles/org.openhab.ui/web/src/assets/definitions/metadata/alexa.js index 5dabb729f7..c0ef4692ea 100644 --- a/bundles/org.openhab.ui/web/src/assets/definitions/metadata/alexa.js +++ b/bundles/org.openhab.ui/web/src/assets/definitions/metadata/alexa.js @@ -36,6 +36,30 @@ const categories = [ 'WEARABLE' ] +// Group endpoints are generated from the display categories. Example from the docs: SECURITY_PANEL => Endpoint.SecurityPanel. +const groupEndpoints = categories + .map(category => { + const convertedChars = [] + let capitalizeNext = false + for (var i = 0; i < category.length; i++) { + const currentChar = category.charAt(i) + if (i === 0) { + convertedChars.push(currentChar.toUpperCase()) + } else if (currentChar === '_') { + capitalizeNext = true + } else if (capitalizeNext) { + convertedChars.push(currentChar.toUpperCase()) + capitalizeNext = false + } else { + convertedChars.push(currentChar.toLocaleLowerCase()) + } + } + return 'Endpoint.' + convertedChars.join('') + }).reduce((endpoints, endpointName) => { + endpoints[endpointName] = [] + return endpoints + }, {}) + const labels = { 'Switchable': [], 'Lighting': [], @@ -234,6 +258,11 @@ for (let l in labels) { classes['label:' + l] = labels[l] } +for (let l in groupEndpoints) { + groupEndpoints[l].unshift(categoryParameter) + classes['endpoint:' + l] = groupEndpoints[l] +} + for (let c in capabilities) { capabilities[c].unshift(categoryParameter) classes[c] = capabilities[c] diff --git a/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-alexa.vue b/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-alexa.vue index 7aaf8afe40..275ba65e84 100644 --- a/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-alexa.vue +++ b/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-alexa.vue @@ -1,6 +1,6 @@