From 3c13e30f362f34db4c1cd4ef39117329309630d5 Mon Sep 17 00:00:00 2001 From: jemu75 Date: Sun, 25 Apr 2021 23:06:23 +0200 Subject: [PATCH] v3.13.5 --- package.json | 2 +- src/plugins/fhem.js | 34 ++++++++++++++++++++++------------ www/fhemapp/index.html | 2 +- www/fhemapp/js/app.561e4ccc.js | 1 - www/fhemapp/js/app.c5a09590.js | 1 + 5 files changed, 25 insertions(+), 15 deletions(-) delete mode 100644 www/fhemapp/js/app.561e4ccc.js create mode 100644 www/fhemapp/js/app.c5a09590.js diff --git a/package.json b/package.json index 2c17639a..be85375e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fhemapp", - "version": "3.13.4", + "version": "3.13.5", "private": true, "author": "jemu75", "scripts": { diff --git a/src/plugins/fhem.js b/src/plugins/fhem.js index 48791fc1..19dc2a51 100644 --- a/src/plugins/fhem.js +++ b/src/plugins/fhem.js @@ -63,7 +63,8 @@ class Fhem extends EventEmitter { deviceList: [], routeList: [], header: '' - } + }, + hasConnected: [] } } @@ -288,23 +289,31 @@ class Fhem extends EventEmitter { // subFunction: for getDevices return the connected devices from fhem server async createConnected(obj) { let result = {}; + let idx = this.app.hasConnected.indexOf(obj.Name); + + if(idx == -1) { + this.app.hasConnected.push(obj.Name); - if('connected' in obj.Options) { - let deviceList = Object.keys(obj.Options.connected); + if('connected' in obj.Options) { + let deviceList = Object.keys(obj.Options.connected); - for (const item of deviceList) { - let device = await this.request({ param: 'cmd', value: 'jsonlist2 ' + obj.Options.connected[item] }, 'json'); + for (const item of deviceList) { + let device = await this.request({ param: 'cmd', value: 'jsonlist2 ' + obj.Options.connected[item] }, 'json'); - if(device && device.Results.length == 1) { - if('PossibleSets' in device.Results[0]) delete device.Results[0].PossibleSets; - if('PossibleAttrs' in device.Results[0]) delete device.Results[0].PossibleAttrs; + if(device && device.Results.length == 1) { + if('PossibleSets' in device.Results[0]) delete device.Results[0].PossibleSets; + if('PossibleAttrs' in device.Results[0]) delete device.Results[0].PossibleAttrs; - let options = await this.createOptions(device.Results[0]); - if(options) device.Results[0].Options = options; + let options = await this.createOptions(device.Results[0]); + if(options) device.Results[0].Options = options; + if(options && device.Results[0].Options.connected) device.Results[0].Connected = await this.createConnected(device.Results[0]); - result[item] = device.Results[0]; + result[item] = device.Results[0]; + } } } + } else { + this.log({ lvl: 1, msg: 'FHEM Device ' + obj.Name + ' is defined as connected device, witch is called from himself. ', meta: obj }); } return result; @@ -343,6 +352,7 @@ class Fhem extends EventEmitter { let idx = this.app.data.routeList.map((e) => e.route).indexOf(fltr); this.app.data.deviceList.splice(0); + this.app.hasConnected = []; if(idx != -1 || fltr.match('device=')) { let filter = idx != -1 ? this.app.data.routeList[idx].deviceList.join(',') : fltr.replace('device=','').split('&')[0]; @@ -627,7 +637,7 @@ class Fhem extends EventEmitter { this.log({ lvl: 2, msg: 'Connection with FHEM is opened.', meta: this.app.connection }) this.app.session.csrf = await this.request({}, 'csrf'); - this.log(this.app.session.csrf ? { lvl: 2, msg: 'Crsf-Token received.' } : { lvl: 1, msg: 'No Crsf-Token received.' }); + this.log({ lvl: 2, msg: 'Crsf-Token received.', meta: { token: this.app.session.csrf } }); this.loadStructure(); } diff --git a/www/fhemapp/index.html b/www/fhemapp/index.html index 3e796aec..cb35c507 100644 --- a/www/fhemapp/index.html +++ b/www/fhemapp/index.html @@ -1 +1 @@ -fhemapp
\ No newline at end of file +fhemapp
\ No newline at end of file diff --git a/www/fhemapp/js/app.561e4ccc.js b/www/fhemapp/js/app.561e4ccc.js deleted file mode 100644 index e4695518..00000000 --- a/www/fhemapp/js/app.561e4ccc.js +++ /dev/null @@ -1 +0,0 @@ -(function(e){function t(t){for(var n,r,o=t[0],c=t[1],p=t[2],u=0,l=[];u0?(this.type=this.types[this.msgList[0].lvl],this.message=this.msgList[0].msg,this.meta=this.msgList[0].meta,this.alert=!0):(this.alert=!1,this.type="info",this.message="",this.meta="")}},mounted:function(){var e=this;this.$fhem.on("message",(function(t){var a={lvl:5,msg:"no valid message received",meta:""};Object.assign(a,t),e.msgList.unshift(a)}))},methods:{clearMessage:function(){this.msgList.length>0&&this.msgList.splice(0,1)}}}),p=c,u=a("2877"),l=a("6544"),h=a.n(l),d=a("0798"),m=a("8336"),f=a("62ad"),v=a("132d"),g=a("0fd9"),b=Object(u["a"])(p,i,o,!1,null,null,null),k=b.exports;h()(b,{VAlert:d["a"],VBtn:m["a"],VCol:f["a"],VIcon:v["a"],VRow:g["a"]});var y={components:{Broadcaster:k},data:function(){return{appBar:{color:"",drawer:null,clock:null,header:null},app:{options:{loading:!1,reloadBtn:!1},session:{connect:!1},data:{roomList:[],groupList:[]}},version:"v"+a("9224").version,status:{color:"secondary",icon:"mdi-circle",text:"unbekannt",time:""}}},computed:{showRooms:function(){return this.app.data.roomList.length>0},showGroups:function(){return this.app.data.groupList.length>0}},watch:{"app.session.connect":function(e){this.status.color=e?"success":"error",this.status.text=e?"online":"offline",this.status.time=this.$fhem.getDateTime()}},mounted:function(){this.app.session=this.$fhem.app.session,this.app.options=this.$fhem.app.options,this.app.data=this.$fhem.app.data,this.appBar=this.$fhem.app.appBar},methods:{reload:function(){location.reload(!0)},goTo:function(e){var t=e||"/";this.$router.currentRoute.path!=t&&this.$router.push(t)}}},w=y,x=a("7496"),O=a("40dc"),j=a("5bc1"),_=a("cc20"),R=a("a523"),L=a("ce7e"),C=a("adda"),S=a("8860"),P=a("56b0"),B=a("da13"),E=a("5d23"),D=a("34c3"),A=a("f6c4"),N=a("f774"),V=a("a797"),F=a("490a"),T=a("2fa4"),M=a("3a2f"),H=Object(u["a"])(w,r,s,!1,null,null,null),I=H.exports;h()(H,{VApp:x["a"],VAppBar:O["a"],VAppBarNavIcon:j["a"],VBtn:m["a"],VChip:_["a"],VContainer:R["a"],VDivider:L["a"],VIcon:v["a"],VImg:C["a"],VList:S["a"],VListGroup:P["a"],VListItem:B["a"],VListItemContent:E["a"],VListItemIcon:D["a"],VListItemSubtitle:E["b"],VListItemTitle:E["c"],VMain:A["a"],VNavigationDrawer:N["a"],VOverlay:V["a"],VProgressCircular:F["a"],VSpacer:T["a"],VTooltip:M["a"]});a("d3b7"),a("3ca3"),a("ddb0");var $=a("8c4f");n["a"].use($["a"]);var U=[{path:"/",name:"Home",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/system",name:"System",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/dashboard",name:"Dashboard",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/devices/:filter",name:"Devices",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/edit-devices",name:"EditDevice",component:function(){return Promise.all([a.e("chunk-28a3f15f"),a.e("chunk-07709945"),a.e("chunk-72c6e8d8"),a.e("chunk-085bcd30")]).then(a.bind(null,"f87a"))}},{path:"/syslog",name:"Syslog",component:function(){return Promise.all([a.e("chunk-28a3f15f"),a.e("chunk-ecd3142c"),a.e("chunk-07709945"),a.e("chunk-72c6e8d8"),a.e("chunk-21b07e80")]).then(a.bind(null,"beee"))}}],J=new $["a"]({mode:"hash",base:"",routes:U}),q=J,z=a("f309"),G=a("0fe0"),X=a.n(G),W=a("fcf4");n["a"].use(z["a"]);var K={lang:{locales:{de:X.a},current:"de"},theme:{dark:!0,themes:{dark:{primary:W["a"].grey.darken4,secondary:W["a"].grey.darken3,success:W["a"].green.accent2,accent:W["a"].green.accent2},light:{primary:W["a"].grey,secondary:W["a"].grey.lighten3,success:W["a"].green.accent3,accent:W["a"].green.accent3}}}},Z=new z["a"](K),Q=a("1321"),Y=a.n(Q),ee=(a("159b"),a("466d"),a("ac1f"),a("a925"));function te(){var e=a("49f8"),t={};return e.keys().forEach((function(a){var n=a.match(/([A-Za-z0-9-_]+)\./i);if(n&&n.length>1){var r=n[1];t[r]=e(a)}})),t}n["a"].use(ee["a"]);var ae=new ee["a"]({locale:"de",fallbackLocale:"en",messages:te()}),ne=a("b85c"),re=a("2909"),se=a("1da1"),ie=a("53ca"),oe=a("d4ec"),ce=a("bee2"),pe=a("262e"),ue=a("2caf"),le=(a("96cf"),a("fb6a"),a("1276"),a("5319"),a("13d5"),a("b64b"),a("b0c0"),a("d81d"),a("a15b"),a("b680"),a("25f0"),a("99af"),a("4d63"),a("07ac"),a("faa1")),he=a.n(le),de=function(e){Object(pe["a"])(a,e);var t=Object(ue["a"])(a);function a(){var e;return Object(oe["a"])(this,a),e=t.call(this),e.app={connection:{location:window.location.protocol+"//"+window.location.hostname,port:window.location.port,path:"fhem"},socket:null,session:{connect:!1,ready:!1,csrf:null,restart:!1,restartCnt:0,logList:[]},options:{lang:"de",debugMode:!1,debugLevel:5,loading:!1,loadCount:0,clockInterval:5e3,clock:null,date:null,maxChartPoints:100,updateProcess:!1,logRecord:!0,logBuffer:500,ignoreFhemRoom:!1,ignoreFhemGroup:!1,ignoreFhemSortby:!1,mobileHeader:!1},theme:{dark:!0,themes:{}},appBar:{color:"primary",drawer:!1,clock:null,header:null},templates:[],componentMap:[{name:"panel",component:"templ_panel"},{name:"chart",component:"templ_chart"},{name:"weather",component:"templ_weather"},{name:"sysmon",component:"templ_sysmon"},{name:"hmlan",component:"templ_hmlan"},{name:"sonos",component:"templ_sonos"},{name:"scenes",component:"templ_scenes"}],data:{roomList:[],groupList:[],deviceList:[],routeList:[],header:""}},e}return Object(ce["a"])(a,[{key:"loading",set:function(e){e&&this.app.options.loadCount++,!e&&this.app.options.loadCount>0&&this.app.options.loadCount--,this.app.options.loadCount>0&&!this.app.options.loading&&(this.app.options.loading=!0),0===this.app.options.loadCount&&(this.app.options.loading=!1)}},{key:"log",value:function(e){var t=["","mdi-alert-outline","mdi-connection","mdi-send-circle-outline","mdi-sync","mdi-hexagon-multiple-outline"],a=["","error","info","success","success","warning"],n=(new Date).toLocaleTimeString(this.app.options.lang),r=(new Date).getMilliseconds(),s={time:n+":"+("000"+r).slice(-3),msg:e.msg||"",lvl:e.lvl||5,meta:e.meta||null,icon:t[e.lvl||5],color:a[e.lvl||5]};this.app.options.logRecord&&s.lvl<=this.app.options.debugLevel&&(this.app.session.logList.unshift(s),this.app.session.logList.length>this.app.options.logBuffer&&(this.app.session.logList.length=this.app.options.logBuffer)),1==s.lvl&&this.emit("message",s)}},{key:"getDate",value:function(e){var t=e?parseInt(e):0;return function(e){return new Date(e.setDate(e.getDate()-t)).toISOString()}(new Date).split("T")[0]}},{key:"getDateTime",value:function(e){var t=e||(new Date).toISOString();return new Date(t.replace(" ","T")).toLocaleString(this.app.options.lang,{dateStyle:"short",timeStyle:"medium"}).replace(",","")}},{key:"createURL",value:function(e){var t=this.app.connection,a=t.location?t.location:"",n=t.port?":"+t.port.replace(":",""):"",r=t.path?"/"+t.path.replace("/",""):"",s="";return"object"==Object(ie["a"])(e)&&e.length>0&&e.forEach((function(e){e.param&&e.value&&(s+=s?"&":"?",s+=e.param+"="+encodeURIComponent(e.value))})),a+n+r+s}},{key:"getEl",value:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n0?r.push.apply(r,Object(re["a"])(t)):r.push(t)),"string"===typeof t&&r.push({param:"cmd",value:t}),s=this.createURL(r),this.log({lvl:3,msg:"Request: "+s}),e.next=9,fetch(s).then((function(e){var t=null;return"csrf"===a&&(t=e.headers.get("x-fhem-csrftoken")),"json"===a&&(t=e.json()),t||(t=e.text()),"object"===Object(ie["a"])(n)?Object.assign(n,{data:t}):t})).catch((function(e){return i.log({lvl:1,msg:"Request failed "+s,meta:e.message})}));case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})));function t(t,a,n){return e.apply(this,arguments)}return t}()},{key:"getJsonFile",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=new Headers,a.append("pragma","no-cache"),a.append("cache-control","no-cache"),n={method:"GET",headers:a},e.next=6,fetch(t,n).then((function(e){return e.json()}));case 6:return r=e.sent,r&&this.log({lvl:5,msg:"Json-Data parsed from "+t,meta:r}),r||this.log({lvl:1,msg:"No Json-Data found at "+t}),e.next=11,r;case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"readConfig",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r,s;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.getJsonFile(t);case 2:if(a=e.sent,a){for(n=0,r=Object.keys(a);n0)){e.next=41;break}a=[],n=[],this.app.data.routeList.splice(0),r=Object(ne["a"])(t.Results),e.prev=8,r.s();case 10:if((s=r.n()).done){e.next=27;break}return i=s.value,e.next=14,this.createOptions(i);case 14:if(o=e.sent,!o.template){e.next=25;break}return e.next=18,this.getTemplate(o);case 18:c=e.sent,c&&this.app.templates.push(c),o.room&&this.createNaviItems(o,a,"room"),o.group&&this.createNaviItems(o,n,"group"),o.home&&this.createRoutes(o,"/"),o.dashboard&&this.createRoutes(o,"/dashboard"),o.system&&this.createRoutes(o,"/system");case 25:e.next=10;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e["catch"](8),r.e(e.t0);case 32:return e.prev=32,r.f(),e.finish(32);case 35:a.sort((function(e,t){return e.title>t.title?1:t.title>e.title?-1:0})),n.sort((function(e,t){return e.title>t.title?1:t.title>e.title?-1:0})),this.app.data.roomList=Object.assign([],a),this.app.data.groupList=Object.assign([],n),this.app.session.ready=!0,this.loading=!1;case 41:case"end":return e.stop()}}),e,this,[[8,29,32,35]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"createConnected",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r,s,i,o,c;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(a={},!("connected"in t.Options)){e.next=20;break}n=Object.keys(t.Options.connected),r=0,s=n;case 4:if(!(rt.Options.sortby?1:t.Options.sortby>e.Options.sortby?-1:0})),this.app.data.deviceList=Object.assign([],s),this.loading=!1),i++;case 37:e.next=14;break;case 39:e.next=44;break;case 41:e.prev=41,e.t0=e["catch"](12),o.e(e.t0);case 44:return e.prev=44,o.f(),e.finish(44);case 47:case"end":return e.stop()}}),e,this,[[12,41,44,47]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"checkUpdate",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(){var t,a,n,r,s,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.request([{param:"cmd",value:"update check"},{param:"XHR",value:"1"}]);case 2:if(t=e.sent,a=0,t){n=t.split("\n").splice(2),r=Object(ne["a"])(n);try{for(r.s();!(s=r.n()).done;)i=s.value,i.match("UPD")&&!i.match("excluded")&&a++}catch(o){r.e(o)}finally{r.f()}}return e.abrupt("return",a>0);case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"handleLogData",value:function(e){var t=e.split("\n");t.length>3&&t.splice(-3,3);var a,n=[],r=t.length>this.app.options.maxChartPoints?parseInt(t.length/this.app.options.maxChartPoints):1,s=r,i=0,o=1,c=Object(ne["a"])(t);try{for(c.s();!(a=c.n()).done;){var p=a.value,u=p.split(" "),l=Date.parse(u[0].replace("_","T")),h=parseFloat(u[1]);i+=h,(o>=s||o===t.length)&&(o===t.length&&(r-=s-o),n.push({timestamp:l,value:i/r}),s+=r,i=0),o++}}catch(d){c.e(d)}finally{c.f()}return this.log({lvl:5,msg:"handle Chartdata (Lines: "+t.length+")"}),n}},{key:"readLogData",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r,s,i,o,c,p,u;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(a=[],this.loading=!0,!(t.defs&&t.defs.length>0)){e.next=40;break}n=0,r=Object(ne["a"])(t.defs),e.prev=5,r.s();case 7:if((s=r.n()).done){e.next=32;break}return i=s.value,o=/\(.*\)/.exec(i),c=o?i.replace(o[0],"_").split(":"):i.split(":"),p="get ",p+=c[0]?c[0]:t.deviceName,p+=t.from?" - - "+t.from:"",p+=t.to?" "+t.to:"",p+=o?" "+o[0].replace(/\(|\)/g,""):" 4:"+c[1],e.next=18,this.request([{param:"cmd",value:p},{param:"XHR",value:"1"}],"text",{id:n});case 18:if(u=e.sent,!u){e.next=29;break}return e.t0=a,e.t1=u.id,e.t2=this,e.next=25,u.data;case 25:e.t3=e.sent,e.t4=e.t2.handleLogData.call(e.t2,e.t3),e.t5={id:e.t1,data:e.t4},e.t0.push.call(e.t0,e.t5);case 29:n++;case 30:e.next=7;break;case 32:e.next=37;break;case 34:e.prev=34,e.t6=e["catch"](5),r.e(e.t6);case 37:return e.prev=37,r.f(),e.finish(37);case 40:return this.loading=!1,e.abrupt("return",Object.assign(t,{data:a}));case 42:case"end":return e.stop()}}),e,this,[[5,34,37,40]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"replaceVals",value:function(e,t){for(var a=/-?[0-9]/.exec(t),n=[],r=2;r0){var n,r=Object(ne["a"])(t);try{for(r.s();!(n=r.n()).done;){var s=n.value,i=s.split(":");if(i.length>2){var o=i[0].match(/\./)?i[0].split("."):["Readings",i[0],"Value"],c=this.getEl.apply(this,[e].concat(Object(re["a"])(o)))||this.getEl(e,"Readings",i[0],"Value");if(c){var p=!1;if(isNaN(parseFloat(i[1])))RegExp(i[1]?i[1]:".").test(c)&&(p=!0);else{var u=/-?[0-9]/.exec(c);-1!=u.index&&parseFloat(c.slice(u.index))>=parseFloat(i[1])&&(p=!0)}if(p){a=this.replaceVals(i,c);break}}}}}catch(l){r.e(l)}finally{r.f()}}return a}},{key:"handleData",value:function(e){var t=JSON.parse(e),a=null;if(!t[2].match("0){var s=this.handleData(r);if(s){var i,o=0,c=Object(ne["a"])(this.app.data.deviceList);try{for(c.s();!(i=c.n()).done;){var p=i.value,u=this.app.data.deviceList[o],l=Object.assign({},u);if(p.Name===s.Name&&("Readings"===s.devicePart&&this.getEl(l,"Readings",s.param,s.paramPart)&&(l.Readings[s.param][s.paramPart]=s.value),"Attributes"===s.devicePart&&this.getEl(l,"Attributes",s.param)&&(l.Attributes[s.param]=s.value),this.app.data.deviceList.splice(o,1,l)),"Connected"in p)for(var h=0,d=0,m=Object.values(p.Connected);d0?(this.type=this.types[this.msgList[0].lvl],this.message=this.msgList[0].msg,this.meta=this.msgList[0].meta,this.alert=!0):(this.alert=!1,this.type="info",this.message="",this.meta="")}},mounted:function(){var e=this;this.$fhem.on("message",(function(t){var a={lvl:5,msg:"no valid message received",meta:""};Object.assign(a,t),e.msgList.unshift(a)}))},methods:{clearMessage:function(){this.msgList.length>0&&this.msgList.splice(0,1)}}}),p=c,u=a("2877"),l=a("6544"),h=a.n(l),d=a("0798"),m=a("8336"),f=a("62ad"),v=a("132d"),g=a("0fd9"),b=Object(u["a"])(p,i,o,!1,null,null,null),k=b.exports;h()(b,{VAlert:d["a"],VBtn:m["a"],VCol:f["a"],VIcon:v["a"],VRow:g["a"]});var y={components:{Broadcaster:k},data:function(){return{appBar:{color:"",drawer:null,clock:null,header:null},app:{options:{loading:!1,reloadBtn:!1},session:{connect:!1},data:{roomList:[],groupList:[]}},version:"v"+a("9224").version,status:{color:"secondary",icon:"mdi-circle",text:"unbekannt",time:""}}},computed:{showRooms:function(){return this.app.data.roomList.length>0},showGroups:function(){return this.app.data.groupList.length>0}},watch:{"app.session.connect":function(e){this.status.color=e?"success":"error",this.status.text=e?"online":"offline",this.status.time=this.$fhem.getDateTime()}},mounted:function(){this.app.session=this.$fhem.app.session,this.app.options=this.$fhem.app.options,this.app.data=this.$fhem.app.data,this.appBar=this.$fhem.app.appBar},methods:{reload:function(){location.reload(!0)},goTo:function(e){var t=e||"/";this.$router.currentRoute.path!=t&&this.$router.push(t)}}},w=y,x=a("7496"),O=a("40dc"),j=a("5bc1"),_=a("cc20"),R=a("a523"),C=a("ce7e"),L=a("adda"),S=a("8860"),P=a("56b0"),B=a("da13"),E=a("5d23"),D=a("34c3"),N=a("f6c4"),A=a("f774"),F=a("a797"),V=a("490a"),T=a("2fa4"),M=a("3a2f"),H=Object(u["a"])(w,r,s,!1,null,null,null),I=H.exports;h()(H,{VApp:x["a"],VAppBar:O["a"],VAppBarNavIcon:j["a"],VBtn:m["a"],VChip:_["a"],VContainer:R["a"],VDivider:C["a"],VIcon:v["a"],VImg:L["a"],VList:S["a"],VListGroup:P["a"],VListItem:B["a"],VListItemContent:E["a"],VListItemIcon:D["a"],VListItemSubtitle:E["b"],VListItemTitle:E["c"],VMain:N["a"],VNavigationDrawer:A["a"],VOverlay:F["a"],VProgressCircular:V["a"],VSpacer:T["a"],VTooltip:M["a"]});a("d3b7"),a("3ca3"),a("ddb0");var $=a("8c4f");n["a"].use($["a"]);var U=[{path:"/",name:"Home",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/system",name:"System",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/dashboard",name:"Dashboard",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/devices/:filter",name:"Devices",component:function(){return a.e("chunk-2d212bf1").then(a.bind(null,"aa72"))}},{path:"/edit-devices",name:"EditDevice",component:function(){return Promise.all([a.e("chunk-28a3f15f"),a.e("chunk-07709945"),a.e("chunk-72c6e8d8"),a.e("chunk-085bcd30")]).then(a.bind(null,"f87a"))}},{path:"/syslog",name:"Syslog",component:function(){return Promise.all([a.e("chunk-28a3f15f"),a.e("chunk-ecd3142c"),a.e("chunk-07709945"),a.e("chunk-72c6e8d8"),a.e("chunk-21b07e80")]).then(a.bind(null,"beee"))}}],J=new $["a"]({mode:"hash",base:"",routes:U}),q=J,z=a("f309"),G=a("0fe0"),X=a.n(G),W=a("fcf4");n["a"].use(z["a"]);var K={lang:{locales:{de:X.a},current:"de"},theme:{dark:!0,themes:{dark:{primary:W["a"].grey.darken4,secondary:W["a"].grey.darken3,success:W["a"].green.accent2,accent:W["a"].green.accent2},light:{primary:W["a"].grey,secondary:W["a"].grey.lighten3,success:W["a"].green.accent3,accent:W["a"].green.accent3}}}},Z=new z["a"](K),Q=a("1321"),Y=a.n(Q),ee=(a("159b"),a("466d"),a("ac1f"),a("a925"));function te(){var e=a("49f8"),t={};return e.keys().forEach((function(a){var n=a.match(/([A-Za-z0-9-_]+)\./i);if(n&&n.length>1){var r=n[1];t[r]=e(a)}})),t}n["a"].use(ee["a"]);var ae=new ee["a"]({locale:"de",fallbackLocale:"en",messages:te()}),ne=a("b85c"),re=a("2909"),se=a("1da1"),ie=a("53ca"),oe=a("d4ec"),ce=a("bee2"),pe=a("262e"),ue=a("2caf"),le=(a("96cf"),a("fb6a"),a("1276"),a("5319"),a("13d5"),a("b64b"),a("b0c0"),a("d81d"),a("a15b"),a("b680"),a("25f0"),a("99af"),a("4d63"),a("07ac"),a("faa1")),he=a.n(le),de=function(e){Object(pe["a"])(a,e);var t=Object(ue["a"])(a);function a(){var e;return Object(oe["a"])(this,a),e=t.call(this),e.app={connection:{location:window.location.protocol+"//"+window.location.hostname,port:window.location.port,path:"fhem"},socket:null,session:{connect:!1,ready:!1,csrf:null,restart:!1,restartCnt:0,logList:[]},options:{lang:"de",debugMode:!1,debugLevel:5,loading:!1,loadCount:0,clockInterval:5e3,clock:null,date:null,maxChartPoints:100,updateProcess:!1,logRecord:!0,logBuffer:500,ignoreFhemRoom:!1,ignoreFhemGroup:!1,ignoreFhemSortby:!1,mobileHeader:!1},theme:{dark:!0,themes:{}},appBar:{color:"primary",drawer:!1,clock:null,header:null},templates:[],componentMap:[{name:"panel",component:"templ_panel"},{name:"chart",component:"templ_chart"},{name:"weather",component:"templ_weather"},{name:"sysmon",component:"templ_sysmon"},{name:"hmlan",component:"templ_hmlan"},{name:"sonos",component:"templ_sonos"},{name:"scenes",component:"templ_scenes"}],data:{roomList:[],groupList:[],deviceList:[],routeList:[],header:""},hasConnected:[]},e}return Object(ce["a"])(a,[{key:"loading",set:function(e){e&&this.app.options.loadCount++,!e&&this.app.options.loadCount>0&&this.app.options.loadCount--,this.app.options.loadCount>0&&!this.app.options.loading&&(this.app.options.loading=!0),0===this.app.options.loadCount&&(this.app.options.loading=!1)}},{key:"log",value:function(e){var t=["","mdi-alert-outline","mdi-connection","mdi-send-circle-outline","mdi-sync","mdi-hexagon-multiple-outline"],a=["","error","info","success","success","warning"],n=(new Date).toLocaleTimeString(this.app.options.lang),r=(new Date).getMilliseconds(),s={time:n+":"+("000"+r).slice(-3),msg:e.msg||"",lvl:e.lvl||5,meta:e.meta||null,icon:t[e.lvl||5],color:a[e.lvl||5]};this.app.options.logRecord&&s.lvl<=this.app.options.debugLevel&&(this.app.session.logList.unshift(s),this.app.session.logList.length>this.app.options.logBuffer&&(this.app.session.logList.length=this.app.options.logBuffer)),1==s.lvl&&this.emit("message",s)}},{key:"getDate",value:function(e){var t=e?parseInt(e):0;return function(e){return new Date(e.setDate(e.getDate()-t)).toISOString()}(new Date).split("T")[0]}},{key:"getDateTime",value:function(e){var t=e||(new Date).toISOString();return new Date(t.replace(" ","T")).toLocaleString(this.app.options.lang,{dateStyle:"short",timeStyle:"medium"}).replace(",","")}},{key:"createURL",value:function(e){var t=this.app.connection,a=t.location?t.location:"",n=t.port?":"+t.port.replace(":",""):"",r=t.path?"/"+t.path.replace("/",""):"",s="";return"object"==Object(ie["a"])(e)&&e.length>0&&e.forEach((function(e){e.param&&e.value&&(s+=s?"&":"?",s+=e.param+"="+encodeURIComponent(e.value))})),a+n+r+s}},{key:"getEl",value:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n0?r.push.apply(r,Object(re["a"])(t)):r.push(t)),"string"===typeof t&&r.push({param:"cmd",value:t}),s=this.createURL(r),this.log({lvl:3,msg:"Request: "+s}),e.next=9,fetch(s).then((function(e){var t=null;return"csrf"===a&&(t=e.headers.get("x-fhem-csrftoken")),"json"===a&&(t=e.json()),t||(t=e.text()),"object"===Object(ie["a"])(n)?Object.assign(n,{data:t}):t})).catch((function(e){return i.log({lvl:1,msg:"Request failed "+s,meta:e.message})}));case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})));function t(t,a,n){return e.apply(this,arguments)}return t}()},{key:"getJsonFile",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=new Headers,a.append("pragma","no-cache"),a.append("cache-control","no-cache"),n={method:"GET",headers:a},e.next=6,fetch(t,n).then((function(e){return e.json()}));case 6:return r=e.sent,r&&this.log({lvl:5,msg:"Json-Data parsed from "+t,meta:r}),r||this.log({lvl:1,msg:"No Json-Data found at "+t}),e.next=11,r;case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"readConfig",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r,s;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.getJsonFile(t);case 2:if(a=e.sent,a){for(n=0,r=Object.keys(a);n0)){e.next=41;break}a=[],n=[],this.app.data.routeList.splice(0),r=Object(ne["a"])(t.Results),e.prev=8,r.s();case 10:if((s=r.n()).done){e.next=27;break}return i=s.value,e.next=14,this.createOptions(i);case 14:if(o=e.sent,!o.template){e.next=25;break}return e.next=18,this.getTemplate(o);case 18:c=e.sent,c&&this.app.templates.push(c),o.room&&this.createNaviItems(o,a,"room"),o.group&&this.createNaviItems(o,n,"group"),o.home&&this.createRoutes(o,"/"),o.dashboard&&this.createRoutes(o,"/dashboard"),o.system&&this.createRoutes(o,"/system");case 25:e.next=10;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e["catch"](8),r.e(e.t0);case 32:return e.prev=32,r.f(),e.finish(32);case 35:a.sort((function(e,t){return e.title>t.title?1:t.title>e.title?-1:0})),n.sort((function(e,t){return e.title>t.title?1:t.title>e.title?-1:0})),this.app.data.roomList=Object.assign([],a),this.app.data.groupList=Object.assign([],n),this.app.session.ready=!0,this.loading=!1;case 41:case"end":return e.stop()}}),e,this,[[8,29,32,35]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"createConnected",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r,s,i,o,c,p;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(a={},n=this.app.hasConnected.indexOf(t.Name),-1!=n){e.next=29;break}if(this.app.hasConnected.push(t.Name),!("connected"in t.Options)){e.next=27;break}r=Object.keys(t.Options.connected),s=0,i=r;case 7:if(!(st.Options.sortby?1:t.Options.sortby>e.Options.sortby?-1:0})),this.app.data.deviceList=Object.assign([],s),this.loading=!1),i++;case 38:e.next=15;break;case 40:e.next=45;break;case 42:e.prev=42,e.t0=e["catch"](13),o.e(e.t0);case 45:return e.prev=45,o.f(),e.finish(45);case 48:case"end":return e.stop()}}),e,this,[[13,42,45,48]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"checkUpdate",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(){var t,a,n,r,s,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.request([{param:"cmd",value:"update check"},{param:"XHR",value:"1"}]);case 2:if(t=e.sent,a=0,t){n=t.split("\n").splice(2),r=Object(ne["a"])(n);try{for(r.s();!(s=r.n()).done;)i=s.value,i.match("UPD")&&!i.match("excluded")&&a++}catch(o){r.e(o)}finally{r.f()}}return e.abrupt("return",a>0);case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"handleLogData",value:function(e){var t=e.split("\n");t.length>3&&t.splice(-3,3);var a,n=[],r=t.length>this.app.options.maxChartPoints?parseInt(t.length/this.app.options.maxChartPoints):1,s=r,i=0,o=1,c=Object(ne["a"])(t);try{for(c.s();!(a=c.n()).done;){var p=a.value,u=p.split(" "),l=Date.parse(u[0].replace("_","T")),h=parseFloat(u[1]);i+=h,(o>=s||o===t.length)&&(o===t.length&&(r-=s-o),n.push({timestamp:l,value:i/r}),s+=r,i=0),o++}}catch(d){c.e(d)}finally{c.f()}return this.log({lvl:5,msg:"handle Chartdata (Lines: "+t.length+")"}),n}},{key:"readLogData",value:function(){var e=Object(se["a"])(regeneratorRuntime.mark((function e(t){var a,n,r,s,i,o,c,p,u;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(a=[],this.loading=!0,!(t.defs&&t.defs.length>0)){e.next=40;break}n=0,r=Object(ne["a"])(t.defs),e.prev=5,r.s();case 7:if((s=r.n()).done){e.next=32;break}return i=s.value,o=/\(.*\)/.exec(i),c=o?i.replace(o[0],"_").split(":"):i.split(":"),p="get ",p+=c[0]?c[0]:t.deviceName,p+=t.from?" - - "+t.from:"",p+=t.to?" "+t.to:"",p+=o?" "+o[0].replace(/\(|\)/g,""):" 4:"+c[1],e.next=18,this.request([{param:"cmd",value:p},{param:"XHR",value:"1"}],"text",{id:n});case 18:if(u=e.sent,!u){e.next=29;break}return e.t0=a,e.t1=u.id,e.t2=this,e.next=25,u.data;case 25:e.t3=e.sent,e.t4=e.t2.handleLogData.call(e.t2,e.t3),e.t5={id:e.t1,data:e.t4},e.t0.push.call(e.t0,e.t5);case 29:n++;case 30:e.next=7;break;case 32:e.next=37;break;case 34:e.prev=34,e.t6=e["catch"](5),r.e(e.t6);case 37:return e.prev=37,r.f(),e.finish(37);case 40:return this.loading=!1,e.abrupt("return",Object.assign(t,{data:a}));case 42:case"end":return e.stop()}}),e,this,[[5,34,37,40]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"replaceVals",value:function(e,t){for(var a=/-?[0-9]/.exec(t),n=[],r=2;r0){var n,r=Object(ne["a"])(t);try{for(r.s();!(n=r.n()).done;){var s=n.value,i=s.split(":");if(i.length>2){var o=i[0].match(/\./)?i[0].split("."):["Readings",i[0],"Value"],c=this.getEl.apply(this,[e].concat(Object(re["a"])(o)))||this.getEl(e,"Readings",i[0],"Value");if(c){var p=!1;if(isNaN(parseFloat(i[1])))RegExp(i[1]?i[1]:".").test(c)&&(p=!0);else{var u=/-?[0-9]/.exec(c);-1!=u.index&&parseFloat(c.slice(u.index))>=parseFloat(i[1])&&(p=!0)}if(p){a=this.replaceVals(i,c);break}}}}}catch(l){r.e(l)}finally{r.f()}}return a}},{key:"handleData",value:function(e){var t=JSON.parse(e),a=null;if(!t[2].match("0){var s=this.handleData(r);if(s){var i,o=0,c=Object(ne["a"])(this.app.data.deviceList);try{for(c.s();!(i=c.n()).done;){var p=i.value,u=this.app.data.deviceList[o],l=Object.assign({},u);if(p.Name===s.Name&&("Readings"===s.devicePart&&this.getEl(l,"Readings",s.param,s.paramPart)&&(l.Readings[s.param][s.paramPart]=s.value),"Attributes"===s.devicePart&&this.getEl(l,"Attributes",s.param)&&(l.Attributes[s.param]=s.value),this.app.data.deviceList.splice(o,1,l)),"Connected"in p)for(var h=0,d=0,m=Object.values(p.Connected);d