UNPKG

zwave-js-ui

Version:

Z-Wave Control Panel and MQTT Gateway

5 lines (4 loc) 9.53 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-ADMIo1NV.js","./index-CtTdmJsx.js","./index-2j-kvxFz.css","./vuedraggable.umd-VX2Gn67H.js","./index-BV77wOsY.css","./DialogAdvanced-BqKvspGm.js","./DialogAdvanced-D5KZ1_3L.css","./StatisticsCard-gZOwl51N.js","./SmartView-DJWvKyHK.js"])))=>i.map(i=>d[i]); import{L as d,I as u,_ as s,m as p,u as a,S as h,a as m,j as f,C as r,n as g}from"./index-CtTdmJsx.js";const c=d.get("ControlPanel"),v={name:"ControlPanel",props:{socket:Object},mixins:[u],components:{NodesTable:()=>s(()=>import("./index-ADMIo1NV.js").then(o=>o.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url),DialogAdvanced:()=>s(()=>import("./DialogAdvanced-BqKvspGm.js"),__vite__mapDeps([5,1,2,6]),import.meta.url),StatisticsCard:()=>s(()=>import("./StatisticsCard-gZOwl51N.js"),__vite__mapDeps([7,1,2]),import.meta.url),SmartView:()=>s(()=>import("./SmartView-DJWvKyHK.js"),__vite__mapDeps([8,1,2]),import.meta.url)},computed:{...p(a,["nodes","zwave","controllerNode"]),timeoutMs(){return this.zwave.commandsTimeout*1e3+800},statisticsOpeningIndicator(){return this.showControllerStatistics?"arrow_drop_up":"arrow_drop_down"},compact(){return this.$vuetify.breakpoint.smAndDown||this.compactMode},compactMode:{get(){return a().ui.compactMode},set(o){a().setCompactMode(o)}},actions(){return this.selected.length===0?this.generalActions:this.selectedActions},advancedDialogTitle(){return this.selected.length===0?"General actions":`Actions for ${this.selected.length} selected node${this.selected.length>1?"s":""}`}},watch:{},data(){return{fab:!1,selected:[],settings:new h(localStorage),advancedShowDialog:!1,generalActions:[{text:"Backup",options:[{name:"Import",action:"import"},{name:"Export",action:"export"}],icon:"save",desc:"Save or load `nodes.json` file with names and locations"},{text:"Dump",options:[{name:"Export",action:"exportDump"}],icon:"bug_report",desc:"Export all nodes in a json file. Useful for debugging purposes"},{text:"Re-interview Nodes",options:[{name:"Start",action:"refreshInfo",args:{broadcast:!0}}],icon:"history",color:"warning",desc:"Clear all info about all nodes and make a new full interview. Use when nodes has wrong or missing capabilities"},{text:"Rebuild Routes",options:[{name:"Begin",action:"beginRebuildingRoutes"},{name:"Stop",action:"stopRebuildingRoutes"}],icon:"healing",color:"warning",desc:"Force nodes to establish new connections to the controller"},{text:"Hard Reset",options:[{name:"Factory Reset",action:"hardReset"}],icon:"warning",color:"red",desc:"Reset controller to factory defaults (all paired devices will be removed)"},{text:"Soft Reset",options:[{name:"Soft Reset",action:"softReset",args:{confirm:`<p>Are you sure you want to soft-reset your controller?</p> <p>USB modules will reconnect, meaning that they might get a new address. Make sure to configure your device address in a way that prevents it from changing, e.g. by using <code>/dev/serial/by-id/...</code> on Linux.</p> <p><strong>This method may cause problems in Docker containers with certain Z-Wave stick.</strong> If that happens, you may need to restart your host OS and docker container.</p>`}}],icon:"refresh",color:"warning",desc:"Instruct the controller to soft-reset (restart)"},{text:"Failed Nodes",options:[{name:"Remove all",action:"removeFailedNode",args:{broadcast:!0,confirm:"This action will remove all failed nodes. ATTENTION: this will skip sleeping nodes to prevent unwanted behaviours"}}],icon:"dangerous",color:"error",desc:"Manage nodes that are dead and/or marked as failed with the controller"},{text:"Driver function",options:[{name:"Write",action:"driverFunction"}],icon:"code",desc:"Write a custom JS function using the ZwaveJS Driver"},{text:"NVM Management",options:[{name:"Backup",action:"backupNVMRaw"},{name:"Restore",action:"restoreNVM"}],icon:"update",color:"warning",desc:"Backup/Restore controller's NVM (Non Volatile Memory)"},{text:"Firmware update OTW",options:[{name:"Update",action:"firmwareUpdateOTW"}],icon:"update",color:"red",desc:"Perform a firmware update OTW (Over The Wire)"},{text:"Shutdown Zwave API",options:[{name:"Shutdown",action:"shutdownZwaveAPI",args:{confirm:"Are you sure you want to shutdown the Zwave API? You will have to unplug and replug the Zwave stick manually to restart it.",confirmLevel:"warning"}}],icon:"power_off",color:"warning",desc:"Allows to shutdown the Zwave API to safely unplug the Zwave stick."}],rules:{required:o=>{let e=!1;return o instanceof Array?e=o.length>0:e=!isNaN(o)||!!o,e||"This field is required."}},selectedActions:[{text:"Re-interview Node",options:[{name:"Interview",action:"refreshInfo"}],icon:"history",desc:"Clear all info about this node and make a new full interview. Use when the node has wrong or missing capabilities"},{text:"Refresh Values",options:[{name:"Refresh",action:"refreshValues",args:{confirm:"Are you sure you want to refresh values of this node? This action increases network traffic"}}],icon:"cached",desc:"Update all CC values and metadata. Use only when many values seems stale"},{text:"Rebuild Node Routes",options:[{name:"Rebuild",action:"rebuildNodeRoutes",args:{confirm:"Rebuilding routes of a specific node. This action causes a lot of traffic, can take minutes up to hours and you can expect degraded performance while it is going on"}}],icon:"healing",color:"warning",desc:"Discover and assign new routes between a specific node to the controller and his neighbors"},{text:"Ping",options:[{name:"Ping",action:"pingNode"}],icon:"swap_horiz",desc:"Ping node to check if it is alive"}],showControllerStatistics:!1}},methods:{...m(a,["setRebuildRoutesProgress","showSnackbar"]),jsonToList:f,showNodesManager(){this.app.showNodesManager()},async onAction(o,e={}){o==="import"?this.importConfiguration():o==="export"?this.exportConfiguration():o==="exportDump"?this.exportDump():this.sendAction(o,{...e,nodes:this.selected})},async importConfiguration(){if(await this.app.confirm("Attention","This will override all existing nodes names and locations","alert"))try{const{data:o}=await this.app.importFile("json"),e=await r.importConfig({data:o});this.showSnackbar(e.message,e.success?"success":"error")}catch(o){c.error(o)}},async exportConfiguration(){try{const o=await r.exportConfig();this.showSnackbar(o.message,o.success?"success":"error"),o.success&&this.app.exportConfiguration(o.data,"nodes","json")}catch(o){c.error(o)}},exportDump(){this.app.exportConfiguration(this.nodes,"nodes_dump","json")},toggleControllerStatistics(){this.showControllerStatistics=!this.showControllerStatistics}},mounted(){this.bindEvent("rebuildRoutesProgress",this.setRebuildRoutesProgress.bind(this))},beforeDestroy(){this.socket&&this.unbindEvents()}};var w=function(){var e=this,t=e._self._c;return t("div",[t("v-container",{staticClass:"pa-4",attrs:{fluid:""}},[t("v-row",{staticClass:"py-4 align-center",attrs:{"no-gutters":""}},[t("v-col",{class:e.compact?"text-center":"text-end"},[t("v-item-group",{staticClass:"v-btn-toggle"},[t("v-btn",{attrs:{color:"primary",outlined:""},on:{click:e.toggleControllerStatistics}},[t("v-icon",{attrs:{left:""}},[e._v(" "+e._s(e.statisticsOpeningIndicator)+" ")]),e._v(" Controller statistics "),t("v-icon",{attrs:{color:"primary",right:""}},[e._v(" multiline_chart ")])],1),e.$vuetify.breakpoint.mdAndUp?t("v-btn",{attrs:{color:"primary",outlined:!e.compactMode},on:{click:function(n){n.stopPropagation(),e.compactMode=!e.compactMode}}},[e._v(" Compact ")]):e._e()],1)],1)],1),t("v-expand-transition",[t("v-row",{directives:[{name:"show",rawName:"v-show",value:e.showControllerStatistics,expression:"showControllerStatistics"}]},[t("v-col",{staticClass:"mb-8"},[t("v-sheet",{attrs:{outlined:"",rounded:""}},[e.controllerNode?t("StatisticsCard",{attrs:{title:"Controller Statistics",node:this.controllerNode}}):e._e()],1)],1)],1)],1),e.compact?t("smart-view",{attrs:{socket:e.socket},on:{selected:function(n){e.selected=n},action:e.sendAction}}):t("nodes-table",{staticClass:"pb-8",attrs:{socket:e.socket},on:{action:e.sendAction,selected:function(n){e.selected=n}}})],1),t("DialogAdvanced",{attrs:{actions:e.actions,title:e.advancedDialogTitle},on:{close:function(n){e.advancedShowDialog=!1},action:e.onAction},model:{value:e.advancedShowDialog,callback:function(n){e.advancedShowDialog=n},expression:"advancedShowDialog"}}),t("v-speed-dial",{attrs:{bottom:"",fab:"",right:"",fixed:""},scopedSlots:e._u([{key:"activator",fn:function(){return[t("v-btn",{attrs:{color:e.selected.length===0?"blue darken-2":"success",dark:"",fab:"",hover:""},model:{value:e.fab,callback:function(n){e.fab=n},expression:"fab"}},[e.fab?t("v-icon",[e._v("close")]):t("v-icon",[e._v("menu")])],1)]},proxy:!0}]),model:{value:e.fab,callback:function(n){e.fab=n},expression:"fab"}},[t("v-tooltip",{attrs:{left:""},scopedSlots:e._u([{key:"activator",fn:function({on:n,attrs:i}){return[e.selected.length===0?t("v-btn",e._g(e._b({attrs:{fab:"",dark:"",small:"",color:"green"},on:{click:function(l){return e.showNodesManager()}}},"v-btn",i,!1),n),[t("v-icon",[e._v("all_inclusive")])],1):e._e()]}}])},[t("span",[e._v("Manage nodes")])]),t("v-tooltip",{attrs:{left:""},scopedSlots:e._u([{key:"activator",fn:function({on:n,attrs:i}){return[t("v-btn",e._g(e._b({attrs:{fab:"",dark:"",small:"",color:"purple"},on:{click:function(l){e.advancedShowDialog=!0}}},"v-btn",i,!1),n),[t("v-icon",[e._v("auto_fix_high")])],1)]}}])},[t("span",[e._v("Advanced actions")])])],1)],1)},_=[],b=g(v,w,_,!1,null,null);const y=b.exports;export{y as default};