From ae0dfb08bc46f5fe61e659f327ea72a735ee4048 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 3 Dec 2024 01:37:40 +0100 Subject: [PATCH] [light.hue] [UI] Better support for group scenes. --- .../src/components/panels/Light/Index.vue | 21 ++++++++++++------- .../src/components/panels/LightHue/Index.vue | 5 ++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/platypush/backend/http/webapp/src/components/panels/Light/Index.vue b/platypush/backend/http/webapp/src/components/panels/Light/Index.vue index afb2ed194c..17a052a252 100644 --- a/platypush/backend/http/webapp/src/components/panels/Light/Index.vue +++ b/platypush/backend/http/webapp/src/components/panels/Light/Index.vue @@ -30,8 +30,17 @@ export default { name: "Light", components: {Group, Groups}, mixins: [Utils, Panel], - emits: ['group-toggle', 'light-toggle', 'set-light', 'set-group', 'select-scene', 'start-animation', 'stop-animation', - 'refresh', 'light-changed'], + emits: [ + 'group-toggle', + 'light-changed', + 'light-toggle', + 'refresh', + 'select-scene', + 'set-group', + 'set-light', + 'start-animation', + 'stop-animation', + ], props: { lights: { @@ -65,10 +74,6 @@ export default { default: () => {}, }, - pluginName: { - type: String, - }, - initialGroup: { type: [Number, String], }, @@ -140,7 +145,7 @@ export default { return { ...animations, ...Object.entries(this.animations?.lights || {}).reduce((obj, [lightId, animation]) => { - const group = Object.values(self.groupsByLight[lightId])?.[0] + const group = Object.values(self.groupsByLight[lightId] || {})?.[0] if (group) { if (animation && group.id != null) { if (!obj[group.id]) @@ -244,4 +249,4 @@ export default { } } } - \ No newline at end of file + diff --git a/platypush/backend/http/webapp/src/components/panels/LightHue/Index.vue b/platypush/backend/http/webapp/src/components/panels/LightHue/Index.vue index eb95ea0256..0ef67fe384 100644 --- a/platypush/backend/http/webapp/src/components/panels/LightHue/Index.vue +++ b/platypush/backend/http/webapp/src/components/panels/LightHue/Index.vue @@ -67,7 +67,10 @@ export default { async getScenes() { return Object.entries(await this.request('light.hue.get_scenes')) - .filter((scene) => !scene[1].recycle && scene[1].type.toLowerCase() === 'lightscene') + .filter((scene) => + !scene[1].recycle && + ['lightscene', 'groupscene'].includes(scene[1].type.toLowerCase()) + ) .reduce((obj, [id, scene]) => { obj[id] = scene return obj