forked from platypush/platypush
- If a Z-Wave event includes an explicit value update then explicitly set that value on the node, in order to prevent issues with Z-Wave value updates not yet propagated to the node structure
- Added Z-Wave switch component
This commit is contained in:
parent
fdd46edb6a
commit
14f1c44378
34 changed files with 115 additions and 26 deletions
File diff suppressed because one or more lines are too long
1
platypush/backend/http/webapp/dist/static/css/chunk-07773226.3ce5e818.css
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/css/chunk-07773226.3ce5e818.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
platypush/backend/http/webapp/dist/static/css/chunk-3fe2be8e.44c40b9f.css
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/css/chunk-3fe2be8e.44c40b9f.css
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
1
platypush/backend/http/webapp/dist/static/css/chunk-5d632024.4e589a50.css
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/css/chunk-5d632024.4e589a50.css
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
2
platypush/backend/http/webapp/dist/static/js/app.946fcdab.js
vendored
Normal file
2
platypush/backend/http/webapp/dist/static/js/app.946fcdab.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
platypush/backend/http/webapp/dist/static/js/app.946fcdab.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/app.946fcdab.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
platypush/backend/http/webapp/dist/static/js/chunk-07773226.6dacd37d.js
vendored
Normal file
2
platypush/backend/http/webapp/dist/static/js/chunk-07773226.6dacd37d.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-07773226"],{1889:function(e,t,n){"use strict";n("d4e2")},"65d6":function(e,t,n){"use strict";n.r(t);n("b64b");var c=n("7a23"),a=Object(c["K"])("data-v-33812db1");Object(c["u"])("data-v-33812db1");var i={class:"switches zigbee-mqtt-switches"},b={key:1,class:"no-content"};Object(c["s"])();var o=a((function(e,t,n,a,o,d){var s=Object(c["z"])("Loading"),r=Object(c["z"])("Switch");return Object(c["r"])(),Object(c["e"])("div",i,[e.loading?(Object(c["r"])(),Object(c["e"])(s,{key:0})):Object.keys(e.devices).length?Object(c["f"])("",!0):(Object(c["r"])(),Object(c["e"])("div",b,"No Zigbee switches found.")),(Object(c["r"])(!0),Object(c["e"])(c["a"],null,Object(c["x"])(e.devices,(function(t,n){return Object(c["r"])(),Object(c["e"])(r,{loading:e.loading,name:n,state:t.on,onToggle:function(t){return e.toggle(n)},key:n},null,8,["loading","name","state","onToggle"])})),128))])})),d=n("3a5e"),s=n("487b"),r=n("17dc"),j={name:"ZigbeeMqtt",components:{Switch:r["a"],Loading:d["a"]},mixins:[s["a"]]};n("1889");j.render=o,j.__scopeId="data-v-33812db1";t["default"]=j},d4e2:function(e,t,n){}}]);
|
||||||
|
//# sourceMappingURL=chunk-07773226.6dacd37d.js.map
|
1
platypush/backend/http/webapp/dist/static/js/chunk-07773226.6dacd37d.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/chunk-07773226.6dacd37d.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["webpack:///./src/components/panels/Switches/ZigbeeMqtt/Index.vue?3f68","webpack:///./src/components/panels/Switches/ZigbeeMqtt/Index.vue","webpack:///./src/components/panels/Switches/ZigbeeMqtt/Index.vue?384f"],"names":["class","loading","Object","keys","devices","length","device","name","state","on","toggle","key","components","Switch","Loading","mixins","render","__scopeId"],"mappings":"gHAAA,W,kJCCOA,MAAM,iC,SAEJA,MAAM,c,mIAFb,eAMM,MANN,EAMM,CALW,EAAAC,S,iBAAf,eAA0B,YACUC,OAAOC,KAAK,EAAAC,SAASC,O,wCAAzD,eAAgG,MAAhG,EAAiE,+B,mBAEjE,eACwD,2BAAvB,EAAAD,SAAO,SAAxBE,EAAQC,G,wBADxB,eACwD,GAD/CN,QAAS,EAAAA,QAAUM,KAAMA,EAAOC,MAAOF,EAAOG,GAAK,SAAM,mBAAE,EAAAC,OAAOH,IAChCI,IAAKJ,G,gGASrC,GACbA,KAAM,aACNK,WAAY,CAACC,SAAA,KAAQC,UAAA,MACrBC,OAAQ,CAAC,S,UCbX,EAAOC,OAAS,EAChB,EAAOC,UAAY,kBAEJ,gB","file":"static/js/chunk-07773226.6dacd37d.js","sourcesContent":["export * from \"-!../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader-v16/dist/index.js??ref--0-1!./Index.vue?vue&type=style&index=0&id=33812db1&lang=scss&scoped=true\"","<template>\n <div class=\"switches zigbee-mqtt-switches\">\n <Loading v-if=\"loading\" />\n <div class=\"no-content\" v-else-if=\"!Object.keys(devices).length\">No Zigbee switches found.</div>\n\n <Switch :loading=\"loading\" :name=\"name\" :state=\"device.on\" @toggle=\"toggle(name)\"\n v-for=\"(device, name) in devices\" :key=\"name\" />\n </div>\n</template>\n\n<script>\nimport Loading from \"@/components/Loading\";\nimport SwitchMixin from \"@/components/panels/Switches/Mixin\";\nimport Switch from \"@/components/panels/Switches/Switch\";\n\nexport default {\n name: \"ZigbeeMqtt\",\n components: {Switch, Loading},\n mixins: [SwitchMixin],\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"../common\";\n</style>\n","import { render } from \"./Index.vue?vue&type=template&id=33812db1&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=33812db1&lang=scss&scoped=true\"\nscript.render = render\nscript.__scopeId = \"data-v-33812db1\"\n\nexport default script"],"sourceRoot":""}
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
||||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-31bc5041"],{6341:function(e,n,t){"use strict";t.r(n);t("b64b");var c=t("7a23"),r=Object(c["K"])("data-v-eac2ea44");Object(c["u"])("data-v-eac2ea44");var i={class:"switches-container"},s={class:"switch-plugins"},u={key:0,class:"no-content"},a={key:0,class:"refresh col-2"},o=Object(c["h"])("i",{class:"fa fa-sync"},null,-1),l={class:"refresh-button"},b=Object(c["h"])("i",{class:"fa fa-sync"},null,-1);Object(c["s"])();var d=r((function(e,n,t,r,d,h){var f=Object(c["z"])("Loading");return Object(c["r"])(),Object(c["e"])("div",i,[d.loading?(Object(c["r"])(),Object(c["e"])(f,{key:0})):Object(c["f"])("",!0),Object(c["h"])("div",s,[Object.keys(d.plugins).length?Object(c["f"])("",!0):(Object(c["r"])(),Object(c["e"])("div",u,"No switch plugins configured")),(Object(c["r"])(!0),Object(c["e"])(c["a"],null,Object(c["x"])(Object.keys(d.plugins),(function(e){return Object(c["r"])(),Object(c["e"])("div",{class:"switch-plugin",key:e,onClick:function(n){return d.selectedPlugin=d.selectedPlugin===e?null:e}},[Object(c["h"])("div",{class:["header",{selected:d.selectedPlugin===e}]},[Object(c["h"])("div",{class:"name col-10",textContent:Object(c["C"])(e)},null,8,["textContent"]),d.selectedPlugin===e?(Object(c["r"])(),Object(c["e"])("div",a,[Object(c["h"])("button",{onClick:Object(c["J"])((function(n){return d.bus.emit("refresh",e)}),["stop"]),title:"Refresh plugin",disabled:d.loading},[o],8,["onClick","disabled"])])):Object(c["f"])("",!0)],2),Object(c["h"])("div",{class:["body",{hidden:d.selectedPlugin!==e}]},[(Object(c["r"])(),Object(c["e"])(Object(c["A"])(d.components[e]),{config:d.plugins[e],"plugin-name":e,selected:d.selectedPlugin===e,bus:d.bus},null,8,["config","plugin-name","selected","bus"]))],2)],8,["onClick"])})),128))]),Object(c["h"])("div",l,[Object(c["h"])("button",{onClick:n[1]||(n[1]=function(){return h.refresh.apply(h,arguments)}),disabled:d.loading,title:"Refresh plugins"},[b],8,["disabled"])])])})),h=(t("4160"),t("a15b"),t("d81d"),t("fb6a"),t("d3b7"),t("ac1f"),t("1276"),t("159b"),t("96cf"),t("1da1")),f=t("3a5e"),p=t("3e54"),O=t("14b7"),j={name:"Switches",components:{Loading:f["a"]},mixins:[p["a"]],data:function(){return{loading:!1,plugins:{},components:{},selectedPlugin:null,bus:Object(O["a"])()}},methods:{initPanels:function(){var e=this;this.components={},Object.keys(this.plugins).forEach(function(){var n=Object(h["a"])(regeneratorRuntime.mark((function n(r){var i,s,u;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return i=r.split(".").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join(""),s=null,n.prev=2,n.next=5,t("c1da")("./".concat(i,"/Index"));case 5:s=n.sent,n.next=11;break;case 8:return n.prev=8,n.t0=n["catch"](2),n.abrupt("return");case 11:u=Object(c["i"])(Object(h["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",s);case 1:case"end":return e.stop()}}),e)})))),e.$options.components[r]=u,e.components[r]=u;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 Object(h["a"])(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()}};t("84aa");j.render=d,j.__scopeId="data-v-eac2ea44";n["default"]=j},"7ac9":function(e,n,t){},"84aa":function(e,n,t){"use strict";t("7ac9")},c1da:function(e,n,t){var c={"./LightHue/Index":["0219","chunk-9f884670","chunk-4b03f49b","chunk-e017dc3e"],"./Smartthings/Index":["6e68","chunk-9f884670","chunk-4b03f49b","chunk-972487d6"],"./SwitchSwitchbot/Index":["5083","chunk-9f884670","chunk-4b03f49b","chunk-0021f7ee"],"./SwitchTplink/Index":["d11f","chunk-9f884670","chunk-4b03f49b","chunk-c4aee99e"],"./SwitchWemo/Index":["bedd","chunk-9f884670","chunk-4b03f49b","chunk-60dbbc82"],"./ZigbeeMqtt/Index":["65d6","chunk-9f884670","chunk-4b03f49b","chunk-5ddcb52e"]};function r(e){if(!t.o(c,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=c[e],r=n[0];return Promise.all(n.slice(1).map(t.e)).then((function(){return t(r)}))}r.keys=function(){return Object.keys(c)},r.id="c1da",e.exports=r}}]);
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-31bc5041"],{6341:function(e,n,t){"use strict";t.r(n);t("b64b");var c=t("7a23"),r=Object(c["K"])("data-v-eac2ea44");Object(c["u"])("data-v-eac2ea44");var i={class:"switches-container"},s={class:"switch-plugins"},u={key:0,class:"no-content"},a={key:0,class:"refresh col-2"},o=Object(c["h"])("i",{class:"fa fa-sync"},null,-1),l={class:"refresh-button"},d=Object(c["h"])("i",{class:"fa fa-sync"},null,-1);Object(c["s"])();var b=r((function(e,n,t,r,b,h){var f=Object(c["z"])("Loading");return Object(c["r"])(),Object(c["e"])("div",i,[b.loading?(Object(c["r"])(),Object(c["e"])(f,{key:0})):Object(c["f"])("",!0),Object(c["h"])("div",s,[Object.keys(b.plugins).length?Object(c["f"])("",!0):(Object(c["r"])(),Object(c["e"])("div",u,"No switch plugins configured")),(Object(c["r"])(!0),Object(c["e"])(c["a"],null,Object(c["x"])(Object.keys(b.plugins),(function(e){return Object(c["r"])(),Object(c["e"])("div",{class:"switch-plugin",key:e,onClick:function(n){return b.selectedPlugin=b.selectedPlugin===e?null:e}},[Object(c["h"])("div",{class:["header",{selected:b.selectedPlugin===e}]},[Object(c["h"])("div",{class:"name col-10",textContent:Object(c["C"])(e)},null,8,["textContent"]),b.selectedPlugin===e?(Object(c["r"])(),Object(c["e"])("div",a,[Object(c["h"])("button",{onClick:Object(c["J"])((function(n){return b.bus.emit("refresh",e)}),["stop"]),title:"Refresh plugin",disabled:b.loading},[o],8,["onClick","disabled"])])):Object(c["f"])("",!0)],2),Object(c["h"])("div",{class:["body",{hidden:b.selectedPlugin!==e}]},[(Object(c["r"])(),Object(c["e"])(Object(c["A"])(b.components[e]),{config:b.plugins[e],"plugin-name":e,selected:b.selectedPlugin===e,bus:b.bus},null,8,["config","plugin-name","selected","bus"]))],2)],8,["onClick"])})),128))]),Object(c["h"])("div",l,[Object(c["h"])("button",{onClick:n[1]||(n[1]=function(){return h.refresh.apply(h,arguments)}),disabled:b.loading,title:"Refresh plugins"},[d],8,["disabled"])])])})),h=(t("4160"),t("a15b"),t("d81d"),t("fb6a"),t("d3b7"),t("ac1f"),t("1276"),t("159b"),t("96cf"),t("1da1")),f=t("3a5e"),p=t("3e54"),O=t("14b7"),j={name:"Switches",components:{Loading:f["a"]},mixins:[p["a"]],data:function(){return{loading:!1,plugins:{},components:{},selectedPlugin:null,bus:Object(O["a"])()}},methods:{initPanels:function(){var e=this;this.components={},Object.keys(this.plugins).forEach(function(){var n=Object(h["a"])(regeneratorRuntime.mark((function n(r){var i,s,u;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return i=r.split(".").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join(""),s=null,n.prev=2,n.next=5,t("c1da")("./".concat(i,"/Index"));case 5:s=n.sent,n.next=11;break;case 8:return n.prev=8,n.t0=n["catch"](2),n.abrupt("return");case 11:u=Object(c["i"])(Object(h["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",s);case 1:case"end":return e.stop()}}),e)})))),e.$options.components[r]=u,e.components[r]=u;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 Object(h["a"])(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()}};t("84aa");j.render=b,j.__scopeId="data-v-eac2ea44";n["default"]=j},"7ac9":function(e,n,t){},"84aa":function(e,n,t){"use strict";t("7ac9")},c1da:function(e,n,t){var c={"./LightHue/Index":["0219","chunk-9f884670","chunk-5d632024","chunk-e017dc3e"],"./Smartthings/Index":["6e68","chunk-9f884670","chunk-5d632024","chunk-972487d6"],"./SwitchSwitchbot/Index":["5083","chunk-9f884670","chunk-5d632024","chunk-0021f7ee"],"./SwitchTplink/Index":["d11f","chunk-9f884670","chunk-5d632024","chunk-c4aee99e"],"./SwitchWemo/Index":["bedd","chunk-9f884670","chunk-5d632024","chunk-60dbbc82"],"./ZigbeeMqtt/Index":["65d6","chunk-9f884670","chunk-5d632024","chunk-07773226"],"./Zwave/Index":["e170","chunk-9f884670","chunk-5d632024","chunk-3fe2be8e"]};function r(e){if(!t.o(c,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=c[e],r=n[0];return Promise.all(n.slice(1).map(t.e)).then((function(){return t(r)}))}r.keys=function(){return Object.keys(c)},r.id="c1da",e.exports=r}}]);
|
||||||
//# sourceMappingURL=chunk-31bc5041.1c15b7d2.js.map
|
//# sourceMappingURL=chunk-31bc5041.af10c434.js.map
|
1
platypush/backend/http/webapp/dist/static/js/chunk-31bc5041.af10c434.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/chunk-31bc5041.af10c434.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
platypush/backend/http/webapp/dist/static/js/chunk-3fe2be8e.388c3a73.js
vendored
Normal file
2
platypush/backend/http/webapp/dist/static/js/chunk-3fe2be8e.388c3a73.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3fe2be8e"],{"14d8":function(e,t,n){"use strict";n("febd")},e170:function(e,t,n){"use strict";n.r(t);n("b64b");var c=n("7a23"),a=Object(c["K"])("data-v-70e43f9e");Object(c["u"])("data-v-70e43f9e");var i={class:"switches zigbee-mqtt-switches"},o={key:1,class:"no-content"};Object(c["s"])();var d=a((function(e,t,n,a,d,b){var s=Object(c["z"])("Loading"),r=Object(c["z"])("Switch");return Object(c["r"])(),Object(c["e"])("div",i,[e.loading?(Object(c["r"])(),Object(c["e"])(s,{key:0})):Object.keys(e.devices).length?Object(c["f"])("",!0):(Object(c["r"])(),Object(c["e"])("div",o,"No Z-Wave switches found.")),(Object(c["r"])(!0),Object(c["e"])(c["a"],null,Object(c["x"])(e.devices,(function(t,n){return Object(c["r"])(),Object(c["e"])(r,{loading:e.loading,name:n,state:t.on,id:t.id,onToggle:function(c){return e.toggle(n,t.id)},key:n},null,8,["loading","name","state","id","onToggle"])})),128))])})),b=n("3a5e"),s=n("487b"),r=n("17dc"),j={name:"Zwave",components:{Switch:r["a"],Loading:b["a"]},mixins:[s["a"]]};n("14d8");j.render=d,j.__scopeId="data-v-70e43f9e";t["default"]=j},febd:function(e,t,n){}}]);
|
||||||
|
//# sourceMappingURL=chunk-3fe2be8e.388c3a73.js.map
|
1
platypush/backend/http/webapp/dist/static/js/chunk-3fe2be8e.388c3a73.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/chunk-3fe2be8e.388c3a73.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["webpack:///./src/components/panels/Switches/Zwave/Index.vue?48b6","webpack:///./src/components/panels/Switches/Zwave/Index.vue","webpack:///./src/components/panels/Switches/Zwave/Index.vue?bf6d"],"names":["class","loading","Object","keys","devices","length","device","name","state","on","id","toggle","key","components","Switch","Loading","mixins","render","__scopeId"],"mappings":"kHAAA,W,gJCCOA,MAAM,iC,SAEJA,MAAM,c,mIAFb,eAMM,MANN,EAMM,CALW,EAAAC,S,iBAAf,eAA0B,YACUC,OAAOC,KAAK,EAAAC,SAASC,O,wCAAzD,eAAgG,MAAhG,EAAiE,+B,mBAEjE,eACwD,2BAAvB,EAAAD,SAAO,SAAxBE,EAAQC,G,wBADxB,eACwD,GAD/CN,QAAS,EAAAA,QAAUM,KAAMA,EAAOC,MAAOF,EAAOG,GAAKC,GAAIJ,EAAOI,GAAK,SAAM,mBAAE,EAAAC,OAAOJ,EAAMD,EAAOI,KAC7DE,IAAKL,G,qGASrC,GACbA,KAAM,QACNM,WAAY,CAACC,SAAA,KAAQC,UAAA,MACrBC,OAAQ,CAAC,S,UCbX,EAAOC,OAAS,EAChB,EAAOC,UAAY,kBAEJ,gB","file":"static/js/chunk-3fe2be8e.388c3a73.js","sourcesContent":["export * from \"-!../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader-v16/dist/index.js??ref--0-1!./Index.vue?vue&type=style&index=0&id=70e43f9e&lang=scss&scoped=true\"","<template>\n <div class=\"switches zigbee-mqtt-switches\">\n <Loading v-if=\"loading\" />\n <div class=\"no-content\" v-else-if=\"!Object.keys(devices).length\">No Z-Wave switches found.</div>\n\n <Switch :loading=\"loading\" :name=\"name\" :state=\"device.on\" :id=\"device.id\" @toggle=\"toggle(name, device.id)\"\n v-for=\"(device, name) in devices\" :key=\"name\" />\n </div>\n</template>\n\n<script>\nimport Loading from \"@/components/Loading\";\nimport SwitchMixin from \"@/components/panels/Switches/Mixin\";\nimport Switch from \"@/components/panels/Switches/Switch\";\n\nexport default {\n name: \"Zwave\",\n components: {Switch, Loading},\n mixins: [SwitchMixin],\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"../common\";\n</style>\n","import { render } from \"./Index.vue?vue&type=template&id=70e43f9e&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=70e43f9e&lang=scss&scoped=true\"\nscript.render = render\nscript.__scopeId = \"data-v-70e43f9e\"\n\nexport default script"],"sourceRoot":""}
|
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 @@
|
||||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4b03f49b"],{"17dc":function(e,t,n){"use strict";n("b0c0");var i=n("7a23"),o=Object(i["K"])("data-v-755a3c5f");Object(i["u"])("data-v-755a3c5f");var a={class:"name col-l-10 col-m-9 col-s-8"},c=Object(i["h"])("i",{class:"fa fa-info"},null,-1),r={class:"toggler col-l-2 col-m-3 col-s-4"};Object(i["s"])();var s=o((function(e,t,n,o,s,u){var l=Object(i["z"])("Loading"),f=Object(i["z"])("ToggleSwitch");return Object(i["r"])(),Object(i["e"])("div",{class:"switch",onClick:t[2]||(t[2]=Object(i["J"])((function(){return u.onToggle.apply(u,arguments)}),["stop"]))},[n.loading?(Object(i["r"])(),Object(i["e"])(l,{key:0})):Object(i["f"])("",!0),Object(i["h"])("div",a,[n.hasInfo?(Object(i["r"])(),Object(i["e"])("button",{key:0,onClick:t[1]||(t[1]=Object(i["J"])((function(){return u.onInfo.apply(u,arguments)}),["prevent"]))},[c])):Object(i["f"])("",!0),Object(i["h"])("span",{class:"name-content",textContent:Object(i["C"])(n.name)},null,8,["textContent"])]),Object(i["h"])("div",r,[Object(i["h"])(f,{disabled:n.loading,value:n.state,onInput:u.onToggle},null,8,["disabled","value","onInput"])])])})),u=n("0279"),l=n("3a5e"),f={name:"Switch",components:{Loading:l["a"],ToggleSwitch:u["a"]},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1}},methods:{onInfo:function(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle:function(e){return e.stopPropagation(),this.$emit("toggle"),!1}}};n("21ae");f.render=s,f.__scopeId="data-v-755a3c5f";t["a"]=f},"21ae":function(e,t,n){"use strict";n("3386")},3386:function(e,t,n){},"487b":function(e,t,n){"use strict";n("13d5"),n("b0c0"),n("96cf");var i=n("1da1"),o=n("3e54"),a={name:"SwitchesMixin",mixins:[o["a"]],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){var t=this;return Object(i["a"])(regeneratorRuntime.mark((function n(){var i;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.request("".concat(t.pluginName,".toggle"),{device:e});case 2:i=n.sent,t.devices[e].on=i.on;case 4:case"end":return n.stop()}}),n)})))()},refresh:function(){var e=this;return Object(i["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.prev=1,t.next=4,e.request("".concat(e.pluginName,".switch_status"));case 4:e.devices=t.sent.reduce((function(e,t){var n,i=(null===(n=t.name)||void 0===n?void 0:n.length)?t.name:t.id;return e[i]=t,e}),{});case 5:return t.prev=5,e.loading=!1,t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])})))()}},mounted:function(){var e=this;this.$watch((function(){return e.selected}),(function(t){t&&!e.initialized&&(e.refresh(),e.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted:function(){this.bus.off("refresh",this.onRefreshEvent)}};t["a"]=a}}]);
|
|
||||||
//# sourceMappingURL=chunk-4b03f49b.2f384634.js.map
|
|
File diff suppressed because one or more lines are too long
2
platypush/backend/http/webapp/dist/static/js/chunk-5d632024.285736ce.js
vendored
Normal file
2
platypush/backend/http/webapp/dist/static/js/chunk-5d632024.285736ce.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5d632024"],{"17dc":function(e,t,n){"use strict";n("b0c0");var i=n("7a23"),o=Object(i["K"])("data-v-38eb9831");Object(i["u"])("data-v-38eb9831");var c={class:"name col-l-10 col-m-9 col-s-8"},a=Object(i["h"])("i",{class:"fa fa-info"},null,-1),r={class:"toggler col-l-2 col-m-3 col-s-4"};Object(i["s"])();var s=o((function(e,t,n,o,s,u){var l=Object(i["z"])("Loading"),d=Object(i["z"])("ToggleSwitch");return Object(i["r"])(),Object(i["e"])("div",{class:"switch",onClick:t[2]||(t[2]=Object(i["J"])((function(){return u.onToggle.apply(u,arguments)}),["stop"]))},[n.loading?(Object(i["r"])(),Object(i["e"])(l,{key:0})):Object(i["f"])("",!0),Object(i["h"])("div",c,[n.hasInfo?(Object(i["r"])(),Object(i["e"])("button",{key:0,onClick:t[1]||(t[1]=Object(i["J"])((function(){return u.onInfo.apply(u,arguments)}),["prevent"]))},[a])):Object(i["f"])("",!0),Object(i["h"])("span",{class:"name-content",textContent:Object(i["C"])(n.name)},null,8,["textContent"])]),Object(i["h"])("div",r,[Object(i["h"])(d,{disabled:n.loading,value:n.state,onInput:u.onToggle},null,8,["disabled","value","onInput"])])])})),u=n("0279"),l=n("3a5e"),d={name:"Switch",components:{Loading:l["a"],ToggleSwitch:u["a"]},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}}};n("fe3c");d.render=s,d.__scopeId="data-v-38eb9831";t["a"]=d},"43ec":function(e,t,n){},"487b":function(e,t,n){"use strict";n("13d5"),n("b0c0"),n("96cf");var i=n("1da1"),o=n("3e54"),c={name:"SwitchesMixin",mixins:[o["a"]],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,t){var n=this;return Object(i["a"])(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return null==t&&(t=e),i.next=3,n.request("".concat(n.pluginName,".toggle"),{device:e});case 3:o=i.sent,n.devices[e].on=o.on;case 5:case"end":return i.stop()}}),i)})))()},refresh:function(){var e=this;return Object(i["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.prev=1,t.next=4,e.request("".concat(e.pluginName,".switch_status"));case 4:e.devices=t.sent.reduce((function(e,t){var n,i=(null===(n=t.name)||void 0===n?void 0:n.length)?t.name:t.id;return e[i]=t,e}),{});case 5:return t.prev=5,e.loading=!1,t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])})))()}},mounted:function(){var e=this;this.$watch((function(){return e.selected}),(function(t){t&&!e.initialized&&(e.refresh(),e.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted:function(){this.bus.off("refresh",this.onRefreshEvent)}};t["a"]=c},fe3c:function(e,t,n){"use strict";n("43ec")}}]);
|
||||||
|
//# sourceMappingURL=chunk-5d632024.285736ce.js.map
|
1
platypush/backend/http/webapp/dist/static/js/chunk-5d632024.285736ce.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/chunk-5d632024.285736ce.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5ddcb52e"],{"65d6":function(e,t,c){"use strict";c.r(t);c("b64b");var n=c("7a23"),o=Object(n["K"])("data-v-b96c79fe");Object(n["u"])("data-v-b96c79fe");var a={class:"switches zigbee-mqtt-switches"},i={key:1,class:"no-content"};Object(n["s"])();var s=o((function(e,t,c,o,s,b){var d=Object(n["z"])("Loading"),r=Object(n["z"])("Switch");return Object(n["r"])(),Object(n["e"])("div",a,[e.loading?(Object(n["r"])(),Object(n["e"])(d,{key:0})):Object.keys(e.devices).length?Object(n["f"])("",!0):(Object(n["r"])(),Object(n["e"])("div",i,"No Zigbee switches found.")),(Object(n["r"])(!0),Object(n["e"])(n["a"],null,Object(n["x"])(e.devices,(function(t,c){return Object(n["r"])(),Object(n["e"])(r,{loading:e.loading,name:c,state:t.on,onToggle:function(t){return e.toggle(c)},key:c,"has-info":!0,onInfo:function(t){e.selectedDevice=c,e.$refs.switchInfoModal.show()}},null,8,["loading","name","state","onToggle","onInfo"])})),128))])})),b=c("3a5e"),d=c("487b"),r=c("17dc"),u={name:"ZigbeeMqtt",components:{Switch:r["a"],Loading:b["a"]},mixins:[d["a"]]};c("c510");u.render=s,u.__scopeId="data-v-b96c79fe";t["default"]=u},a1d6:function(e,t,c){},c510:function(e,t,c){"use strict";c("a1d6")}}]);
|
|
||||||
//# sourceMappingURL=chunk-5ddcb52e.c1af216d.js.map
|
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":["webpack:///./src/components/panels/Switches/ZigbeeMqtt/Index.vue","webpack:///./src/components/panels/Switches/ZigbeeMqtt/Index.vue?384f","webpack:///./src/components/panels/Switches/ZigbeeMqtt/Index.vue?f1a7"],"names":["class","loading","Object","keys","devices","length","device","name","state","on","toggle","key","has-info","selectedDevice","$refs","switchInfoModal","show","components","Switch","Loading","mixins","render","__scopeId"],"mappings":"gOACOA,MAAM,iC,SAEJA,MAAM,c,mIAFb,eAOM,MAPN,EAOM,CANW,EAAAC,S,iBAAf,eAA0B,YACUC,OAAOC,KAAK,EAAAC,SAASC,O,wCAAzD,eAAgG,MAAhG,EAAiE,+B,mBAEjE,eAEsE,2BADrC,EAAAD,SAAO,SAAxBE,EAAQC,G,wBADxB,eAEsE,GAF7DN,QAAS,EAAAA,QAAUM,KAAMA,EAAOC,MAAOF,EAAOG,GAAK,SAAM,mBAAE,EAAAC,OAAOH,IAChCI,IAAKJ,EAAOK,YAAU,EACxD,OAAI,YAAE,EAAAC,eAAiBN,EAAM,EAAAO,MAAMC,gBAAgBC,S,yGASjD,GACbT,KAAM,aACNU,WAAY,CAACC,SAAA,KAAQC,UAAA,MACrBC,OAAQ,CAAC,S,UCdX,EAAOC,OAAS,EAChB,EAAOC,UAAY,kBAEJ,gB,yDCRf","file":"static/js/chunk-5ddcb52e.c1af216d.js","sourcesContent":["<template>\n <div class=\"switches zigbee-mqtt-switches\">\n <Loading v-if=\"loading\" />\n <div class=\"no-content\" v-else-if=\"!Object.keys(devices).length\">No Zigbee switches found.</div>\n\n <Switch :loading=\"loading\" :name=\"name\" :state=\"device.on\" @toggle=\"toggle(name)\"\n v-for=\"(device, name) in devices\" :key=\"name\" :has-info=\"true\"\n @info=\"selectedDevice = name; $refs.switchInfoModal.show()\" />\n </div>\n</template>\n\n<script>\nimport Loading from \"@/components/Loading\";\nimport SwitchMixin from \"@/components/panels/Switches/Mixin\";\nimport Switch from \"@/components/panels/Switches/Switch\";\n\nexport default {\n name: \"ZigbeeMqtt\",\n components: {Switch, Loading},\n mixins: [SwitchMixin],\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"../common\";\n</style>\n","import { render } from \"./Index.vue?vue&type=template&id=b96c79fe&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=b96c79fe&lang=scss&scoped=true\"\nscript.render = render\nscript.__scopeId = \"data-v-b96c79fe\"\n\nexport default script","export * from \"-!../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader-v16/dist/index.js??ref--0-1!./Index.vue?vue&type=style&index=0&id=b96c79fe&lang=scss&scoped=true\""],"sourceRoot":""}
|
|
2
platypush/backend/http/webapp/dist/static/js/chunk-61bbbfec.01484695.js
vendored
Normal file
2
platypush/backend/http/webapp/dist/static/js/chunk-61bbbfec.01484695.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
platypush/backend/http/webapp/dist/static/js/chunk-61bbbfec.01484695.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/chunk-61bbbfec.01484695.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -44,7 +44,10 @@ export default {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
async toggle(device) {
|
async toggle(device, id) {
|
||||||
|
if (id == null)
|
||||||
|
id = device
|
||||||
|
|
||||||
const response = await this.request(`${this.pluginName}.toggle`, {device: device})
|
const response = await this.request(`${this.pluginName}.toggle`, {device: device})
|
||||||
this.devices[device].on = response.on
|
this.devices[device].on = response.on
|
||||||
},
|
},
|
||||||
|
|
|
@ -42,6 +42,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
<div class="no-content" v-else-if="!Object.keys(devices).length">No Zigbee switches found.</div>
|
<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)"
|
<Switch :loading="loading" :name="name" :state="device.on" @toggle="toggle(name)"
|
||||||
v-for="(device, name) in devices" :key="name" :has-info="true"
|
v-for="(device, name) in devices" :key="name" />
|
||||||
@info="selectedDevice = name; $refs.switchInfoModal.show()" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<template>
|
||||||
|
<div class="switches zigbee-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: "Zwave",
|
||||||
|
components: {Switch, Loading},
|
||||||
|
mixins: [SwitchMixin],
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "../common";
|
||||||
|
</style>
|
|
@ -392,6 +392,8 @@ export default {
|
||||||
|
|
||||||
onNodeUpdate(event) {
|
onNodeUpdate(event) {
|
||||||
this.nodes[event.node.node_id] = event.node
|
this.nodes[event.node.node_id] = event.node
|
||||||
|
if (event.value)
|
||||||
|
this.nodes[event.node.node_id].values[event.value.id_on_network] = event.value
|
||||||
},
|
},
|
||||||
|
|
||||||
onNodeClick(nodeId) {
|
onNodeClick(nodeId) {
|
||||||
|
|
|
@ -7,10 +7,11 @@ from openzwave.value import ZWaveValue
|
||||||
|
|
||||||
from platypush.backend.zwave import ZwaveBackend
|
from platypush.backend.zwave import ZwaveBackend
|
||||||
from platypush.context import get_backend
|
from platypush.context import get_backend
|
||||||
from platypush.plugins import Plugin, action
|
from platypush.plugins import action
|
||||||
|
from platypush.plugins.switch import SwitchPlugin
|
||||||
|
|
||||||
|
|
||||||
class ZwavePlugin(Plugin):
|
class ZwavePlugin(SwitchPlugin):
|
||||||
"""
|
"""
|
||||||
This plugin interacts with the devices on a Z-Wave network started through the
|
This plugin interacts with the devices on a Z-Wave network started through the
|
||||||
:class:`platypush.backend.zwave.ZwaveBackend` backend.
|
:class:`platypush.backend.zwave.ZwaveBackend` backend.
|
||||||
|
@ -202,6 +203,7 @@ class ZwavePlugin(Plugin):
|
||||||
if not node:
|
if not node:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
# noinspection PyProtectedMember
|
||||||
return {
|
return {
|
||||||
'node_id': node.node_id,
|
'node_id': node.node_id,
|
||||||
'home_id': node.home_id,
|
'home_id': node.home_id,
|
||||||
|
@ -971,5 +973,55 @@ class ZwavePlugin(Plugin):
|
||||||
"""
|
"""
|
||||||
self._get_network().write_config()
|
self._get_network().write_config()
|
||||||
|
|
||||||
|
@action
|
||||||
|
def on(self, device: str, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Turn on a switch on a device.
|
||||||
|
|
||||||
|
:param device: ``id_on_network`` of the value to be switched on.
|
||||||
|
"""
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
switches = self.get_switches().output
|
||||||
|
assert device in switches, 'No such id_on_network associated to a switch: {}'.format(device)
|
||||||
|
return self.set_value(data=True, id_on_network=device)
|
||||||
|
|
||||||
|
@action
|
||||||
|
def off(self, device: str, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Turn on a switch on a device.
|
||||||
|
|
||||||
|
:param device: ``id_on_network`` of the value to be switched off.
|
||||||
|
"""
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
switches = self.get_switches().output
|
||||||
|
assert device in switches, 'No such id_on_network associated to a switch: {}'.format(device)
|
||||||
|
return self.set_value(data=False, id_on_network=device)
|
||||||
|
|
||||||
|
@action
|
||||||
|
def toggle(self, device: str, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Toggle a switch on a device.
|
||||||
|
|
||||||
|
:param device: ``id_on_network`` of the value to be toggled.
|
||||||
|
"""
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
switches = self.get_switches().output
|
||||||
|
assert device in switches, 'No such id_on_network associated to a switch: {}'.format(device)
|
||||||
|
data = switches[device]['data']
|
||||||
|
return self.set_value(data=not data, id_on_network=device)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def switches(self) -> List[dict]:
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
devices = self.get_switches().output.values()
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'name': '{} - {}'.format(dev.get('node_name', '[No Name]'), dev.get('label', '[No Label]')),
|
||||||
|
'on': dev.get('data'),
|
||||||
|
'id': dev.get('id_on_network'),
|
||||||
|
}
|
||||||
|
for dev in devices
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# vim:sw=4:ts=4:et:
|
# vim:sw=4:ts=4:et:
|
||||||
|
|
Loading…
Reference in a new issue