forked from platypush/platypush
Removed legacy Switches integration [frontend]
This commit is contained in:
parent
6ef2feea71
commit
b6814b4f16
71 changed files with 13 additions and 931 deletions
|
@ -1 +1 @@
|
||||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><link rel="stylesheet" href="/fonts/poppins.css"><title>platypush</title><script defer="defer" type="module" src="/static/js/chunk-vendors.95bedba1.js"></script><script defer="defer" type="module" src="/static/js/app.d2dd2da4.js"></script><link href="/static/css/chunk-vendors.0fcd36f0.css" rel="stylesheet"><link href="/static/css/app.d7cb662c.css" rel="stylesheet"><script defer="defer" src="/static/js/chunk-vendors-legacy.79dede0c.js" nomodule></script><script defer="defer" src="/static/js/app-legacy.c8146c43.js" nomodule></script></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><link rel="stylesheet" href="/fonts/poppins.css"><title>platypush</title><script defer="defer" type="module" src="/static/js/chunk-vendors.95bedba1.js"></script><script defer="defer" type="module" src="/static/js/app.f2f30f9f.js"></script><link href="/static/css/chunk-vendors.0fcd36f0.css" rel="stylesheet"><link href="/static/css/app.d7cb662c.css" rel="stylesheet"><script defer="defer" src="/static/js/chunk-vendors-legacy.79dede0c.js" nomodule></script><script defer="defer" src="/static/js/app-legacy.be9231fd.js" nomodule></script></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[2380],{6:function(e,n,t){t.d(n,{Z:function(){return g}});var i=t(6252),o=t(3577),a=t(9963),r=function(e){return(0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e},s=["checked"],u=r((function(){return(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1)})),c={class:"label"};function l(e,n,t,r,l,d){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:t.disabled}]),onClick:n[0]||(n[0]=(0,a.iM)((function(){return d.onInput&&d.onInput.apply(d,arguments)}),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:t.value},null,8,s),(0,i._)("label",null,[u,(0,i._)("span",c,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var d={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput:function(e){if(this.disabled)return!1;this.$emit("input",e)}}},f=t(3744);const p=(0,f.Z)(d,[["render",l],["__scopeId","data-v-a6396ae8"]]);var g=p},4004:function(e,n,t){t.d(n,{Z:function(){return s}});var i=t(8534),o=(t(1539),t(8309),t(5666),t(6813)),a={name:"SwitchesMixin",mixins:[o.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:function(){return{}}},selected:{type:Boolean,default:!1}},data:function(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent:function(e){e===this.pluginName&&this.refresh()},toggle:function(e,n){var t=this;return(0,i.Z)(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return null==n&&(n=e),i.next=3,t.request("".concat(t.pluginName,".toggle"),{device:n});case 3:o=i.sent,t.devices[e].on=o.on;case 5:case"end":return i.stop()}}),i)})))()},refresh:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loading=!0,n.prev=1,n.next=4,e.request("".concat(e.pluginName,".switch_status"));case 4:e.devices=n.sent.reduce((function(e,n){var t,i=null!==(t=n.name)&&void 0!==t&&t.length?n.name:n.id;return e[i]=n,e}),{});case 5:return n.prev=5,e.loading=!1,n.finish(5);case 8:case"end":return n.stop()}}),n,null,[[1,,5,8]])})))()}},mounted:function(){var e=this;this.$watch((function(){return e.selected}),(function(n){n&&!e.initialized&&(e.refresh(),e.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted:function(){this.bus.off("refresh",this.onRefreshEvent)}};const r=a;var s=r},8671:function(e,n,t){t.d(n,{Z:function(){return w}});t(8309);var i=t(6252),o=t(9963),a=t(3577),r=function(e){return(0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e},s={class:"name col-l-10 col-m-9 col-s-8"},u=r((function(){return(0,i._)("i",{class:"fa fa-info"},null,-1)})),c=[u],l=["textContent"],d={class:"toggler col-l-2 col-m-3 col-s-4"};function f(e,n,t,r,u,f){var p=(0,i.up)("Loading"),g=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:n[1]||(n[1]=(0,o.iM)((function(){return f.onToggle&&f.onToggle.apply(f,arguments)}),["stop"]))},[t.loading?((0,i.wg)(),(0,i.j4)(p,{key:0})):(0,i.kq)("",!0),(0,i._)("div",s,[t.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:n[0]||(n[0]=(0,o.iM)((function(){return f.onInfo&&f.onInfo.apply(f,arguments)}),["prevent"]))},c)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,a.zw)(t.name)},null,8,l)]),(0,i._)("div",d,[(0,i.Wm)(g,{disabled:t.loading,value:t.state,onInput:f.onToggle},null,8,["disabled","value","onInput"])])])}var p=t(6),g=t(1232),h={name:"Switch",components:{Loading:g.Z,ToggleSwitch:p.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo:function(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle:function(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},v=t(3744);const m=(0,v.Z)(h,[["render",f],["__scopeId","data-v-38eb9831"]]);var w=m},2380:function(e,n,t){t.r(n),t.d(n,{default:function(){return p}});t(7941);var i=t(6252),o={class:"switches zwave-mqtt-switches"},a={key:1,class:"no-content"};function r(e,n,t,r,s,u){var c=(0,i.up)("Loading"),l=(0,i.up)("Switch");return(0,i.wg)(),(0,i.iD)("div",o,[e.loading?((0,i.wg)(),(0,i.j4)(c,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",a,"No Z-Wave switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,(function(n,t){return(0,i.wg)(),(0,i.j4)(l,{loading:e.loading,name:t,state:n.on,id:n.id,onToggle:function(i){return e.toggle(t,n.id)},key:t},null,8,["loading","name","state","id","onToggle"])})),128))])}var s=t(1232),u=t(4004),c=t(8671),l={name:"ZwaveMqtt",components:{Switch:c.Z,Loading:s.Z},mixins:[u.Z]},d=t(3744);const f=(0,d.Z)(l,[["render",r],["__scopeId","data-v-c92e52f8"]]);var p=f}}]);
|
|
||||||
//# sourceMappingURL=2380-legacy.0d05fcbd.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[2380],{6:function(e,t,n){n.d(t,{Z:function(){return p}});var i=n(6252),o=n(3577),s=n(9963);const a=e=>((0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e),l=["checked"],d=a((()=>(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1))),c={class:"label"};function u(e,t,n,a,u,r){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(0,s.iM)(((...e)=>r.onInput&&r.onInput(...e)),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:n.value},null,8,l),(0,i._)("label",null,[d,(0,i._)("span",c,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var r={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(e){if(this.disabled)return!1;this.$emit("input",e)}}},g=n(3744);const h=(0,g.Z)(r,[["render",u],["__scopeId","data-v-a6396ae8"]]);var p=h},4004:function(e,t,n){n.d(t,{Z:function(){return a}});var i=n(6813),o={name:"SwitchesMixin",mixins:[i.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:()=>({})},selected:{type:Boolean,default:!1}},data(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent(e){e===this.pluginName&&this.refresh()},async toggle(e,t){null==t&&(t=e);const n=await this.request(`${this.pluginName}.toggle`,{device:t});this.devices[e].on=n.on},async refresh(){this.loading=!0;try{this.devices=(await this.request(`${this.pluginName}.switch_status`)).reduce(((e,t)=>{const n=t.name?.length?t.name:t.id;return e[n]=t,e}),{})}finally{this.loading=!1}}},mounted(){this.$watch((()=>this.selected),(e=>{e&&!this.initialized&&(this.refresh(),this.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted(){this.bus.off("refresh",this.onRefreshEvent)}};const s=o;var a=s},8671:function(e,t,n){n.d(t,{Z:function(){return w}});var i=n(6252),o=n(9963),s=n(3577);const a=e=>((0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e),l={class:"name col-l-10 col-m-9 col-s-8"},d=a((()=>(0,i._)("i",{class:"fa fa-info"},null,-1))),c=[d],u=["textContent"],r={class:"toggler col-l-2 col-m-3 col-s-4"};function g(e,t,n,a,d,g){const h=(0,i.up)("Loading"),p=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:t[1]||(t[1]=(0,o.iM)(((...e)=>g.onToggle&&g.onToggle(...e)),["stop"]))},[n.loading?((0,i.wg)(),(0,i.j4)(h,{key:0})):(0,i.kq)("",!0),(0,i._)("div",l,[n.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,o.iM)(((...e)=>g.onInfo&&g.onInfo(...e)),["prevent"]))},c)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,s.zw)(n.name)},null,8,u)]),(0,i._)("div",r,[(0,i.Wm)(p,{disabled:n.loading,value:n.state,onInput:g.onToggle},null,8,["disabled","value","onInput"])])])}var h=n(6),p=n(1232),f={name:"Switch",components:{Loading:p.Z,ToggleSwitch:h.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},v=n(3744);const m=(0,v.Z)(f,[["render",g],["__scopeId","data-v-38eb9831"]]);var w=m},2380:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var i=n(6252);const o={class:"switches zwave-mqtt-switches"},s={key:1,class:"no-content"};function a(e,t,n,a,l,d){const c=(0,i.up)("Loading"),u=(0,i.up)("Switch");return(0,i.wg)(),(0,i.iD)("div",o,[e.loading?((0,i.wg)(),(0,i.j4)(c,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",s,"No Z-Wave switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,((t,n)=>((0,i.wg)(),(0,i.j4)(u,{loading:e.loading,name:n,state:t.on,id:t.id,onToggle:i=>e.toggle(n,t.id),key:n},null,8,["loading","name","state","id","onToggle"])))),128))])}var l=n(1232),d=n(4004),c=n(8671),u={name:"ZwaveMqtt",components:{Switch:c.Z,Loading:l.Z},mixins:[d.Z]},r=n(3744);const g=(0,r.Z)(u,[["render",a],["__scopeId","data-v-c92e52f8"]]);var h=g}}]);
|
|
||||||
//# sourceMappingURL=2380.292bff03.js.map
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[4276],{4276:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return R}});t(7941);var i=t(6252),r=t(3577),s=t(9963),u=function(e){return(0,i.dD)("data-v-eac2ea44"),e=e(),(0,i.Cn)(),e},c={class:"switches-container"},l={class:"switch-plugins"},o={key:0,class:"no-content"},a=["onClick"],d=["textContent"],p={key:0,class:"refresh col-2"},f=["onClick","disabled"],g=u((function(){return(0,i._)("i",{class:"fa fa-sync"},null,-1)})),h=[g],w={class:"refresh-button"},v=["disabled"],m=u((function(){return(0,i._)("i",{class:"fa fa-sync"},null,-1)})),k=[m];function b(e,n,t,u,g,m){var b=(0,i.up)("Loading");return(0,i.wg)(),(0,i.iD)("div",c,[g.loading?((0,i.wg)(),(0,i.j4)(b,{key:0})):(0,i.kq)("",!0),(0,i._)("div",l,[Object.keys(g.plugins).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",o,"No switch plugins configured")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(Object.keys(g.plugins),(function(e){return(0,i.wg)(),(0,i.iD)("div",{class:"switch-plugin",key:e,onClick:function(n){return g.selectedPlugin=g.selectedPlugin===e?null:e}},[(0,i._)("div",{class:(0,r.C_)(["header",{selected:g.selectedPlugin===e}])},[(0,i._)("div",{class:"name col-10",textContent:(0,r.zw)(e)},null,8,d),g.selectedPlugin===e?((0,i.wg)(),(0,i.iD)("div",p,[(0,i._)("button",{onClick:(0,s.iM)((function(n){return g.bus.emit("refresh",e)}),["stop"]),title:"Refresh plugin",disabled:g.loading},h,8,f)])):(0,i.kq)("",!0)],2),(0,i._)("div",{class:(0,r.C_)(["body",{hidden:g.selectedPlugin!==e}])},[((0,i.wg)(),(0,i.j4)((0,i.LL)(g.components[e]),{config:g.plugins[e],"plugin-name":e,selected:g.selectedPlugin===e,bus:g.bus},null,8,["config","plugin-name","selected","bus"]))],2)],8,a)})),128))]),(0,i._)("div",w,[(0,i._)("button",{onClick:n[0]||(n[0]=function(){return m.refresh&&m.refresh.apply(m,arguments)}),disabled:g.loading,title:"Refresh plugins"},k,8,v)])])}var x=t(8534),_=(t(5666),t(1539),t(4747),t(9600),t(1249),t(4916),t(3123),t(7042),t(8783),t(3948),t(1232)),y=t(6813),C=t(9652),I={name:"Switches",components:{Loading:_.Z},mixins:[y.Z],data:function(){return{loading:!1,plugins:{},components:{},selectedPlugin:null,bus:(0,C.Z)()}},methods:{initPanels:function(){var e=this;this.components={},Object.keys(this.plugins).forEach(function(){var n=(0,x.Z)(regeneratorRuntime.mark((function n(r){var s,u,c;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return s=r.split(".").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join(""),u=null,n.prev=2,n.next=5,t(6371)("./".concat(s,"/Index"));case 5:u=n.sent,n.next=11;break;case 8:return n.prev=8,n.t0=n["catch"](2),n.abrupt("return");case 11:c=(0,i.RC)((0,x.Z)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",u);case 1:case"end":return e.stop()}}),e)})))),e.$options.components[r]=c,e.components[r]=c;case 14:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e){return n.apply(this,arguments)}}())},refresh:function(){var e=this;return(0,x.Z)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loading=!0,n.prev=1,n.next=4,e.request("utils.get_switch_plugins");case 4:e.plugins=n.sent,e.initPanels();case 6:return n.prev=6,e.loading=!1,n.finish(6);case 9:case"end":return n.stop()}}),n,null,[[1,,6,9]])})))()}},mounted:function(){this.refresh()}},P=t(3744);const Z=(0,P.Z)(I,[["render",b],["__scopeId","data-v-eac2ea44"]]);var R=Z},6371:function(e,n,t){var i={"./LightHue/Index":[2844,3490,6590,2844],"./Smartthings/Index":[9196,3490,6590,9196],"./SwitchTplink/Index":[3785,3490,6590,3785],"./SwitchWemo/Index":[5210,3490,6590,5210],"./Switchbot/Index":[9694,3490,6590,9694],"./SwitchbotBluetooth/Index":[9694,3490,6590,9694],"./ZigbeeMqtt/Index":[5466,3490,6590,5466],"./Zwave/Index":[7262,3490,6590,7262],"./ZwaveMqtt/Index":[2380,3490,6590,2380]};function r(e){if(!t.o(i,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=i[e],r=n[0];return Promise.all(n.slice(1).map(t.e)).then((function(){return t(r)}))}r.keys=function(){return Object.keys(i)},r.id=6371,e.exports=r}}]);
|
|
||||||
//# sourceMappingURL=4276-legacy.18787ca7.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[4276],{4276:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return D}});var s=t(6252),i=t(3577),l=t(9963);const c=e=>((0,s.dD)("data-v-eac2ea44"),e=e(),(0,s.Cn)(),e),o={class:"switches-container"},a={class:"switch-plugins"},u={key:0,class:"no-content"},d=["onClick"],r=["textContent"],h={key:0,class:"refresh col-2"},g=["onClick","disabled"],p=c((()=>(0,s._)("i",{class:"fa fa-sync"},null,-1))),f=[p],w={class:"refresh-button"},b=["disabled"],k=c((()=>(0,s._)("i",{class:"fa fa-sync"},null,-1))),m=[k];function v(e,n,t,c,p,k){const v=(0,s.up)("Loading");return(0,s.wg)(),(0,s.iD)("div",o,[p.loading?((0,s.wg)(),(0,s.j4)(v,{key:0})):(0,s.kq)("",!0),(0,s._)("div",a,[Object.keys(p.plugins).length?(0,s.kq)("",!0):((0,s.wg)(),(0,s.iD)("div",u,"No switch plugins configured")),((0,s.wg)(!0),(0,s.iD)(s.HY,null,(0,s.Ko)(Object.keys(p.plugins),(e=>((0,s.wg)(),(0,s.iD)("div",{class:"switch-plugin",key:e,onClick:n=>p.selectedPlugin=p.selectedPlugin===e?null:e},[(0,s._)("div",{class:(0,i.C_)(["header",{selected:p.selectedPlugin===e}])},[(0,s._)("div",{class:"name col-10",textContent:(0,i.zw)(e)},null,8,r),p.selectedPlugin===e?((0,s.wg)(),(0,s.iD)("div",h,[(0,s._)("button",{onClick:(0,l.iM)((n=>p.bus.emit("refresh",e)),["stop"]),title:"Refresh plugin",disabled:p.loading},f,8,g)])):(0,s.kq)("",!0)],2),(0,s._)("div",{class:(0,i.C_)(["body",{hidden:p.selectedPlugin!==e}])},[((0,s.wg)(),(0,s.j4)((0,s.LL)(p.components[e]),{config:p.plugins[e],"plugin-name":e,selected:p.selectedPlugin===e,bus:p.bus},null,8,["config","plugin-name","selected","bus"]))],2)],8,d)))),128))]),(0,s._)("div",w,[(0,s._)("button",{onClick:n[0]||(n[0]=(...e)=>k.refresh&&k.refresh(...e)),disabled:p.loading,title:"Refresh plugins"},m,8,b)])])}var y=t(1232),_=t(6813),C=t(9652),x={name:"Switches",components:{Loading:y.Z},mixins:[_.Z],data(){return{loading:!1,plugins:{},components:{},selectedPlugin:null,bus:(0,C.Z)()}},methods:{initPanels(){this.components={},Object.keys(this.plugins).forEach((async e=>{const n=e.split(".").map((e=>e[0].toUpperCase()+e.slice(1))).join("");let i=null;try{i=await t(6371)(`./${n}/Index`)}catch(c){return}const l=(0,s.RC)((async()=>i));this.$options.components[e]=l,this.components[e]=l}))},async refresh(){this.loading=!0;try{this.plugins=await this.request("utils.get_switch_plugins"),this.initPanels()}finally{this.loading=!1}}},mounted(){this.refresh()}},I=t(3744);const P=(0,I.Z)(x,[["render",v],["__scopeId","data-v-eac2ea44"]]);var D=P},6371:function(e,n,t){var s={"./LightHue/Index":[2844,3490,6590,2844],"./Smartthings/Index":[9196,3490,6590,9196],"./SwitchTplink/Index":[3785,3490,6590,3785],"./SwitchWemo/Index":[5210,3490,6590,5210],"./Switchbot/Index":[9694,3490,6590,9694],"./SwitchbotBluetooth/Index":[9694,3490,6590,9694],"./ZigbeeMqtt/Index":[5466,3490,6590,5466],"./Zwave/Index":[7262,3490,6590,7262],"./ZwaveMqtt/Index":[2380,3490,6590,2380]};function i(e){if(!t.o(s,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=s[e],i=n[0];return Promise.all(n.slice(1).map(t.e)).then((function(){return t(i)}))}i.keys=function(){return Object.keys(s)},i.id=6371,e.exports=i}}]);
|
|
||||||
//# sourceMappingURL=4276.51717631.js.map
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[5466],{6:function(e,n,t){t.d(n,{Z:function(){return p}});var i=t(6252),o=t(3577),a=t(9963),r=function(e){return(0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e},s=["checked"],u=r((function(){return(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1)})),c={class:"label"};function l(e,n,t,r,l,d){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:t.disabled}]),onClick:n[0]||(n[0]=(0,a.iM)((function(){return d.onInput&&d.onInput.apply(d,arguments)}),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:t.value},null,8,s),(0,i._)("label",null,[u,(0,i._)("span",c,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var d={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput:function(e){if(this.disabled)return!1;this.$emit("input",e)}}},f=t(3744);const g=(0,f.Z)(d,[["render",l],["__scopeId","data-v-a6396ae8"]]);var p=g},4004:function(e,n,t){t.d(n,{Z:function(){return s}});var i=t(8534),o=(t(1539),t(8309),t(5666),t(6813)),a={name:"SwitchesMixin",mixins:[o.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:function(){return{}}},selected:{type:Boolean,default:!1}},data:function(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent:function(e){e===this.pluginName&&this.refresh()},toggle:function(e,n){var t=this;return(0,i.Z)(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return null==n&&(n=e),i.next=3,t.request("".concat(t.pluginName,".toggle"),{device:n});case 3:o=i.sent,t.devices[e].on=o.on;case 5:case"end":return i.stop()}}),i)})))()},refresh:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loading=!0,n.prev=1,n.next=4,e.request("".concat(e.pluginName,".switch_status"));case 4:e.devices=n.sent.reduce((function(e,n){var t,i=null!==(t=n.name)&&void 0!==t&&t.length?n.name:n.id;return e[i]=n,e}),{});case 5:return n.prev=5,e.loading=!1,n.finish(5);case 8:case"end":return n.stop()}}),n,null,[[1,,5,8]])})))()}},mounted:function(){var e=this;this.$watch((function(){return e.selected}),(function(n){n&&!e.initialized&&(e.refresh(),e.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted:function(){this.bus.off("refresh",this.onRefreshEvent)}};const r=a;var s=r},8671:function(e,n,t){t.d(n,{Z:function(){return w}});t(8309);var i=t(6252),o=t(9963),a=t(3577),r=function(e){return(0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e},s={class:"name col-l-10 col-m-9 col-s-8"},u=r((function(){return(0,i._)("i",{class:"fa fa-info"},null,-1)})),c=[u],l=["textContent"],d={class:"toggler col-l-2 col-m-3 col-s-4"};function f(e,n,t,r,u,f){var g=(0,i.up)("Loading"),p=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:n[1]||(n[1]=(0,o.iM)((function(){return f.onToggle&&f.onToggle.apply(f,arguments)}),["stop"]))},[t.loading?((0,i.wg)(),(0,i.j4)(g,{key:0})):(0,i.kq)("",!0),(0,i._)("div",s,[t.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:n[0]||(n[0]=(0,o.iM)((function(){return f.onInfo&&f.onInfo.apply(f,arguments)}),["prevent"]))},c)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,a.zw)(t.name)},null,8,l)]),(0,i._)("div",d,[(0,i.Wm)(p,{disabled:t.loading,value:t.state,onInput:f.onToggle},null,8,["disabled","value","onInput"])])])}var g=t(6),p=t(1232),h={name:"Switch",components:{Loading:p.Z,ToggleSwitch:g.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo:function(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle:function(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},v=t(3744);const m=(0,v.Z)(h,[["render",f],["__scopeId","data-v-38eb9831"]]);var w=m},5466:function(e,n,t){t.r(n),t.d(n,{default:function(){return g}});t(7941);var i=t(6252),o={class:"switches zigbee-mqtt-switches"},a={key:1,class:"no-content"};function r(e,n,t,r,s,u){var c=(0,i.up)("Loading"),l=(0,i.up)("Switch");return(0,i.wg)(),(0,i.iD)("div",o,[e.loading?((0,i.wg)(),(0,i.j4)(c,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",a,"No Zigbee switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,(function(n,t){return(0,i.wg)(),(0,i.j4)(l,{loading:e.loading,name:t,state:n.on,onToggle:function(n){return e.toggle(t)},key:t},null,8,["loading","name","state","onToggle"])})),128))])}var s=t(1232),u=t(4004),c=t(8671),l={name:"ZigbeeMqtt",components:{Switch:c.Z,Loading:s.Z},mixins:[u.Z]},d=t(3744);const f=(0,d.Z)(l,[["render",r],["__scopeId","data-v-33812db1"]]);var g=f}}]);
|
|
||||||
//# sourceMappingURL=5466-legacy.ba464f70.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[5466],{6:function(e,t,n){n.d(t,{Z:function(){return p}});var i=n(6252),o=n(3577),s=n(9963);const a=e=>((0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e),l=["checked"],c=a((()=>(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1))),d={class:"label"};function u(e,t,n,a,u,r){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(0,s.iM)(((...e)=>r.onInput&&r.onInput(...e)),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:n.value},null,8,l),(0,i._)("label",null,[c,(0,i._)("span",d,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var r={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(e){if(this.disabled)return!1;this.$emit("input",e)}}},g=n(3744);const h=(0,g.Z)(r,[["render",u],["__scopeId","data-v-a6396ae8"]]);var p=h},4004:function(e,t,n){n.d(t,{Z:function(){return a}});var i=n(6813),o={name:"SwitchesMixin",mixins:[i.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:()=>({})},selected:{type:Boolean,default:!1}},data(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent(e){e===this.pluginName&&this.refresh()},async toggle(e,t){null==t&&(t=e);const n=await this.request(`${this.pluginName}.toggle`,{device:t});this.devices[e].on=n.on},async refresh(){this.loading=!0;try{this.devices=(await this.request(`${this.pluginName}.switch_status`)).reduce(((e,t)=>{const n=t.name?.length?t.name:t.id;return e[n]=t,e}),{})}finally{this.loading=!1}}},mounted(){this.$watch((()=>this.selected),(e=>{e&&!this.initialized&&(this.refresh(),this.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted(){this.bus.off("refresh",this.onRefreshEvent)}};const s=o;var a=s},8671:function(e,t,n){n.d(t,{Z:function(){return w}});var i=n(6252),o=n(9963),s=n(3577);const a=e=>((0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e),l={class:"name col-l-10 col-m-9 col-s-8"},c=a((()=>(0,i._)("i",{class:"fa fa-info"},null,-1))),d=[c],u=["textContent"],r={class:"toggler col-l-2 col-m-3 col-s-4"};function g(e,t,n,a,c,g){const h=(0,i.up)("Loading"),p=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:t[1]||(t[1]=(0,o.iM)(((...e)=>g.onToggle&&g.onToggle(...e)),["stop"]))},[n.loading?((0,i.wg)(),(0,i.j4)(h,{key:0})):(0,i.kq)("",!0),(0,i._)("div",l,[n.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,o.iM)(((...e)=>g.onInfo&&g.onInfo(...e)),["prevent"]))},d)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,s.zw)(n.name)},null,8,u)]),(0,i._)("div",r,[(0,i.Wm)(p,{disabled:n.loading,value:n.state,onInput:g.onToggle},null,8,["disabled","value","onInput"])])])}var h=n(6),p=n(1232),f={name:"Switch",components:{Loading:p.Z,ToggleSwitch:h.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},v=n(3744);const m=(0,v.Z)(f,[["render",g],["__scopeId","data-v-38eb9831"]]);var w=m},5466:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var i=n(6252);const o={class:"switches zigbee-mqtt-switches"},s={key:1,class:"no-content"};function a(e,t,n,a,l,c){const d=(0,i.up)("Loading"),u=(0,i.up)("Switch");return(0,i.wg)(),(0,i.iD)("div",o,[e.loading?((0,i.wg)(),(0,i.j4)(d,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",s,"No Zigbee switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,((t,n)=>((0,i.wg)(),(0,i.j4)(u,{loading:e.loading,name:n,state:t.on,onToggle:t=>e.toggle(n),key:n},null,8,["loading","name","state","onToggle"])))),128))])}var l=n(1232),c=n(4004),d=n(8671),u={name:"ZigbeeMqtt",components:{Switch:d.Z,Loading:l.Z},mixins:[c.Z]},r=n(3744);const g=(0,r.Z)(u,[["render",a],["__scopeId","data-v-33812db1"]]);var h=g}}]);
|
|
||||||
//# sourceMappingURL=5466.c08dda4e.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[7262],{6:function(e,n,t){t.d(n,{Z:function(){return g}});var i=t(6252),o=t(3577),a=t(9963),r=function(e){return(0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e},s=["checked"],u=r((function(){return(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1)})),c={class:"label"};function l(e,n,t,r,l,d){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:t.disabled}]),onClick:n[0]||(n[0]=(0,a.iM)((function(){return d.onInput&&d.onInput.apply(d,arguments)}),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:t.value},null,8,s),(0,i._)("label",null,[u,(0,i._)("span",c,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var d={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput:function(e){if(this.disabled)return!1;this.$emit("input",e)}}},f=t(3744);const p=(0,f.Z)(d,[["render",l],["__scopeId","data-v-a6396ae8"]]);var g=p},4004:function(e,n,t){t.d(n,{Z:function(){return s}});var i=t(8534),o=(t(1539),t(8309),t(5666),t(6813)),a={name:"SwitchesMixin",mixins:[o.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:function(){return{}}},selected:{type:Boolean,default:!1}},data:function(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent:function(e){e===this.pluginName&&this.refresh()},toggle:function(e,n){var t=this;return(0,i.Z)(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return null==n&&(n=e),i.next=3,t.request("".concat(t.pluginName,".toggle"),{device:n});case 3:o=i.sent,t.devices[e].on=o.on;case 5:case"end":return i.stop()}}),i)})))()},refresh:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loading=!0,n.prev=1,n.next=4,e.request("".concat(e.pluginName,".switch_status"));case 4:e.devices=n.sent.reduce((function(e,n){var t,i=null!==(t=n.name)&&void 0!==t&&t.length?n.name:n.id;return e[i]=n,e}),{});case 5:return n.prev=5,e.loading=!1,n.finish(5);case 8:case"end":return n.stop()}}),n,null,[[1,,5,8]])})))()}},mounted:function(){var e=this;this.$watch((function(){return e.selected}),(function(n){n&&!e.initialized&&(e.refresh(),e.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted:function(){this.bus.off("refresh",this.onRefreshEvent)}};const r=a;var s=r},8671:function(e,n,t){t.d(n,{Z:function(){return w}});t(8309);var i=t(6252),o=t(9963),a=t(3577),r=function(e){return(0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e},s={class:"name col-l-10 col-m-9 col-s-8"},u=r((function(){return(0,i._)("i",{class:"fa fa-info"},null,-1)})),c=[u],l=["textContent"],d={class:"toggler col-l-2 col-m-3 col-s-4"};function f(e,n,t,r,u,f){var p=(0,i.up)("Loading"),g=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:n[1]||(n[1]=(0,o.iM)((function(){return f.onToggle&&f.onToggle.apply(f,arguments)}),["stop"]))},[t.loading?((0,i.wg)(),(0,i.j4)(p,{key:0})):(0,i.kq)("",!0),(0,i._)("div",s,[t.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:n[0]||(n[0]=(0,o.iM)((function(){return f.onInfo&&f.onInfo.apply(f,arguments)}),["prevent"]))},c)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,a.zw)(t.name)},null,8,l)]),(0,i._)("div",d,[(0,i.Wm)(g,{disabled:t.loading,value:t.state,onInput:f.onToggle},null,8,["disabled","value","onInput"])])])}var p=t(6),g=t(1232),h={name:"Switch",components:{Loading:g.Z,ToggleSwitch:p.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo:function(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle:function(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},v=t(3744);const m=(0,v.Z)(h,[["render",f],["__scopeId","data-v-38eb9831"]]);var w=m},7262:function(e,n,t){t.r(n),t.d(n,{default:function(){return p}});t(7941);var i=t(6252),o={class:"switches zwave-switches"},a={key:1,class:"no-content"};function r(e,n,t,r,s,u){var c=(0,i.up)("Loading"),l=(0,i.up)("Switch");return(0,i.wg)(),(0,i.iD)("div",o,[e.loading?((0,i.wg)(),(0,i.j4)(c,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",a,"No Z-Wave switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,(function(n,t){return(0,i.wg)(),(0,i.j4)(l,{loading:e.loading,name:t,state:n.on,id:n.id,onToggle:function(i){return e.toggle(t,n.id)},key:t},null,8,["loading","name","state","id","onToggle"])})),128))])}var s=t(1232),u=t(4004),c=t(8671),l={name:"Zwave",components:{Switch:c.Z,Loading:s.Z},mixins:[u.Z]},d=t(3744);const f=(0,d.Z)(l,[["render",r],["__scopeId","data-v-6aa1e625"]]);var p=f}}]);
|
|
||||||
//# sourceMappingURL=7262-legacy.13af887b.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[7262],{6:function(e,t,n){n.d(t,{Z:function(){return p}});var i=n(6252),o=n(3577),s=n(9963);const a=e=>((0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e),l=["checked"],d=a((()=>(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1))),c={class:"label"};function u(e,t,n,a,u,r){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(0,s.iM)(((...e)=>r.onInput&&r.onInput(...e)),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:n.value},null,8,l),(0,i._)("label",null,[d,(0,i._)("span",c,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var r={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(e){if(this.disabled)return!1;this.$emit("input",e)}}},g=n(3744);const h=(0,g.Z)(r,[["render",u],["__scopeId","data-v-a6396ae8"]]);var p=h},4004:function(e,t,n){n.d(t,{Z:function(){return a}});var i=n(6813),o={name:"SwitchesMixin",mixins:[i.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:()=>({})},selected:{type:Boolean,default:!1}},data(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent(e){e===this.pluginName&&this.refresh()},async toggle(e,t){null==t&&(t=e);const n=await this.request(`${this.pluginName}.toggle`,{device:t});this.devices[e].on=n.on},async refresh(){this.loading=!0;try{this.devices=(await this.request(`${this.pluginName}.switch_status`)).reduce(((e,t)=>{const n=t.name?.length?t.name:t.id;return e[n]=t,e}),{})}finally{this.loading=!1}}},mounted(){this.$watch((()=>this.selected),(e=>{e&&!this.initialized&&(this.refresh(),this.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted(){this.bus.off("refresh",this.onRefreshEvent)}};const s=o;var a=s},8671:function(e,t,n){n.d(t,{Z:function(){return w}});var i=n(6252),o=n(9963),s=n(3577);const a=e=>((0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e),l={class:"name col-l-10 col-m-9 col-s-8"},d=a((()=>(0,i._)("i",{class:"fa fa-info"},null,-1))),c=[d],u=["textContent"],r={class:"toggler col-l-2 col-m-3 col-s-4"};function g(e,t,n,a,d,g){const h=(0,i.up)("Loading"),p=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:t[1]||(t[1]=(0,o.iM)(((...e)=>g.onToggle&&g.onToggle(...e)),["stop"]))},[n.loading?((0,i.wg)(),(0,i.j4)(h,{key:0})):(0,i.kq)("",!0),(0,i._)("div",l,[n.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,o.iM)(((...e)=>g.onInfo&&g.onInfo(...e)),["prevent"]))},c)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,s.zw)(n.name)},null,8,u)]),(0,i._)("div",r,[(0,i.Wm)(p,{disabled:n.loading,value:n.state,onInput:g.onToggle},null,8,["disabled","value","onInput"])])])}var h=n(6),p=n(1232),f={name:"Switch",components:{Loading:p.Z,ToggleSwitch:h.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},v=n(3744);const m=(0,v.Z)(f,[["render",g],["__scopeId","data-v-38eb9831"]]);var w=m},7262:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var i=n(6252);const o={class:"switches zwave-switches"},s={key:1,class:"no-content"};function a(e,t,n,a,l,d){const c=(0,i.up)("Loading"),u=(0,i.up)("Switch");return(0,i.wg)(),(0,i.iD)("div",o,[e.loading?((0,i.wg)(),(0,i.j4)(c,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",s,"No Z-Wave switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,((t,n)=>((0,i.wg)(),(0,i.j4)(u,{loading:e.loading,name:n,state:t.on,id:t.id,onToggle:i=>e.toggle(n,t.id),key:n},null,8,["loading","name","state","id","onToggle"])))),128))])}var l=n(1232),d=n(4004),c=n(8671),u={name:"Zwave",components:{Switch:c.Z,Loading:l.Z},mixins:[d.Z]},r=n(3744);const g=(0,r.Z)(u,[["render",a],["__scopeId","data-v-6aa1e625"]]);var h=g}}]);
|
|
||||||
//# sourceMappingURL=7262.6193bf34.js.map
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[9196],{6:function(e,t,n){n.d(t,{Z:function(){return p}});var i=n(6252),o=n(3577),s=n(9963);const a=e=>((0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e),l=["checked"],c=a((()=>(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1))),d={class:"label"};function u(e,t,n,a,u,r){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(0,s.iM)(((...e)=>r.onInput&&r.onInput(...e)),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:n.value},null,8,l),(0,i._)("label",null,[c,(0,i._)("span",d,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var r={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(e){if(this.disabled)return!1;this.$emit("input",e)}}},g=n(3744);const h=(0,g.Z)(r,[["render",u],["__scopeId","data-v-a6396ae8"]]);var p=h},4004:function(e,t,n){n.d(t,{Z:function(){return a}});var i=n(6813),o={name:"SwitchesMixin",mixins:[i.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:()=>({})},selected:{type:Boolean,default:!1}},data(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent(e){e===this.pluginName&&this.refresh()},async toggle(e,t){null==t&&(t=e);const n=await this.request(`${this.pluginName}.toggle`,{device:t});this.devices[e].on=n.on},async refresh(){this.loading=!0;try{this.devices=(await this.request(`${this.pluginName}.switch_status`)).reduce(((e,t)=>{const n=t.name?.length?t.name:t.id;return e[n]=t,e}),{})}finally{this.loading=!1}}},mounted(){this.$watch((()=>this.selected),(e=>{e&&!this.initialized&&(this.refresh(),this.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted(){this.bus.off("refresh",this.onRefreshEvent)}};const s=o;var a=s},9196:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var i=n(6252);const o={class:"switches smartthings-switches"},s={key:1,class:"no-content"};function a(e,t,n,a,l,c){const d=(0,i.up)("Loading"),u=(0,i.up)("Switch");return(0,i.wg)(),(0,i.iD)("div",o,[e.loading?((0,i.wg)(),(0,i.j4)(d,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",s,"No switches found on SmartThings.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,((t,n)=>((0,i.wg)(),(0,i.j4)(u,{loading:e.loading,name:n,state:t.on,onToggle:t=>e.toggle(n),key:n,"has-info":!0,onInfo:t=>{e.selectedDevice=n,e.$refs.switchInfoModal.show()}},null,8,["loading","name","state","onToggle","onInfo"])))),128))])}var l=n(1232),c=n(4004),d=n(8671),u={name:"Smartthings",components:{Switch:d.Z,Loading:l.Z},mixins:[c.Z]},r=n(3744);const g=(0,r.Z)(u,[["render",a],["__scopeId","data-v-7cc9c062"]]);var h=g},8671:function(e,t,n){n.d(t,{Z:function(){return w}});var i=n(6252),o=n(9963),s=n(3577);const a=e=>((0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e),l={class:"name col-l-10 col-m-9 col-s-8"},c=a((()=>(0,i._)("i",{class:"fa fa-info"},null,-1))),d=[c],u=["textContent"],r={class:"toggler col-l-2 col-m-3 col-s-4"};function g(e,t,n,a,c,g){const h=(0,i.up)("Loading"),p=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:t[1]||(t[1]=(0,o.iM)(((...e)=>g.onToggle&&g.onToggle(...e)),["stop"]))},[n.loading?((0,i.wg)(),(0,i.j4)(h,{key:0})):(0,i.kq)("",!0),(0,i._)("div",l,[n.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,o.iM)(((...e)=>g.onInfo&&g.onInfo(...e)),["prevent"]))},d)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,s.zw)(n.name)},null,8,u)]),(0,i._)("div",r,[(0,i.Wm)(p,{disabled:n.loading,value:n.state,onInput:g.onToggle},null,8,["disabled","value","onInput"])])])}var h=n(6),p=n(1232),f={name:"Switch",components:{Loading:p.Z,ToggleSwitch:h.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},v=n(3744);const m=(0,v.Z)(f,[["render",g],["__scopeId","data-v-38eb9831"]]);var w=m}}]);
|
|
||||||
//# sourceMappingURL=9196.462b659b.js.map
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
platypush/backend/http/webapp/dist/static/js/app-legacy.be9231fd.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/app-legacy.be9231fd.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
platypush/backend/http/webapp/dist/static/js/app.f2f30f9f.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/app.f2f30f9f.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,214 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches-container">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
|
|
||||||
<div class="switch-plugins">
|
|
||||||
<div class="no-content" v-if="!Object.keys(plugins).length">No switch plugins configured</div>
|
|
||||||
|
|
||||||
<div class="switch-plugin" v-for="pluginName in Object.keys(plugins)" :key="pluginName"
|
|
||||||
@click="selectedPlugin = selectedPlugin === pluginName ? null : pluginName">
|
|
||||||
<div class="header" :class="{selected: selectedPlugin === pluginName}">
|
|
||||||
<div class="name col-10" v-text="pluginName" />
|
|
||||||
<div class="refresh col-2" v-if="selectedPlugin === pluginName">
|
|
||||||
<button @click.stop="bus.emit('refresh', pluginName)" title="Refresh plugin" :disabled="loading">
|
|
||||||
<i class="fa fa-sync" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="body" :class="{hidden: selectedPlugin !== pluginName}">
|
|
||||||
<component :is="components[pluginName]" :config="plugins[pluginName]" :plugin-name="pluginName"
|
|
||||||
:selected="selectedPlugin === pluginName" :bus="bus" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="refresh-button">
|
|
||||||
<button @click="refresh" :disabled="loading" title="Refresh plugins">
|
|
||||||
<i class="fa fa-sync" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import Utils from "@/Utils";
|
|
||||||
import {defineAsyncComponent} from "vue";
|
|
||||||
import mitt from "mitt";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Switches",
|
|
||||||
components: {Loading},
|
|
||||||
mixins: [Utils],
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: false,
|
|
||||||
plugins: {},
|
|
||||||
components: {},
|
|
||||||
selectedPlugin: null,
|
|
||||||
bus: mitt(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
initPanels() {
|
|
||||||
this.components = {}
|
|
||||||
|
|
||||||
Object.keys(this.plugins).forEach(async (pluginName) => {
|
|
||||||
const componentName = pluginName.split('.').map((token) => token[0].toUpperCase() + token.slice(1)).join('')
|
|
||||||
let comp = null
|
|
||||||
try {
|
|
||||||
comp = await import(`@/components/panels/Switches/${componentName}/Index`)
|
|
||||||
} catch (e) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const component = defineAsyncComponent(async () => { return comp })
|
|
||||||
this.$options.components[pluginName] = component
|
|
||||||
this.components[pluginName] = component
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async refresh() {
|
|
||||||
this.loading = true
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.plugins = await this.request('utils.get_switch_plugins')
|
|
||||||
this.initPanels()
|
|
||||||
} finally {
|
|
||||||
this.loading = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.refresh()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "vars";
|
|
||||||
|
|
||||||
.switches-container {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
.switch-plugins {
|
|
||||||
background: $background-color;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
box-shadow: $border-shadow-bottom-right;
|
|
||||||
|
|
||||||
@media screen and (max-width: calc(#{$tablet - 1px})) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: $tablet) {
|
|
||||||
width: 90%;
|
|
||||||
border-radius: 1em;
|
|
||||||
margin-top: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: $desktop) {
|
|
||||||
width: 500pt;
|
|
||||||
margin-top: 3em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-content {
|
|
||||||
padding: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.switch-plugin {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 1em 1.5em 1em .5em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: .075em;
|
|
||||||
border-bottom: $default-border-2;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $hover-bg;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.selected {
|
|
||||||
background: $selected-bg;
|
|
||||||
box-shadow: $border-shadow-bottom-right;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refresh {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
border: none;
|
|
||||||
background: none;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: $default-hover-fg-2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: $tablet) {
|
|
||||||
&:first-child {
|
|
||||||
.header {
|
|
||||||
border-radius: 1em 1em 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
.header {
|
|
||||||
border-radius: 0 0 1em 1em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.body {
|
|
||||||
display: flex;
|
|
||||||
border: $default-border-2;
|
|
||||||
border-bottom: 0;
|
|
||||||
box-shadow: $border-shadow-bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.refresh-button {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 1.5em;
|
|
||||||
right: 1.5em;
|
|
||||||
|
|
||||||
button {
|
|
||||||
width: 4em;
|
|
||||||
height: 4em;
|
|
||||||
border-radius: 2em;
|
|
||||||
background: $refresh-button-bg;
|
|
||||||
color: $refresh-button-fg;
|
|
||||||
border: none;
|
|
||||||
box-shadow: $border-shadow-bottom-right;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: $default-hover-fg-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:disabled {
|
|
||||||
opacity: .7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,119 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches switchbot-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No Hue lights found.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" @toggle="toggle(name)"
|
|
||||||
v-for="(device, name) in devices" :key="name" :has-info="true"
|
|
||||||
@info="selectedDevice = name; $refs.switchInfoModal.show()" />
|
|
||||||
|
|
||||||
<Modal title="Device Info" ref="switchInfoModal">
|
|
||||||
<div class="switch-info" v-if="selectedDevice">
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">Name</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].name" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">On</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].on" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].reachable != null">
|
|
||||||
<div class="name">Reachable</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].reachable" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].bri != null">
|
|
||||||
<div class="name">Brightness</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].bri" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].ct != null">
|
|
||||||
<div class="name">Color Temperature</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].ct" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].hue != null">
|
|
||||||
<div class="name">Hue</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].hue" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].sat != null">
|
|
||||||
<div class="name">Saturation</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].sat" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].xy != null">
|
|
||||||
<div class="name">XY</div>
|
|
||||||
<div class="value" v-text="`[${devices[selectedDevice].xy.join(', ')}]`" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].productname != null">
|
|
||||||
<div class="name">Product</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].productname" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].manufacturername != null">
|
|
||||||
<div class="name">Manufacturer</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].manufacturername " />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].type != null">
|
|
||||||
<div class="name">Type</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].type " />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].id != null">
|
|
||||||
<div class="name">ID on network</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].id " />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].uniqueid != null">
|
|
||||||
<div class="name">Unique ID</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].uniqueid " />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].swversion != null">
|
|
||||||
<div class="name">Software version</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].swversion " />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].swupdate?.lastinstall">
|
|
||||||
<div class="name">Last software update</div>
|
|
||||||
<div class="value" v-text="formatDate(devices[selectedDevice].swupdate.lastinstall, true)" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].swupdate?.state">
|
|
||||||
<div class="name">Update state</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].swupdate.state" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
import Modal from "@/components/Modal";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "LightHue",
|
|
||||||
components: {Modal, Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
async toggle(device) {
|
|
||||||
const response = await this.request(`${this.pluginName}.toggle`, {lights: [device]})
|
|
||||||
if (response.success)
|
|
||||||
this.devices[device].on = !this.devices[device].on
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1,84 +0,0 @@
|
||||||
<script>
|
|
||||||
import Utils from "@/Utils";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "SwitchesMixin",
|
|
||||||
mixins: [Utils],
|
|
||||||
|
|
||||||
props: {
|
|
||||||
pluginName: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
bus: {
|
|
||||||
type: Object,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
config: {
|
|
||||||
type: Object,
|
|
||||||
default: () => { return {} },
|
|
||||||
},
|
|
||||||
|
|
||||||
selected: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: false,
|
|
||||||
initialized: false,
|
|
||||||
selectedDevice: null,
|
|
||||||
devices: {},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onRefreshEvent(pluginName) {
|
|
||||||
if (pluginName !== this.pluginName)
|
|
||||||
return
|
|
||||||
|
|
||||||
this.refresh()
|
|
||||||
},
|
|
||||||
|
|
||||||
async toggle(device, id) {
|
|
||||||
if (id == null)
|
|
||||||
id = device
|
|
||||||
|
|
||||||
const response = await this.request(`${this.pluginName}.toggle`, {device: id})
|
|
||||||
this.devices[device].on = response.on
|
|
||||||
},
|
|
||||||
|
|
||||||
async refresh() {
|
|
||||||
this.loading = true
|
|
||||||
try {
|
|
||||||
this.devices = (await this.request(`${this.pluginName}.switch_status`)).reduce((obj, device) => {
|
|
||||||
const name = device.name?.length ? device.name : device.id
|
|
||||||
obj[name] = device
|
|
||||||
return obj
|
|
||||||
}, {})
|
|
||||||
} finally {
|
|
||||||
this.loading = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.$watch(() => this.selected, (newValue) => {
|
|
||||||
if (newValue && !this.initialized) {
|
|
||||||
this.refresh()
|
|
||||||
this.initialized = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this.bus.on('refresh', this.onRefreshEvent)
|
|
||||||
},
|
|
||||||
|
|
||||||
unmounted() {
|
|
||||||
this.bus.off('refresh', this.onRefreshEvent)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
|
@ -1,26 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches smartthings-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No switches found on SmartThings.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" @toggle="toggle(name)"
|
|
||||||
v-for="(device, name) in devices" :key="name" :has-info="true"
|
|
||||||
@info="selectedDevice = name; $refs.switchInfoModal.show()" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Smartthings",
|
|
||||||
components: {Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1,94 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switch" @click.stop="onToggle">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="name col-l-10 col-m-9 col-s-8">
|
|
||||||
<button v-if="hasInfo" @click.prevent="onInfo">
|
|
||||||
<i class="fa fa-info" />
|
|
||||||
</button>
|
|
||||||
<span class="name-content" v-text="name" />
|
|
||||||
</div>
|
|
||||||
<div class="toggler col-l-2 col-m-3 col-s-4">
|
|
||||||
<ToggleSwitch :disabled="loading" :value="state" @input="onToggle" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import ToggleSwitch from "@/components/elements/ToggleSwitch";
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Switch",
|
|
||||||
components: {Loading, ToggleSwitch},
|
|
||||||
emits: ['toggle', 'info'],
|
|
||||||
|
|
||||||
props: {
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
state: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
loading: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
hasInfo: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
id: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onInfo(event) {
|
|
||||||
event.stopPropagation()
|
|
||||||
this.$emit('info')
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
|
|
||||||
onToggle(event) {
|
|
||||||
event.stopPropagation()
|
|
||||||
this.$emit('toggle')
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.switch {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
align-items: center;
|
|
||||||
padding: .75em .5em;
|
|
||||||
border-bottom: $default-border-2;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $hover-bg;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggler {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: $default-hover-fg-2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,81 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches tplink-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No TP-Link switches found.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" @toggle="toggle(name)"
|
|
||||||
v-for="(device, name) in devices" :key="name" :has-info="true"
|
|
||||||
@info="selectedDevice = name; $refs.switchInfoModal.show()" />
|
|
||||||
|
|
||||||
<Modal title="Device Info" ref="switchInfoModal">
|
|
||||||
<div class="switch-info" v-if="selectedDevice">
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">Name</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].name" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">On</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].on" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">IP</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].ip" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].hw_info?.mac">
|
|
||||||
<div class="name">MAC</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].hw_info.mac" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].current_consumption != null">
|
|
||||||
<div class="name">Current Consumption</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].current_consumption" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].hw_info?.dev_name">
|
|
||||||
<div class="name">Device Type</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].hw_info.dev_name" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].hw_info?.fwId">
|
|
||||||
<div class="name">Firmware ID</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].hw_info.fwId" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].hw_info?.hwId">
|
|
||||||
<div class="name">Hardware ID</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].hw_info.hwId" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].hw_info?.hw_ver">
|
|
||||||
<div class="name">Hardware Version</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].hw_info.hw_ver" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" v-if="devices[selectedDevice].hw_info?.sw_ver">
|
|
||||||
<div class="name">Software Version</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].hw_info.sw_ver" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
import Modal from "@/components/Modal";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "SwitchTplink",
|
|
||||||
components: {Modal, Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1,46 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches wemo-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No WeMo switches found.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" @toggle="toggle(name)"
|
|
||||||
v-for="(device, name) in devices" :key="name" :has-info="true"
|
|
||||||
@info="selectedDevice = name; $refs.switchInfoModal.show()" />
|
|
||||||
|
|
||||||
<Modal title="Device Info" ref="switchInfoModal">
|
|
||||||
<div class="switch-info" v-if="selectedDevice">
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">Name</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].name" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">On</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].on" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">IP</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].ip" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
import Modal from "@/components/Modal";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "SwitchWemo",
|
|
||||||
components: {Modal, Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1 +0,0 @@
|
||||||
SwitchbotBluetooth
|
|
|
@ -1,46 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches switchbot-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No SwitchBot switches found.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" @toggle="toggle(name)"
|
|
||||||
v-for="(device, name) in devices" :key="name" :has-info="true"
|
|
||||||
@info="selectedDevice = name; $refs.switchInfoModal.show()" />
|
|
||||||
|
|
||||||
<Modal title="Device Info" ref="switchInfoModal">
|
|
||||||
<div class="switch-info" v-if="selectedDevice">
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">Name</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].name" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">On</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].on" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="name">Address</div>
|
|
||||||
<div class="value" v-text="devices[selectedDevice].address" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
import Modal from "@/components/Modal";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "SwitchbotBluetooth",
|
|
||||||
components: {Modal, Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches zigbee-mqtt-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No Zigbee switches found.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" @toggle="toggle(name)"
|
|
||||||
v-for="(device, name) in devices" :key="name" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "ZigbeeMqtt",
|
|
||||||
components: {Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches zwave-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No Z-Wave switches found.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" :id="device.id" @toggle="toggle(name, device.id)"
|
|
||||||
v-for="(device, name) in devices" :key="name" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Zwave",
|
|
||||||
components: {Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="switches zwave-mqtt-switches">
|
|
||||||
<Loading v-if="loading" />
|
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No Z-Wave switches found.</div>
|
|
||||||
|
|
||||||
<Switch :loading="loading" :name="name" :state="device.on" :id="device.id" @toggle="toggle(name, device.id)"
|
|
||||||
v-for="(device, name) in devices" :key="name" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Loading from "@/components/Loading";
|
|
||||||
import SwitchMixin from "@/components/panels/Switches/Mixin";
|
|
||||||
import Switch from "@/components/panels/Switches/Switch";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "ZwaveMqtt",
|
|
||||||
components: {Switch, Loading},
|
|
||||||
mixins: [SwitchMixin],
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "../common";
|
|
||||||
</style>
|
|
|
@ -1,65 +0,0 @@
|
||||||
.switches-container {
|
|
||||||
.switches {
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.no-content {
|
|
||||||
padding: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.switch-info {
|
|
||||||
margin: -1em;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
@media screen and (max-width: calc(#{$tablet} - 1px)) {
|
|
||||||
min-width: calc(100vw - 3em);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: $tablet) {
|
|
||||||
min-width: 45em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.row {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
padding: .5em 1em;
|
|
||||||
|
|
||||||
&:nth-child(odd) {
|
|
||||||
background: $background-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:nth-child(even) {
|
|
||||||
background: $default-bg-3;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $hover-bg;
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: calc(#{$tablet} - 1px)) {
|
|
||||||
flex-wrap: wrap;
|
|
||||||
|
|
||||||
.name,
|
|
||||||
.value {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: $tablet) {
|
|
||||||
.name,
|
|
||||||
.value {
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
$refresh-button-bg: #182c29;
|
|
||||||
$refresh-button-fg: white;
|
|
||||||
|
|
Loading…
Reference in a new issue