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AAe,MAAPA,UAEbC,QAAQC,IAAIN,SACZ/C,KAAKN,SAAQ,EACpB,EAED6B,eAAeuB,SACP9C,KAAK4C,YAAY,kBAAoB,CACzCjD,KAAMK,KAAKnB,OAAOiE,EAAMS,SAAS5D,KACjCf,OAAQ,CAACoB,KAAKpB,OAAOkE,EAAMQ,SAAS3D,OACnCK,KAAKpB,OAAOkE,EAAMQ,gBAEftD,KAAKN,SAAQ,EACpB,EAED6B,cAAciC,GACPA,IACHxD,KAAKvB,SAAU,GAEjB,KACGuB,KAAKrB,OAAQqB,KAAKpB,OAAQoB,KAAKnB,OAAQmB,KAAKlB,kBAAoBsE,QAAQC,IAAI,CAC3ErD,KAAKyD,YACLzD,KAAK0D,YACL1D,KAAK2D,YACL3D,KAAK4D,iBAKT,CAVA,QAQOJ,IACHxD,KAAKvB,SAAU,EACnB,CACD,EAED8C,qBAAqBuB,SACb9C,KAAK0B,QAAQ,oBAAqB,CACtC/C,OAAQmE,EAAMnE,UACXmE,EAAMe,kBAGL7D,KAAKN,SAAQ,EACpB,EAED6B,4BACQvB,KAAK0B,QAAQ,kCACb1B,KAAKN,SAAQ,EACpB,EAEDP,eAAe2D,GACb9C,KAAKrB,OAAOmE,EAAM1C,IAAI0D,MAAQ,IACzB9D,KAAKrB,OAAOmE,EAAM1C,IAAI0D,SACtBhB,EAAMgB,MAEZ,GAGHC,UACE/D,KAAKN,SACN,G,UG/NH,MAAM,GAA2B,OAAgB,EAAQ,CAAC,CAAC,SAASsE,GAAQ,CAAC,YAAY,qBAEzF,O","sources":["webpack://platypush/./src/components/panels/LightHue/Index.vue","webpack://platypush/./src/components/panels/Light/Utils.vue","webpack://platypush/./src/components/panels/Light/Utils.vue?50cb","webpack://platypush/./src/components/panels/LightHue/Index.vue?9d94"],"sourcesContent":["<template>\n <Loading v-if=\"loading\" />\n <LightPlugin plugin-name=\"light.hue\" :config=\"config\" :lights=\"lights\" :groups=\"groups\" :scenes=\"scenes\"\n :animations=\"animations\" :initial-group=\"initialGroup\" :loading-groups=\"loadingGroups\"\n :color-converter=\"colorConverter\" @group-toggle=\"toggleGroup\" @light-changed=\"onLightChanged\"\n @light-toggle=\"toggleLight\" @set-light=\"setLight\" @set-group=\"setGroup\" @select-scene=\"setScene\"\n @start-animation=\"startAnimation\" @stop-animation=\"stopAnimation\" @refresh=\"refresh(true)\"/>\n</template>\n\n<script>\nimport LightPlugin from \"@/components/panels/Light/Index\";\nimport LightUtils from \"@/components/panels/Light/Utils\";\nimport { ColorConverter } from \"@/components/panels/Light/color\"\nimport Utils from \"@/Utils\";\nimport Loading from \"@/components/Loading\";\n\nexport default {\n name: \"LightHue\",\n components: {Loading, LightPlugin},\n mixins: [Utils, LightUtils],\n props: {\n config: {\n type: Object,\n default: () => {},\n },\n },\n\n data() {\n return {\n loading: false,\n colorConverter: new ColorConverter({\n hue: [0, 65535],\n sat: [0, 255],\n bri: [0, 255],\n ct: [150, 500],\n })\n }\n },\n\n computed: {\n initialGroup() {\n if (!this.config.groups || !Object.keys(this.config.groups).length)\n return null\n\n const group = this.config.groups[0]\n if (group in this.groups)\n return this.groups[group].id\n else if (group in this.groupsByName)\n return this.groupsByName[group].id\n return null\n },\n },\n\n methods: {\n async getLights() {\n return await this.request('light.hue.get_lights')\n },\n\n async getGroups() {\n return Object.entries(await this.request('light.hue.get_groups'))\n .filter((group) => !group[1].recycle && group[1].type.toLowerCase() === 'room')\n .reduce((obj, [id, group]) => {\n obj[id] = group\n return obj\n }, {})\n },\n\n async getScenes() {\n return Object.entries(await this.request('light.hue.get_scenes'))\n .filter((scene) => !scene[1].recycle && scene[1].type.toLowerCase() === 'lightscene')\n .reduce((obj, [id, scene]) => {\n obj[id] = scene\n return obj\n }, {})\n },\n\n async getAnimations() {\n return await this.request('light.hue.get_animations')\n },\n\n async toggleGroup(group) {\n let groups = Object.values(this.groups)\n let args = {\n groups: groups.map((group) => group.name)\n }\n\n if (group != null) {\n groups = [group]\n args = {\n groups: [group.name],\n }\n }\n\n await this.groupAction('light.hue.toggle', args, ...groups)\n await this.refresh(true)\n },\n\n async toggleLight(light) {\n const lights = [light]\n const args = light != null ? {\n lights: [light.name],\n } : {}\n\n await this.lightAction('light.hue.toggle', args, ...lights)\n await this.refresh(true)\n },\n\n async setLight(event) {\n let lights = Object.keys(this.lights)\n const light = event.light\n const args = {}\n\n if (light) {\n args.lights = [light.name]\n lights = [light]\n }\n\n const self = this\n const requests = Object.entries(event.value).map(([attr, value]) => {\n let method = null;\n args.value = value\n\n switch (attr) {\n case 'brightness':\n method = 'light.hue.bri'\n break\n\n case 'temperature':\n method = 'light.hue.ct'\n break\n\n case 'xy':\n method = 'light.hue.xy'\n break\n }\n\n if (method)\n return self.lightAction(method, args, ...lights)\n }).filter((req) => req != null)\n\n await Promise.all(requests)\n await this.refresh(true)\n },\n\n async setGroup(event) {\n if (!event.groupId)\n return this.setLight(event)\n\n const group = this.groups[event.groupId]\n const args = {\n groups: [group.name],\n }\n\n const self = this\n const requests = Object.entries(event.value).map(([attr, value]) => {\n let method = null;\n args.value = value\n\n switch (attr) {\n case 'brightness':\n method = 'light.hue.bri'\n break\n\n case 'temperature':\n method = 'light.hue.ct'\n break\n\n case 'xy':\n method = 'light.hue.xy'\n break\n }\n\n if (method)\n return self.groupAction(method, args, group)\n }).filter((req) => req != null)\n\n await Promise.all(requests)\n await this.refresh(true)\n },\n\n async setScene(event) {\n await this.groupAction('light.hue.scene', {\n name: this.scenes[event.sceneId].name,\n groups: [this.groups[event.groupId].name],\n }, this.groups[event.groupId])\n\n await this.refresh(true)\n },\n\n async refresh(background) {\n if (!background)\n this.loading = true\n\n try {\n [this.lights, this.groups, this.scenes, this.animations] = await Promise.all([\n this.getLights(),\n this.getGroups(),\n this.getScenes(),\n this.getAnimations(),\n ])\n } finally {\n if (!background)\n this.loading = false\n }\n },\n\n async startAnimation(event) {\n await this.request('light.hue.animate', {\n lights: event.lights,\n ...event.animation,\n })\n\n await this.refresh(true)\n },\n\n async stopAnimation() {\n await this.request('light.hue.stop_animation')\n await this.refresh(true)\n },\n\n onLightChanged(event) {\n this.lights[event.id].state = {\n ...this.lights[event.id].state,\n ...event.state,\n }\n },\n },\n\n mounted() {\n this.refresh()\n },\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.lights-plugin {\n @include until($tablet) {\n padding: 0.5em;\n }\n}\n</style>\n","<script>\nexport default {\n name: \"Utils\",\n data() {\n return {\n lights: {},\n groups: {},\n scenes: {},\n animations: {},\n loadingLights: {},\n loadingGroups: {},\n }\n },\n\n computed: {\n groupsByName() {\n if (!this.groups)\n return {}\n\n return Object.entries(this.groups).reduce((groups, [id, group]) => {\n groups[group.name || id] = {\n ...group,\n id: id,\n }\n\n return groups\n }, {})\n },\n },\n\n methods: {\n _getGroups(groupIds) {\n const groups = groupIds.filter((id) => id != null)\n if (!groups.length)\n return Object.values(this.groups)\n\n const self = this\n return groups.map((id) => id instanceof Object ? id : self.groups[id])\n },\n\n _getLights(lightIds) {\n const lights = lightIds.filter((id) => id != null)\n if (!lights.length)\n return Object.values(this.lights)\n\n const self = this\n return lights.map((id) => id instanceof Object ? id : self.lights[id])\n },\n\n setGroupsLoading(groupsIds) {\n const self = this\n this._getGroups(groupsIds).forEach((group) => {\n self.loadingGroups[group.id] = true\n if (group.lights)\n self.setLightsLoading(group.lights)\n })\n },\n\n unsetGroupsLoading(groupsIds) {\n const self = this\n this._getGroups(groupsIds).forEach((group) => {\n if (group.id in self.loadingGroups)\n delete self.loadingGroups[group.id]\n if (group.lights)\n self.setLightsLoading(group.lights)\n })\n },\n\n setLightsLoading(lightIds) {\n const self = this\n this._getLights(lightIds).forEach((light) => {\n self.loadingLights[light.id] = true\n })\n },\n\n unsetLightsLoading(lightIds) {\n const self = this\n this._getLights(lightIds).forEach((light) => {\n if (light.id in self.loadingLights)\n delete self.loadingLights[light.id]\n })\n },\n\n async groupAction(action, args, ...groups) {\n this.setGroupsLoading(groups)\n try {\n return await this.request(action, args)\n } finally {\n this.unsetGroupsLoading(groups)\n }\n },\n\n async lightAction(action, args, ...lights) {\n this.setLightsLoading(lights)\n try {\n return await this.request(action, args)\n } finally {\n this.unsetLightsLoading(lights)\n }\n },\n\n },\n}\n</script>\n","import script from \"./Utils.vue?vue&type=script&lang=js\"\nexport * from \"./Utils.vue?vue&type=script&lang=js\"\n\nconst __exports__ = script;\n\nexport default __exports__","import { render } from \"./Index.vue?vue&type=template&id=1b32374c&scoped=true\"\nimport script from \"./Index.vue?vue&type=script&lang=js\"\nexport * from \"./Index.vue?vue&type=script&lang=js\"\n\nimport \"./Index.vue?vue&type=style&index=0&id=1b32374c&lang=scss&scoped=true\"\n\nimport exportComponent from \"/home/blacklight/git_tree/platypush/platypush/backend/http/webapp/node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render],['__scopeId',\"data-v-1b32374c\"]])\n\nexport default __exports__"],"names":["loading","config","lights","groups","scenes","animations","initialGroup","loadingGroups","colorConverter","toggleGroup","onLightChanged","toggleLight","setLight","setGroup","setScene","startAnimation","stopAnimation","refresh","name","data","loadingLights","computed","groupsByName","this","Object","entries","reduce","id","group","methods","_getGroups","groupIds","filter","length","values","self","map","_getLights","lightIds","setGroupsLoading","groupsIds","forEach","setLightsLoading","unsetGroupsLoading","light","unsetLightsLoading","async","action","args","request","__exports__","components","Loading","LightPlugin","mixins","props","type","default","hue","sat","bri","ct","keys","recycle","toLowerCase","obj","scene","groupAction","lightAction","event","requests","value","attr","method","req","Promise","all","groupId","sceneId","background","getLights","getGroups","getScenes","getAnimations","animation","state","mounted","render"],"sourceRoot":""} |