0){let t=this.handleData(s);if(t){let e=0;for(const s of this.app.data.deviceList){let n=this.app.data.deviceList[e],a=Object.assign({},n);if(s.Name===t.Name&&("Readings"===t.devicePart&&this.getEl(a,"Readings",t.param,t.paramPart)&&(a.Readings[t.param][t.paramPart]=t.value),"Attributes"===t.devicePart&&this.getEl(a,"Attributes",t.param)&&(a.Attributes[t.param]=t.value),this.handleTemplate(a),this.app.data.deviceList.splice(e,1,a),this.app.data.deviceList.sort(((t,e)=>t.Options.sortby>e.Options.sortby?1:e.Options.sortby>t.Options.sortby?-1:0))),"Connected"in s){let n=0;for(const o of Object.values(s.Connected)){if(o.Name===t.Name){let o=Object.keys(s.Connected)[n];"Readings"===t.devicePart&&this.getEl(a.Connected[o],"Readings",t.param,t.paramPart)&&(a.Connected[o].Readings[t.param][t.paramPart]=t.value),"Attributes"===t.devicePart&&this.getEl(a.Connected[o],"Attributes",t.param)&&(a.Connected[o].Attributes[t.param]=t.value),this.handleTemplate(a),this.app.data.deviceList.splice(e,1,a),this.app.data.deviceList.sort(((t,e)=>t.Options.sortby>e.Options.sortby?1:e.Options.sortby>t.Options.sortby?-1:0))}n++}}e++}}}}async connOpen(){this.app.session.connect=!0,this.app.session.restartCnt=0,this.log({lvl:2,msg:"Connection with FHEM is opened.",meta:this.app.connection}),this.app.session.csrf=await this.request({},"csrf"),this.log({lvl:2,msg:"Crsf-Token received.",meta:{token:this.app.session.csrf}}),this.loadStructure()}async connClose(t){if(this.app.session.connect=!1,this.app.session.csrf=null,this.app.session.ready=!1,this.app.conn=null,!this.app.session.restart){let e=0==this.app.session.restartCnt?1:3e3;this.app.session.restart=!0,setTimeout((()=>{this.app.session.restart=!1,this.app.session.restartCnt++,this.connStart()}),e);let s={info:"Connection ("+this.app.connection.type+") "+(t?"failed.":"was closed."),errCode:t||""};this.log({lvl:2,msg:"Connection with FHEM was closed. Try to Reconnect in "+e/1e3+" seconds...",meta:s}),this.loading=!1}}async connStart(){let t=[{param:"inform",value:"type=status;filter=.*;fmt=JSON"},{param:"XHR",value:"1"}],e=this.createURL(t);"websocket"===this.app.connection.type?(this.app.conn=new WebSocket(e.replace(/^http/i,"ws")),this.app.conn.onopen=()=>this.connOpen(),this.app.conn.onmessage=t=>this.doUpdate(t),this.app.conn.onclose=()=>this.connClose(),this.app.conn.onerror=t=>this.connClose(t)):(this.app.conn=new XMLHttpRequest,this.app.conn.open("GET",e,!0),this.app.conn.onreadystatechange=()=>{200===this.app.conn.status&&2===this.app.conn.readyState&&this.connOpen(),200===this.app.conn.status&&3===this.app.conn.readyState&&this.doUpdate()},this.app.conn.onerror=t=>this.connClose(t),this.app.conn.send())}setClock(){let t=new Date;this.app.appBar.clock=t.toLocaleString(this.app.options.lang,this.app.options.clockFormat),this.app.options.mobileHeader||(this.app.appBar.header=t.toLocaleString(this.app.options.lang,{weekday:"long",year:"numeric",month:"long",day:"numeric"}))}async init(t,e){this.log({lvl:2,msg:"Starting FHEMApp..."}),this.loading=!0,await this.readConfig("./cfg/config.json"),this.connStart(),t&&this.app.theme&&(-1!=this.app.theme.dark&&Object.assign(t.framework.theme,{dark:this.app.theme.dark}),this.app.theme.themes.light&&Object.assign(t.framework.theme.themes.light,this.app.theme.themes.light),this.app.theme.themes.dark&&Object.assign(t.framework.theme.themes.dark,this.app.theme.themes.dark)),e&&this.app.options.lang&&(e.locale=this.app.options.lang),this.setClock(),setInterval((()=>this.setClock()),this.app.options.clockInterval)}}var ot={install(t,e,s){t.prototype.$fhem=new at,t.prototype.$fhem.init(e,s)}};n.Z.use(ot,K,et),n.Z.use(Q()),n.Z.component("apex-chart",Q()),n.Z.config.productionTip=!1,new n.Z({vuetify:K,router:q,i18n:et,render:t=>t(M)}).$mount("#app")},8973:function(t,e,s){var n={"./de.json":9929,"./en.json":790};function a(t){var e=o(t);return s(e)}function o(t){if(!s.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}a.keys=function(){return Object.keys(n)},a.resolve=o,t.exports=a,a.id=8973},2862:function(t,e,s){"use strict";t.exports=s.p+"img/FHEM_Logo.a2a7fc8d.png"},4147:function(t){"use strict";t.exports={i8:"3.30.2"}},9929:function(t){"use strict";t.exports=JSON.parse('{"app":{"navigation":{"home":"Home","group":"Gruppen","room":"Bereiche","dashboard":"Dashboard","system":"System"},"dates":{"from":"von","to":"bis"}},"templates":{"sysmon":{"updateBtn":["prüfe Updates...","system aktuell","update","update läuft.."],"restartBtn":"neustart","updateDialog":{"header":"FHEM Update","text":"Update wurde erfolgreich beendet. FHEM sollte neu gestartet werden.","restartBtn":"jetzt neustarten"}}}}')},790:function(t){"use strict";t.exports=JSON.parse('{"app":{"navigation":{"home":"Home","group":"Groups","room":"Area","dashboard":"Dashboard","system":"System"},"dates":{"from":"From","to":"To"}},"templates":{"sysmon":{"updateBtn":["check updates...","up to date","update","update running..."],"restartBtn":"restart","updateDialog":{"header":"FHEM Update","text":"Update was successful finished. FHEM should be restarted now.","restartBtn":"restart now"}}}}')}},e={};function s(n){var a=e[n];if(void 0!==a)return a.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,s),o.exports}s.m=t,function(){var t=[];s.O=function(e,n,a,o){if(!n){var i=1/0;for(c=0;c
=o)&&Object.keys(s.O).every((function(t){return s.O[t](n[l])}))?n.splice(l--,1):(r=!1,o0&&t[c-1][2]>o;c--)t[c]=t[c-1];t[c]=[n,a,o]}}(),function(){s.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return s.d(e,{a:e}),e}}(),function(){s.d=function(t,e){for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){s.f={},s.e=function(t){return Promise.all(Object.keys(s.f).reduce((function(e,n){return s.f[n](t,e),e}),[]))}}(),function(){s.u=function(t){return"js/"+t+"."+{44:"1ae09cf8",121:"006dace8",154:"cb009208",285:"6fc47f33",288:"6d3eb988",320:"14e9d509",322:"a37a620a",337:"3c817406",387:"06272897",396:"02bb2eaa",438:"27924680",475:"e1a25454",524:"c1bbbde3",846:"510798d7",869:"df959138",884:"472374d2",947:"371294c0"}[t]+".js"}}(),function(){s.miniCssF=function(t){return"css/"+t+"."+{44:"7086d1d2",154:"8ecd64f4",285:"b6c37c1b",288:"a57bcf5c",337:"b2abc4be",387:"5322d21c",396:"8ecd64f4",438:"85e1c6a8",475:"35328724",524:"8ecd64f4",846:"b79779ed",869:"5fde8d03",947:"85e1c6a8"}[t]+".css"}}(),function(){s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){var t={},e="fhemapp:";s.l=function(n,a,o,i){if(t[n])t[n].push(a);else{var r,l;if(void 0!==o)for(var p=document.getElementsByTagName("script"),c=0;c({alert:!1,type:"info",types:["","error","info","info","success","warning"],message:"",meta:"",msgList:[]}),watch:{msgList(){this.msgList&&this.msgList.length>0?(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(){this.$fhem.on("message",(t=>{let e={lvl:5,msg:"no valid message received",meta:""};Object.assign(e,t),this.msgList.unshift(e)}))},methods:{clearMessage(){this.msgList.length>0&&this.msgList.splice(0,1)}}},p=l,c=s(1001),h=s(3453),d=s.n(h),u=s(1234),m=s(3150),f=s(2102),g=s(6428),v=s(2877),b=(0,c.Z)(p,i,r,!1,null,null,null),y=b.exports;d()(b,{VAlert:u.Z,VBtn:m.Z,VCol:f.Z,VIcon:g.Z,VRow:v.Z});var O={components:{Broadcaster:y},data:()=>({appBar:{color:"",drawer:null,clock:null,header:null},app:{options:{loading:!1,reloadBtn:!1,expandGroups:!1,expandRooms:!1},session:{connect:!1},data:{roomList:[],groupList:[]}},version:"v"+s(4147).i8,status:{color:"secondary",icon:"mdi-circle",text:"unbekannt",time:""}}),computed:{showRooms(){return this.app.data.roomList.length>0},showGroups(){return this.app.data.groupList.length>0}},watch:{"app.session.connect"(t){this.status.color=t?"success":"error",this.status.text=t?"online":"offline",this.status.time=this.$fhem.getDateTime()}},mounted(){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(){location.reload(!0)},goTo(t){let e=t||"/";this.$router.currentRoute.path!=e&&this.$router.push(e)}}},w=O,C=s(7524),k=s(426),x=s(5206),_=s(5424),L=s(9846),R=s(1418),j=s(7047),T=s(6816),S=s(9443),Z=s(7620),E=s(1960),I=s(459),V=s(7877),B=s(5132),D=s(1058),P=s(624),A=s(9762),F=s(9330),N=(0,c.Z)(w,a,o,!1,null,"4f254ced",null),M=N.exports;d()(N,{VApp:C.Z,VAppBar:k.Z,VAppBarNavIcon:x.Z,VBtn:m.Z,VChip:_.Z,VContainer:L.Z,VDivider:R.Z,VIcon:g.Z,VImg:j.Z,VList:T.Z,VListGroup:S.Z,VListItem:Z.Z,VListItemContent:E.km,VListItemIcon:I.Z,VListItemSubtitle:E.oZ,VListItemTitle:E.V9,VMain:V.Z,VNavigationDrawer:B.Z,VOverlay:D.Z,VProgressCircular:P.Z,VSpacer:A.Z,VTooltip:F.Z});var H=s(8345);n.Z.use(H.Z);const $=[{path:"/",name:"Home",component:()=>s.e(320).then(s.bind(s,4320))},{path:"/system",name:"System",component:()=>s.e(320).then(s.bind(s,4320))},{path:"/dashboard",name:"Dashboard",component:()=>s.e(320).then(s.bind(s,4320))},{path:"/devices/:filter",name:"Devices",component:()=>s.e(320).then(s.bind(s,4320))},{path:"/settings",name:"Settings",component:()=>s.e(884).then(s.bind(s,6884))},{path:"/syslog",name:"Syslog",component:()=>Promise.all([s.e(121),s.e(288),s.e(285),s.e(44)]).then(s.bind(s,4044))}],U=new H.Z({mode:"hash",base:"",routes:$});var q=U,z=s(9132),G=s(9146),J=s(1846);n.Z.use(z.Z);const X={lang:{locales:{de:G.Z},current:"de"},theme:{dark:!0,themes:{dark:{primary:J.Z.grey.darken4,secondary:J.Z.grey.darken3,success:J.Z.green.accent2,accent:J.Z.green.accent2},light:{primary:J.Z.grey,secondary:J.Z.grey.lighten3,success:J.Z.green.accent3,accent:J.Z.green.accent3}}}};var K=new z.Z(X),W=s(7166),Q=s.n(W),Y=s(7152);function tt(){const t=s(8973),e={};return t.keys().forEach((s=>{const n=s.match(/([A-Za-z0-9-_]+)\./i);if(n&&n.length>1){const a=n[1];e[a]=t(s)}})),e}n.Z.use(Y.Z);var et=new Y.Z({locale:"de",fallbackLocale:"en",messages:tt()}),st=s(7187),nt=s.n(st);class at extends(nt()){constructor(){super(),this.app={connection:{location:window.location.protocol+"//"+window.location.hostname,port:window.location.port,path:"fhem",type:"websocket"},conn:null,connOffset:0,session:{connect:!1,ready:!1,csrf:null,restart:!1,restartCnt:0,logList:[]},options:{lang:"de",debugMode:!1,debugLevel:5,loading:!1,loadCount:0,clockInterval:1e3,clockFormat:{hour:"2-digit",minute:"2-digit"},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"},{name:"cam",component:"templ_cam"},{name:"iframe",component:"templ_iframe"}],data:{roomList:[],groupList:[],deviceList:[],routeList:[],header:""},hasConnected:[]}}set loading(t){t&&this.app.options.loadCount++,!t&&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)}log(t){let e=["","mdi-alert-outline","mdi-connection","mdi-send-circle-outline","mdi-sync","mdi-hexagon-multiple-outline"],s=["","error","info","success","success","warning"],n=(new Date).toLocaleTimeString(this.app.options.lang),a=(new Date).getMilliseconds(),o={time:n+":"+("000"+a).slice(-3),msg:t.msg||"",lvl:t.lvl||5,meta:t.meta||null,icon:e[t.lvl||5],color:s[t.lvl||5]};this.app.options.logRecord&&o.lvl<=this.app.options.debugLevel&&(this.app.session.logList.unshift(o),this.app.session.logList.length>this.app.options.logBuffer&&(this.app.session.logList.length=this.app.options.logBuffer)),1==o.lvl&&(this.app.options.loadCount=0,this.app.options.loading=!1,this.emit("message",o))}getDate(t){let e=t?parseInt(t):0;return(t=>new Date(t.setDate(t.getDate()-e)).toISOString())(new Date).split("T")[0]}getDateTime(t){let e=t||(new Date).toISOString();return new Date(e.replace(" ","T")).toLocaleString(this.app.options.lang,{dateStyle:"short",timeStyle:"medium"}).replace(",","")}createURL(t){let e=this.app.connection,s=e.location?e.location:"",n=e.port?":"+e.port.replace(":",""):"",a=e.path?"/"+e.path.replace("/",""):"",o="";return"object"==typeof t&&t.length>0&&t.forEach((t=>{t.param&&t.value&&(o+=o?"&":"?",o+=t.param+"="+encodeURIComponent(t.value))})),s+n+a+o}getEl(t,...e){return e.reduce(((t,e)=>t&&t[e]),t)}async request(t,e,s){let n=[];"csrf"!=e&&n.push({param:"fwcsrf",value:this.app.session.csrf}),"json"!==e&&"csrf"!==e||n.push({param:"XHR",value:"1"}),"object"===typeof t&&(t.length>0?n.push(...t):n.push(t)),"string"===typeof t&&n.push({param:"cmd",value:t});let a=this.createURL(n);return this.log({lvl:3,msg:"Request: "+a}),await fetch(a).then((t=>{let n=null;return"csrf"===e&&(n=t.headers.get("x-fhem-csrftoken")),"json"===e&&(n=t.json()),n||(n=t.text()),"object"===typeof s?Object.assign(s,{data:n}):n})).catch((t=>this.log({lvl:1,msg:"Request failed "+a,meta:t.message})))}async getJsonFile(t){let e=new Headers;e.append("pragma","no-cache"),e.append("cache-control","no-cache");let s={method:"GET",headers:e},n=await fetch(t,s).then((t=>t.json())).catch((e=>this.log({lvl:1,msg:"Read Json-Data from "+t+" failed.",meta:e})));return n&&this.log({lvl:5,msg:"Json-Data parsed from "+t,meta:n}),await n}async readConfig(t){let e=await this.getJsonFile(t);if(e){for(const t of Object.keys(e))t in this.app&&Object.assign(this.app[t],e[t]);this.app.options.debugMode&&(this.app.appBar.color="pink darken-4")}else this.log({lvl:2,msg:"No Configuration File found. FHEMApp starting with default settings.",meta:this.app.options})}async createOptions(t){let e=null;if("appOptions"in t.Attributes){try{e=JSON.parse(t.Attributes.appOptions)}catch(s){this.log({lvl:1,msg:"Read `appOptions` from "+t.Name+" failed.",meta:s.message})}e&&(e.device=t.Name,e.name||(e.name=this.getEl(t,"Attributes","alias")||t.Name),e.sortby||this.app.options.ignoreFhemSortby||(e.sortby=this.getEl(t,"Attributes","sortby")||"zzz"),e.room||this.app.options.ignoreFhemRoom||(e.room=this.getEl(t,"Attributes","room")||""),e.group||this.app.options.ignoreFhemGroup||(e.group=this.getEl(t,"Attributes","group")||""),"hidden"===e.room&&(e.room=""),"hidden"===e.group&&(e.group=""),e.sortby||(e.sortby="zzz"),e.setup||(e.setup={}),e.show=!0,e.status={level:null,color:null,isActive:!0,error:null},e.info={left1Icon:null,left1IconColor:null,left1Text:null,left2Icon:null,left2IconColor:null,left2Text:null,mid1Icon:null,mid1IconColor:null,mid1Text:null,mid2Icon:null,mid2IconColor:null,mid2Text:null,right1Icon:null,right1IconColor:null,right1Text:null,right2Icon:null,right2IconColor:null,right2Text:null})}return await e}createRoutes(t,e){let s=this.app.data.routeList.map((t=>t.route)).indexOf(e);-1!=s?this.app.data.routeList[s].deviceList.push(t.device):this.app.data.routeList.push({route:e,deviceList:[t.device]})}createNaviItems(t,e,s){let n=t[s].split(",");for(const a of n){let n=s+"="+a;-1==e.map((t=>t.title)).indexOf(a)&&e.push({title:a,route:n}),this.createRoutes(t,n)}}async getTemplate(t){if(-1==this.app.componentMap.map((t=>t.name)).indexOf(t.template)&&-1==this.app.templates.map((t=>t.name)).indexOf(t.template))return await this.getJsonFile("./cfg/templ_"+t.template+".json")}async loadStructure(){let t=await this.request({param:"cmd",value:"jsonList2 appOptions!= appOptions room group"},"json");if(t&&t.Results.length>0){let e=[],s=[];this.app.data.routeList.splice(0);for(const n of t.Results){let t=await this.createOptions(n);if(t.template){let n=await this.getTemplate(t);n&&this.app.templates.push(n),t.room&&this.createNaviItems(t,e,"room"),t.group&&this.createNaviItems(t,s,"group"),t.home&&this.createRoutes(t,"/"),t.dashboard&&this.createRoutes(t,"/dashboard"),t.system&&this.createRoutes(t,"/system")}}e.sort(((t,e)=>t.title>e.title?1:e.title>t.title?-1:0)),s.sort(((t,e)=>t.title>e.title?1:e.title>t.title?-1:0)),this.app.data.roomList=Object.assign([],e),this.app.data.groupList=Object.assign([],s),this.app.session.ready=!0,this.loading=!1}}async createConnected(t){let e={},s=this.app.hasConnected.indexOf(t.Name);if(-1==s){if(this.app.hasConnected.push(t.Name),"connected"in t.Options){let s=Object.keys(t.Options.connected);for(const n of s){let s=await this.request({param:"cmd",value:"jsonlist2 "+t.Options.connected[n]},"json");if(s&&1==s.Results.length){"PossibleSets"in s.Results[0]&&delete s.Results[0].PossibleSets,"PossibleAttrs"in s.Results[0]&&delete s.Results[0].PossibleAttrs;let t=await this.createOptions(s.Results[0]);t&&(s.Results[0].Options=t),t&&s.Results[0].Options.connected&&(s.Results[0].Connected=await this.createConnected(s.Results[0])),s.Results[0].Options&&this.handleTemplate(s.Results[0]),e[n]=s.Results[0]}}}}else this.log({lvl:1,msg:"FHEM Device "+t.Name+" is defined as connected device, witch is called from himself. ",meta:t});return e}getSetup(t){let e=this.app.templates.map((t=>t.name)).indexOf(t);if(-1!=e){let t=this.app.templates[e],s={};return t.status&&Object.assign(s,{status:t.status}),t.main&&Object.assign(s,{main:t.main}),t.info&&Object.assign(s,{info:t.info}),t.show&&Object.assign(s,{show:t.show}),s.size=t.size||"col-12 col-sm-6 col-md-4 col-lg-4",s.expand=t.expand||!1,s.expanded=t.expanded||!1,s}this.log({lvl:1,msg:"Template Definition "+t+" not found."})}getComponent(t){let e={component:"templ_default"},s=this.app.componentMap.map((t=>t.name)).indexOf(t);if(-1!=s){let t=this.app.componentMap[s].component;t&&(e.component=t)}return e}async getDevices(t){let e=this.app.data.routeList.map((t=>t.route)).indexOf(t);if(this.app.data.deviceList.splice(0),this.app.hasConnected=[],-1!=e||t.match("device=")){let s=-1!=e?this.app.data.routeList[e].deviceList.join(","):t.replace("device=","").split("&")[0];if(s){this.loading=!0;let t=await this.request({param:"cmd",value:"jsonlist2 "+s},"json"),e=[],n=1;for(const s of t.Results){"PossibleSets"in s&&delete s.PossibleSets,"PossibleAttrs"in s&&delete s.PossibleAttrs;let a=await this.createOptions(s),o=this.getComponent(a.template);if(Object.assign(a,o),"templ_default"===a.component){let t=await this.getSetup(a.template);a.setup&&Object.assign(t,a.setup),a.setup=t}s.Options=a,s.Options.connected&&(s.Connected=await this.createConnected(s)),this.handleTemplate(s),e.push(s),n===t.Results.length&&(e.sort(((t,e)=>t.Options.sortby>e.Options.sortby?1:e.Options.sortby>t.Options.sortby?-1:0)),this.app.data.deviceList=Object.assign([],e),this.loading=!1),n++}}}}async checkUpdate(){let t=await this.request([{param:"cmd",value:"update check"},{param:"XHR",value:"1"}]),e=0;if(t){let s=t.split("\n").splice(2);for(const t of s)t.match("UPD")&&!t.match("excluded")&&e++}return e>0}handleLogData(t){let e=t.split("\n");e.length>3&&e.splice(-3,3);let s=[],n=e.length>this.app.options.maxChartPoints?parseInt(e.length/this.app.options.maxChartPoints):1,a=n,o=0,i=1;for(const r of e){let t=r.split(" "),l=Date.parse(t[0].replace("_","T")),p=parseFloat(t[1]);o+=p,(i>=a||i===e.length)&&(i===e.length&&(n-=a-i),s.push({timestamp:l,value:o/n}),a+=n,o=0),i++}return this.log({lvl:5,msg:"handle Chartdata (Lines: "+e.length+")"}),s}async readLogData(t){let e=[];if(this.loading=!0,t.defs&&t.defs.length>0){let s=0;for(const n of t.defs){let a=/\(.*\)/.exec(n),o=a?n.replace(a[0],"_").split(":"):n.split(":"),i="get ";i+=o[0]?o[0]:t.deviceName,i+=t.from?" - - "+t.from:"",i+=t.to?" "+t.to:"",i+=a?" "+a[0].replace(/\(|\)/g,""):" 4:"+o[1];let r=await this.request([{param:"cmd",value:i},{param:"XHR",value:"1"}],"text",{id:s});r&&e.push({id:r.id,data:this.handleLogData(await r.data)}),s++}}return this.loading=!1,Object.assign(t,{data:e})}replaceVals(t,e){let s=/-?[0-9]/.exec(e),n=[];for(var a=2;a1?r+"Tage ":r>0?r+"Tag ":"";c+=l>0?l+"h ":"",c+=p>0?p+"min":"",o=t[a].replace("%a",c)}if(/%n/.test(t[a])&&s){/%n.[0-9]/.test(t[a])||(t[a]=t[a].replace("%n","%n.0"));let n=/%n../.exec(t[a]),i=n[0].replace("%n.","");o=t[a].replace(n[0],parseFloat(e.slice(s.index)).toFixed(i))}if(/%i/.test(t[a])&&s){let n=parseFloat(t[a].split("%i")[1]);if("isNaN"!=n){let i=n.toString().split(".")[1]||"",r=i.length,l=parseFloat(e.slice(s.index))+n;o=t[a].replace("%i"+n,l.toFixed(r))}}o=o.replace(/:/g,":"),n.push(o)}return n}handleVals(t,e){let s=[];if("string"===typeof e){let t=("::"+e).split(":");s=this.replaceVals(t,"")}if("object"===typeof t&&"object"===typeof e&&e.length>0)for(const n of e){let e=n.split(":");if(e.length>2){let n=/\./.test(e[0])?e[0].split("."):["Readings",e[0],"Value"],a=this.getEl(t,...n)||this.getEl(t,"Readings",e[0],"Value");if(a){let t=!1,n=parseFloat(e[1]);if(isNaN(n))RegExp(e[1]?e[1]:".").test(a)&&(t=!0);else{let e=/-?[0-9]/.exec(a);-1!=e.index&&parseFloat(a.slice(e.index))>=n&&(t=!0)}if(t){s=this.replaceVals(e,a);break}}}}return s}handleTemplate(t){let e=this.getEl(t,"Options","setup","show"),s=this.getEl(t,"Options","setup","status","bar"),n=this.getEl(t,"Options","setup","status","error"),a=this.getEl(t,"Options","setup","info");if(e){let s=this.handleVals(t,e);t.Options.show="false"!==s[0],s[1]&&(t.Options.setup.size=s[1]),s[2]&&(t.Options.sortby=s[2])}if(s){let e=this.getEl(t,"Options","setup","status","min")||0,n=this.getEl(t,"Options","setup","status","max")||100,a=this.handleVals(t,s),o=100/(n-e),i=(a[0]||"0"-e)*o;t.Options.status.level=a[2]?100-i:i,t.Options.status.color=a[1]||"success"}if(n){let e=this.handleVals(t,n);e.length>0?(t.Options.status.level=e[0]||"100",t.Options.status.color=e[1]||"error",t.Options.status.error=e[2]||"Fehler",t.Options.status.isActive=!1):t.Options.status.isActive=!0}if(a){let e=this.handleVals(t,a.left1),s=this.handleVals(t,a.left2),n=this.handleVals(t,a.mid1),o=this.handleVals(t,a.mid2),i=this.handleVals(t,a.right1),r=this.handleVals(t,a.right2);t.Options.info.left1IconColor=e[2]||"",t.Options.info.left1Icon=e[1]||"",t.Options.info.left1Text=e[0]||"",t.Options.info.left2IconColor=s[2]||"",t.Options.info.left2Icon=s[1]||"",t.Options.info.left2Text=s[0]||"",t.Options.info.mid1IconColor=n[2]||"",t.Options.info.mid1Icon=n[1]||"",t.Options.info.mid1Text=n[0]||"",t.Options.info.mid2IconColor=o[2]||"",t.Options.info.mid2Icon=o[1]||"",t.Options.info.mid2Text=o[0]||"",t.Options.info.right1IconColor=i[2]||"",t.Options.info.right1Icon=i[1]||"",t.Options.info.right1Text=i[0]||"",t.Options.info.right2IconColor=r[2]||"",t.Options.info.right2Icon=r[1]||"",t.Options.info.right2Text=r[0]||""}}handleData(t){let e=JSON.parse(t),s=null;if(!e[2].match("0){let t=this.handleData(s);if(t){let e=0;for(const s of this.app.data.deviceList){let n=this.app.data.deviceList[e],a=Object.assign({},n);if(s.Name===t.Name&&("Readings"===t.devicePart&&this.getEl(a,"Readings",t.param,t.paramPart)&&(a.Readings[t.param][t.paramPart]=t.value),"Attributes"===t.devicePart&&this.getEl(a,"Attributes",t.param)&&(a.Attributes[t.param]=t.value),this.handleTemplate(a),this.app.data.deviceList.splice(e,1,a),this.app.data.deviceList.sort(((t,e)=>t.Options.sortby>e.Options.sortby?1:e.Options.sortby>t.Options.sortby?-1:0))),"Connected"in s){let n=0;for(const o of Object.values(s.Connected)){if(o.Name===t.Name){let o=Object.keys(s.Connected)[n];"Readings"===t.devicePart&&this.getEl(a.Connected[o],"Readings",t.param,t.paramPart)&&(a.Connected[o].Readings[t.param][t.paramPart]=t.value),"Attributes"===t.devicePart&&this.getEl(a.Connected[o],"Attributes",t.param)&&(a.Connected[o].Attributes[t.param]=t.value),this.handleTemplate(a),this.app.data.deviceList.splice(e,1,a),this.app.data.deviceList.sort(((t,e)=>t.Options.sortby>e.Options.sortby?1:e.Options.sortby>t.Options.sortby?-1:0))}n++}}e++}}}}async connOpen(){this.app.session.connect=!0,this.app.session.restartCnt=0,this.log({lvl:2,msg:"Connection with FHEM is opened.",meta:this.app.connection}),this.app.session.csrf=await this.request({},"csrf"),this.log({lvl:2,msg:"Crsf-Token received.",meta:{token:this.app.session.csrf}}),this.loadStructure()}async connClose(t){if(this.app.session.connect=!1,this.app.session.csrf=null,this.app.session.ready=!1,this.app.conn=null,!this.app.session.restart){let e=0==this.app.session.restartCnt?1:3e3;this.app.session.restart=!0,setTimeout((()=>{this.app.session.restart=!1,this.app.session.restartCnt++,this.connStart()}),e);let s={info:"Connection ("+this.app.connection.type+") "+(t?"failed.":"was closed."),errCode:t||""};this.log({lvl:2,msg:"Connection with FHEM was closed. Try to Reconnect in "+e/1e3+" seconds...",meta:s}),this.loading=!1}}async connStart(){let t=[{param:"inform",value:"type=status;filter=.*;fmt=JSON"},{param:"XHR",value:"1"}],e=this.createURL(t);"websocket"===this.app.connection.type?(this.app.conn=new WebSocket(e.replace(/^http/i,"ws")),this.app.conn.onopen=()=>this.connOpen(),this.app.conn.onmessage=t=>this.doUpdate(t),this.app.conn.onclose=()=>this.connClose(),this.app.conn.onerror=t=>this.connClose(t)):(this.app.conn=new XMLHttpRequest,this.app.conn.open("GET",e,!0),this.app.conn.onreadystatechange=()=>{200===this.app.conn.status&&2===this.app.conn.readyState&&this.connOpen(),200===this.app.conn.status&&3===this.app.conn.readyState&&this.doUpdate()},this.app.conn.onerror=t=>this.connClose(t),this.app.conn.send())}setClock(){let t=new Date;this.app.appBar.clock=t.toLocaleString(this.app.options.lang,this.app.options.clockFormat),this.app.options.mobileHeader||(this.app.appBar.header=t.toLocaleString(this.app.options.lang,{weekday:"long",year:"numeric",month:"long",day:"numeric"}))}async init(t,e){this.log({lvl:2,msg:"Starting FHEMApp..."}),this.loading=!0,await this.readConfig("./cfg/config.json"),this.connStart(),t&&this.app.theme&&(-1!=this.app.theme.dark&&Object.assign(t.framework.theme,{dark:this.app.theme.dark}),this.app.theme.themes.light&&Object.assign(t.framework.theme.themes.light,this.app.theme.themes.light),this.app.theme.themes.dark&&Object.assign(t.framework.theme.themes.dark,this.app.theme.themes.dark)),e&&this.app.options.lang&&(e.locale=this.app.options.lang),this.setClock(),setInterval((()=>this.setClock()),this.app.options.clockInterval)}}var ot={install(t,e,s){t.prototype.$fhem=new at,t.prototype.$fhem.init(e,s)}};n.Z.use(ot,K,et),n.Z.use(Q()),n.Z.component("apex-chart",Q()),n.Z.config.productionTip=!1,new n.Z({vuetify:K,router:q,i18n:et,render:t=>t(M)}).$mount("#app")},8973:function(t,e,s){var n={"./de.json":9929,"./en.json":790};function a(t){var e=o(t);return s(e)}function o(t){if(!s.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}a.keys=function(){return Object.keys(n)},a.resolve=o,t.exports=a,a.id=8973},2862:function(t,e,s){"use strict";t.exports=s.p+"img/FHEM_Logo.a2a7fc8d.png"},4147:function(t){"use strict";t.exports={i8:"3.30.3"}},9929:function(t){"use strict";t.exports=JSON.parse('{"app":{"navigation":{"home":"Home","group":"Gruppen","room":"Bereiche","dashboard":"Dashboard","system":"System"},"dates":{"from":"von","to":"bis"}},"templates":{"sysmon":{"updateBtn":["prüfe Updates...","system aktuell","update","update läuft.."],"restartBtn":"neustart","updateDialog":{"header":"FHEM Update","text":"Update wurde erfolgreich beendet. FHEM sollte neu gestartet werden.","restartBtn":"jetzt neustarten"}}}}')},790:function(t){"use strict";t.exports=JSON.parse('{"app":{"navigation":{"home":"Home","group":"Groups","room":"Area","dashboard":"Dashboard","system":"System"},"dates":{"from":"From","to":"To"}},"templates":{"sysmon":{"updateBtn":["check updates...","up to date","update","update running..."],"restartBtn":"restart","updateDialog":{"header":"FHEM Update","text":"Update was successful finished. FHEM should be restarted now.","restartBtn":"restart now"}}}}')}},e={};function s(n){var a=e[n];if(void 0!==a)return a.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,s),o.exports}s.m=t,function(){var t=[];s.O=function(e,n,a,o){if(!n){var i=1/0;for(c=0;c
=o)&&Object.keys(s.O).every((function(t){return s.O[t](n[l])}))?n.splice(l--,1):(r=!1,o0&&t[c-1][2]>o;c--)t[c]=t[c-1];t[c]=[n,a,o]}}(),function(){s.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return s.d(e,{a:e}),e}}(),function(){s.d=function(t,e){for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){s.f={},s.e=function(t){return Promise.all(Object.keys(s.f).reduce((function(e,n){return s.f[n](t,e),e}),[]))}}(),function(){s.u=function(t){return"js/"+t+"."+{44:"1ae09cf8",121:"006dace8",154:"cb009208",285:"6fc47f33",288:"6d3eb988",320:"2ba04f2e",322:"a37a620a",337:"3c817406",387:"06272897",396:"02bb2eaa",438:"27924680",475:"e1a25454",846:"510798d7",869:"df959138",884:"472374d2",947:"371294c0",997:"e21ab267"}[t]+".js"}}(),function(){s.miniCssF=function(t){return"css/"+t+"."+{44:"7086d1d2",154:"8ecd64f4",285:"b6c37c1b",288:"a57bcf5c",337:"b2abc4be",387:"5322d21c",396:"8ecd64f4",438:"85e1c6a8",475:"35328724",846:"b79779ed",869:"5fde8d03",947:"85e1c6a8",997:"8ecd64f4"}[t]+".css"}}(),function(){s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){var t={},e="fhemapp:";s.l=function(n,a,o,i){if(t[n])t[n].push(a);else{var r,l;if(void 0!==o)for(var p=document.getElementsByTagName("script"),c=0;c