diff --git a/packages/modules/display_themes/colors/source/src/assets/js/processMessages.ts b/packages/modules/display_themes/colors/source/src/assets/js/processMessages.ts index 449162d871..f4bbc10320 100755 --- a/packages/modules/display_themes/colors/source/src/assets/js/processMessages.ts +++ b/packages/modules/display_themes/colors/source/src/assets/js/processMessages.ts @@ -202,8 +202,8 @@ function processPvConfigMessages(topic: string, message: string) { const elements = topic.split('/') if (elements.length > 0) { switch (elements[4]) { - case 'bat_prio': - globalData.updatePvBatteryPriority(message == 'true') + case 'bat_mode': + globalData.updatePvBatteryPriority(JSON.parse(message)) break default: // console.warn('Ignored PV CONFIG msg: [' + topic + '] ' + message) diff --git a/packages/modules/display_themes/colors/source/src/assets/js/sendMessages.ts b/packages/modules/display_themes/colors/source/src/assets/js/sendMessages.ts index 12b4074d94..14e680880d 100755 --- a/packages/modules/display_themes/colors/source/src/assets/js/sendMessages.ts +++ b/packages/modules/display_themes/colors/source/src/assets/js/sendMessages.ts @@ -15,7 +15,7 @@ const topics: { [topic: string]: string } = { cpTimedCharging: 'openWB/set/vehicle/template/charge_template/%/time_charging/active', pvBatteryPriority: - 'openWB/set/general/chargemode_config/pv_charging/bat_prio', + 'openWB/set/general/chargemode_config/pv_charging/bat_mode', cpVehicle: 'openWB/set/chargepoint/%/config/ev', cpInstantChargeLimitMode: 'openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/limit/selected', diff --git a/packages/modules/display_themes/colors/web/assets/index-C7OqKIN-.js b/packages/modules/display_themes/colors/web/assets/index-CiuX3rgu.js similarity index 98% rename from packages/modules/display_themes/colors/web/assets/index-C7OqKIN-.js rename to packages/modules/display_themes/colors/web/assets/index-CiuX3rgu.js index 9458cd2292..065ae8cadf 100644 --- a/packages/modules/display_themes/colors/web/assets/index-C7OqKIN-.js +++ b/packages/modules/display_themes/colors/web/assets/index-CiuX3rgu.js @@ -1,5 +1,5 @@ -var sa=Object.defineProperty;var ia=(t,e,a)=>e in t?sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var s=(t,e,a)=>ia(t,typeof e!="symbol"?e+"":e,a);import{m as ca,r as F,a as Se,M as At,d as A,o as g,c as y,n as q,b as I,e as u,f as ue,g as te,h as p,s as me,i as Ke,j as la,t as B,u as n,k,w as P,l as z,p as ke,q as Me,v as Lt,x as Dt,y as ua,z as E,F as Ie,A as Be,B as Ee,C as ut,D as Ce,E as Gt,G as gt,H as Re,I as Le,J as tt,K as kt,L as da,N as He,O as ha,P as pa,Q as ga,R as Fe,S as ma,T as Ye,U as at,V as fa}from"./vendor-DkUHBf2M.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function a(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=a(o);fetch(o.href,l)}})();function Je(t,e=1){let a;if(t>=1e3&&e<4){switch(e){case 0:a=Math.round(t/1e3);break;case 1:a=Math.round(t/100)/10;break;case 2:a=Math.round(t/10)/100;break;case 3:a=Math.round(t)/1e3;break;default:a=Math.round(t/100)/10;break}return(a==null?void 0:a.toLocaleString(void 0,{minimumFractionDigits:e}))+" kW"}else return Math.round(t).toLocaleString(void 0)+" W"}function Vt(t,e=1,a=!1){let r;if(t>1e6&&(a=!0,t=t/1e3),t>=1e3&&e<4){switch(e){case 0:r=Math.round(t/1e3);break;case 1:r=(Math.round(t/100)/10).toFixed(1);break;case 2:r=(Math.round(t/10)/100).toFixed(2);break;case 3:r=(Math.round(t)/1e3).toFixed(3);break;default:r=Math.round(t/100)/10;break}return r.toLocaleString(void 0,{minimumFractionDigits:e})+(a?" MWh":" kWh")}else return Math.round(t).toLocaleString(void 0)+(a?" kWh":" Wh")}function va(t){return t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function _a(t,e){return["Jan","Feb","März","April","Mai","Juni","Juli","Aug","Sep","Okt","Nov","Dez"][t]+" "+e}const ya=0,Et={host:location.hostname,port:location.protocol=="https:"?443:80,endpoint:"/ws",protocol:location.protocol=="https:"?"wss":"ws",connectTimeout:4e3,reconnectPeriod:4e3,clean:!1,clientId:Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,6)},Qe={topic:"",qos:ya};let ne;const{host:ba,port:wa,endpoint:Sa,...Wt}=Et,ka=`${Wt.protocol}://${ba}:${wa}${Sa}`;try{ne=ca.connect(ka,Wt),ne.on("connect",()=>{console.info("MQTT connection successful.")}),ne.on("disconnect",()=>{console.info("MQTT disconnected")}),ne.on("error",t=>{console.error("MQTT connection failed: ",t)})}catch(t){console.error("MQTT connect error: ",t)}async function Ma(t){await Nt(),ne?ne.on("message",t):console.error("MqttRegister: MQTT client not available")}async function $e(t){Qe.topic=t;const{topic:e,qos:a}=Qe;await Nt(),ne.subscribe(e,{qos:a},r=>{if(r){console.error("MQTT Subscription error: "+r);return}})}function Oe(t){Qe.topic=t;const{topic:e}=Qe;ne.unsubscribe(e,a=>{if(a){console.error("MQTT Unsubscribe from "+t+" failed: "+a);return}})}async function dt(t,e){let r=ne.connected,o=0;for(;!r&&o<10;)console.warn("MQTT not connected. Waiting 0.1 seconds"),await jt(100),r=ne.connected,o+=1;if(o<10)try{ne.publish(t,e,{qos:0},l=>{l&&console.warn("MQTT publish error: ",l),console.info("MQTT publish: Message sent: ["+t+"]("+e+")")})}catch(l){console.warn("MQTT publish: caught error: "+l)}else console.error("MQTT publish: Lost connection to MQTT server. Please reload the page")}function mt(){return Et.clientId}const Mt=20;async function Nt(){let t=ne.connected,e=0;for(;!t&&e{esetTimeout(e,t))}class xa{constructor(e){s(this,"id");s(this,"name","Ladepunkt");s(this,"icon","Ladepunkt");s(this,"type","");s(this,"ev",0);s(this,"template",0);s(this,"connectedPhases",0);s(this,"phase_1",0);s(this,"autoPhaseSwitchHw",!1);s(this,"controlPilotInterruptionHw",!1);s(this,"isEnabled",!0);s(this,"isPluggedIn",!1);s(this,"isCharging",!1);s(this,"_isLocked",!1);s(this,"_connectedVehicle",0);s(this,"chargeTemplate",0);s(this,"evTemplate",0);s(this,"_chargeMode","pv_charging");s(this,"_hasPriority",!1);s(this,"currentPlan","");s(this,"averageConsumption",0);s(this,"vehicleName","");s(this,"rangeCharged",0);s(this,"rangeUnit","");s(this,"counter",0);s(this,"dailyYield",0);s(this,"energyPv",0);s(this,"energyBat",0);s(this,"pvPercentage",0);s(this,"faultState",0);s(this,"faultStr","");s(this,"phasesInUse",0);s(this,"power",0);s(this,"chargedSincePlugged",0);s(this,"stateStr","");s(this,"current",0);s(this,"currents",[0,0,0]);s(this,"phasesToUse",0);s(this,"isSocConfigured",!0);s(this,"isSocManual",!1);s(this,"waitingForSoc",!1);s(this,"color","white");s(this,"_timedCharging",!1);s(this,"_instantChargeLimitMode","");s(this,"_instantTargetCurrent",0);s(this,"_instantTargetSoc",0);s(this,"_instantMaxEnergy",0);s(this,"_pvFeedInLimit",!1);s(this,"_pvMinCurrent",0);s(this,"_pvMaxSoc",0);s(this,"_pvMinSoc",0);s(this,"_pvMinSocCurrent",0);s(this,"_etActive",!1);s(this,"_etMaxPrice",20);this.id=e}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked=e,Y("cpLock",e,this.id)}updateIsLocked(e){this._isLocked=e}get connectedVehicle(){return this._connectedVehicle}set connectedVehicle(e){this._connectedVehicle=e,Y("cpVehicle",e,this.id)}updateConnectedVehicle(e){this._connectedVehicle=e}get soc(){return N[this.connectedVehicle]?N[this.connectedVehicle].soc:0}set soc(e){N[this.connectedVehicle]&&(N[this.connectedVehicle].soc=e)}get chargeMode(){return this._chargeMode}set chargeMode(e){this._chargeMode=e,Y("chargeMode",e,this.id)}updateChargeMode(e){this._chargeMode=e}get hasPriority(){return this._hasPriority}set hasPriority(e){this._hasPriority=e,Y("cpPriority",e,this.id)}updateCpPriority(e){this._hasPriority=e}get timedCharging(){return ce[this.chargeTemplate]?ce[this.chargeTemplate].time_charging.active:!1}set timedCharging(e){ce[this.chargeTemplate].time_charging.active=e,Y("cpTimedCharging",e,this.chargeTemplate)}get instantTargetCurrent(){return this._instantTargetCurrent}set instantTargetCurrent(e){this._instantTargetCurrent=e,Y("cpInstantTargetCurrent",e,this.id)}updateInstantTargetCurrent(e){this._instantTargetCurrent=e}get instantChargeLimitMode(){return this._instantChargeLimitMode}set instantChargeLimitMode(e){this._instantChargeLimitMode=e,Y("cpInstantChargeLimitMode",e,this.id)}updateInstantChargeLimitMode(e){this._instantChargeLimitMode=e}get instantTargetSoc(){return this._instantTargetSoc}set instantTargetSoc(e){this._instantTargetSoc=e,Y("cpInstantTargetSoc",e,this.id)}updateInstantTargetSoc(e){this._instantTargetSoc=e}get instantMaxEnergy(){return this._instantMaxEnergy}set instantMaxEnergy(e){this._instantMaxEnergy=e,Y("cpInstantMaxEnergy",e,this.id)}updateInstantMaxEnergy(e){this._instantMaxEnergy=e}get pvFeedInLimit(){return this._pvFeedInLimit}set pvFeedInLimit(e){this._pvFeedInLimit=e,Y("cpPvFeedInLimit",e,this.id)}updatePvFeedInLimit(e){this._pvFeedInLimit=e}get pvMinCurrent(){return this._pvMinCurrent}set pvMinCurrent(e){this._pvMinCurrent=e,Y("cpPvMinCurrent",e,this.id)}updatePvMinCurrent(e){this._pvMinCurrent=e}get pvMaxSoc(){return this._pvMaxSoc}set pvMaxSoc(e){this._pvMaxSoc=e,Y("cpPvMaxSoc",e,this.id)}updatePvMaxSoc(e){this._pvMaxSoc=e}get pvMinSoc(){return this._pvMinSoc}set pvMinSoc(e){this._pvMinSoc=e,Y("cpPvMinSoc",e,this.id)}updatePvMinSoc(e){this._pvMinSoc=e}get pvMinSocCurrent(){return this._pvMinSocCurrent}set pvMinSocCurrent(e){this._pvMinSocCurrent=e,Y("cpPvMinSocCurrent",e,this.id)}updatePvMinSocCurrent(e){this._pvMinSocCurrent=e}get realCurrent(){switch(this.phasesInUse){case 0:return 0;case 1:return this.currents[0];case 2:return(this.currents[0]+this.currents[1])/2;case 3:return(this.currents[0]+this.currents[1]+this.currents[2])/3;default:return 0}}get etActive(){return N[this.connectedVehicle]?N[this.connectedVehicle].etActive:!1}set etActive(e){N[this.connectedVehicle]&&(N[this.connectedVehicle].etActive=e)}get etMaxPrice(){return N[this.connectedVehicle].etMaxPrice??0}set etMaxPrice(e){console.log("Setting et max price needs to be implemented"),Y("cpEtMaxPrice",Math.round(e*10)/1e6,this.id)}toPowerItem(){return{name:this.name,power:this.power,energy:this.dailyYield,energyPv:this.energyPv,energyBat:this.energyBat,pvPercentage:this.pvPercentage,color:this.color,icon:this.icon}}}class Pa{constructor(e){s(this,"id");s(this,"name","");s(this,"_chargeTemplateId",0);s(this,"_evTemplateId",0);s(this,"tags",[]);s(this,"config",{});s(this,"soc",0);s(this,"range",0);s(this,"_etActive",!1);s(this,"_etMaxPrice",20);this.id=e}get chargeTemplateId(){return this._chargeTemplateId}set chargeTemplateId(e){this._chargeTemplateId=e,Y("vhChargeTemplateId",e,this.id)}updateChargeTemplateId(e){this._chargeTemplateId=e}get evTemplateId(){return this._evTemplateId}set evTemplateId(e){this._evTemplateId=e,Y("vhEvTemplateId",e,this.id)}updateEvTemplateId(e){this._evTemplateId=e}get etActive(){return ce[this.chargeTemplateId]?ce[this.chargeTemplateId].et.active:!1}set etActive(e){ce[this.chargeTemplateId]&&Y("priceCharging",e,this.chargeTemplateId)}get etMaxPrice(){if(ce[this.chargeTemplateId]&&ce[this.chargeTemplateId].et.active)return ce[this.chargeTemplateId].et.max_price*1e5}get chargepoint(){for(const e of Object.values(b))if(e.connectedVehicle==this.id)return e}}var de=(t=>(t.instant_charging="instant_charging",t.pv_charging="pv_charging",t.scheduled_charging="scheduled_charging",t.standby="standby",t.stop="stop",t))(de||{});const b=F({}),N=F({}),ce=F({}),rt=F({}),ot=F({}),Ia=F({});function $a(t){t in b||(b[t]=new xa(t),b[t].color="var(--color-cp"+(Object.values(b).length-1)+")")}function Ca(){Object.keys(b).forEach(t=>{delete b[parseInt(t)]})}const Oa={cpLock:"openWB/set/chargepoint/%/set/manual_lock",chargeMode:"openWB/set/vehicle/template/charge_template/%/chargemode/selected",cpPriority:"openWB/set/vehicle/template/charge_template/%/prio",cpTimedCharging:"openWB/set/vehicle/template/charge_template/%/time_charging/active",pvBatteryPriority:"openWB/set/general/chargemode_config/pv_charging/bat_prio",cpVehicle:"openWB/set/chargepoint/%/config/ev",cpInstantChargeLimitMode:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/limit/selected",cpInstantTargetCurrent:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/current",cpInstantTargetSoc:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/limit/soc",cpInstantMaxEnergy:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/limit/amount",cpPvFeedInLimit:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/feed_in_limit",cpPvMinCurrent:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/min_current",cpPvMaxSoc:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/max_soc",cpPvMinSoc:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/min_soc",cpPvMinSocCurrent:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/min_soc_current",cpEtMaxPrice:"openWB/set/vehicle/template/charge_template/%/et/max_price",vhChargeTemplateId:"openWB/set/vehicle/%/charge_template",vhEvTemplateId:"openWB/set/vehicle/%/ev_template",shSetManual:"openWB/set/LegacySmartHome/config/set/Devices/%/mode",shSwitchOn:"openWB/set/LegacySmartHome/config/set/Devices/%/device_manual_control",socUpdate:"openWB/set/vehicle/%/get/force_soc_update",setSoc:"openWB/set/vehicle/%/soc_module/calculated_soc_state/manual_soc",priceCharging:"openWB/set/vehicle/template/charge_template/%/et/active"};function Y(t,e,a=0){if(isNaN(a)){console.warn("Invalid index");return}let r=Oa[t];if(!r){console.warn("No topic for update type "+t);return}switch(t){case"chargeMode":case"cpPriority":case"cpScheduledCharging":case"cpInstantTargetCurrent":case"cpInstantChargeLimitMode":case"cpInstantTargetSoc":case"cpInstantMaxEnergy":case"cpPvFeedInLimit":case"cpPvMinCurrent":case"cpPvMaxSoc":case"cpPvMinSoc":case"cpEtMaxPrice":case"cpPvMinSocCurrent":r=r.replace("%",b[a].chargeTemplate.toString());break;default:r=r.replace("%",String(a))}switch(typeof e){case"number":dt(r,JSON.stringify(+e));break;default:dt(r,JSON.stringify(e))}}function ft(t){dt("openWB/set/command/"+mt()+"/todo",JSON.stringify(t))}class Ba{constructor(){s(this,"batterySoc",0);s(this,"isBatteryConfigured",!0);s(this,"chargeMode","0");s(this,"_pvBatteryPriority","ev_mode");s(this,"displayLiveGraph",!0);s(this,"isEtEnabled",!0);s(this,"etMaxPrice",0);s(this,"etCurrentPrice",0);s(this,"cpDailyExported",0);s(this,"evuId",0);s(this,"etProvider","");s(this,"ipAddress","");s(this,"systemTime","");s(this,"version","");s(this,"versionDetails","");s(this,"devBranch","")}get pvBatteryPriority(){return this._pvBatteryPriority}set pvBatteryPriority(e){this._pvBatteryPriority=e,Y("pvBatteryPriority",e)}updatePvBatteryPriority(e){this._pvBatteryPriority=e}}const Ta=[["EV","ev_mode"],["Speicher","bat_mode"],["MinSoc","min_soc_bat_mode"]],K=F({evuIn:{name:"Netz",color:"var(--color-evu)",icon:""},pv:{name:"PV",color:"var(--color-pv",icon:""},batOut:{name:"Bat >",color:"var(--color-battery)",icon:""},evuOut:{name:"Export",color:"var(--color-export)",icon:""},charging:{name:"Laden",color:"var(--color-charging)",icon:""},devices:{name:"Geräte",color:"var(--color-devices)",icon:""},batIn:{name:"> Bat",color:"var(--color-battery)",icon:""},house:{name:"Haus",color:"var(--color-house)",icon:""},cp1:{name:"Ladepunkt",color:"var(--color-cp1)",icon:"Ladepunkt"},cp2:{name:"Ladepunkt",color:"var(--color-cp2)",icon:"Ladepunkt"},cp3:{name:"Ladepunkt",color:"var(--color-cp3)",icon:"Ladepunkt"},cp4:{name:"Ladepunkt",color:"var(--color-cp4)",icon:"Ladepunkt"},cp5:{name:"Ladepunkt",color:"var(--color-cp5)",icon:"Ladepunkt"},cp6:{name:"Ladepunkt",color:"var(--color-cp6)",icon:"Ladepunkt"},cp7:{name:"Ladepunkt",color:"var(--color-cp7)",icon:"Ladepunkt"},cp8:{name:"Ladepunkt",color:"var(--color-cp8)",icon:"Ladepunkt"},sh1:{name:"Gerät",color:"var(--color-sh1)",icon:"Gerät"},sh2:{name:"Gerät",color:"var(--color-sh2)",icon:"Gerät"},sh3:{name:"Gerät",color:"var(--color-sh3)",icon:"Gerät"},sh4:{name:"Gerät",color:"var(--color-sh4)",icon:"Gerät"},sh5:{name:"Gerät",color:"var(--color-sh5)",icon:"Gerät"},sh6:{name:"Gerät",color:"var(--color-sh6)",icon:"Gerät"},sh7:{name:"Gerät",color:"var(--color-sh7)",icon:"Gerät"},sh8:{name:"Gerät",color:"var(--color-sh8)",icon:"Gerät"},sh9:{name:"Gerät",color:"var(--color-sh9)",icon:"Gerät"}});class zt{constructor(){s(this,"_items",{});this.addItem("evuIn"),this.addItem("pv"),this.addItem("batOut"),this.addItem("evuOut"),this.addItem("charging"),this.addItem("devices"),this.addItem("batIn"),this.addItem("house")}get items(){return this._items}keys(){return Object.keys(this._items)}values(){return Object.values(this._items)}addItem(e){this._items[e]=be(e)}setEnergy(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].energy=a}setEnergyPv(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].energyPv=a}setEnergyBat(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].energyBat=a}setPvPercentage(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].pvPercentage=a}calculateHouseEnergy(){this._items.house.energy=this._items.evuIn.energy+this._items.pv.energy+this._items.batOut.energy-this._items.evuOut.energy-this._items.batIn.energy-this._items.charging.energy-this._items.devices.energy}}let w=new zt;function vt(){w=new zt}const V=F({evuIn:be("evuIn"),pv:be("pv"),batOut:be("batOut")}),$=F({evuOut:be("evuOut"),charging:be("charging"),devices:be("devices"),batIn:be("batIn"),house:be("house")}),U=F(new Ba);Se("");const qe=Se(!1);function be(t){return{name:K[t]?K[t].name:"item",power:0,energy:0,energyPv:0,energyBat:0,pvPercentage:0,color:K[t]?K[t].color:"var(--color-charging)",icon:K[t]?K[t].icon:""}}const ee=F({active:!1,locked:!0,usePin:!1,code:"",timeout:60,localCpOnly:!1});function ht(){ee.usePin&&ee.locked?new At("#numberpad").toggle():(ee.locked=!1,setTimeout(()=>{ee.locked=!0},ee.timeout*1e3))}function Aa(t){return t==ee.code}function La(){$.house.power=$.house.power-$.devices.power}const xt=Se(new Date),Da={class:"scaled"},Ga=A({__name:"DisplayButton",props:{icon:{},bgcolor:{},color:{}},emits:["click"],setup(t,{emit:e}){const a=t,r=e;function o(){r("click",!0)}return(l,c)=>(g(),y("div",{style:te({"background-color":a.bgcolor?a.bgcolor:"var(--color-bg)",color:a.color?a.color:"var(--color-title)"}),class:"displaybutton rounded-pill",type:"button",onClick:o},[a.icon?(g(),y("span",{key:0,class:q(["fas me-2 scaled",a.icon])},null,2)):I("",!0),u("span",Da,[ue(l.$slots,"default",{},void 0,!0)])],4))}}),Z=(t,e)=>{const a=t.__vccOpts||t;for(const[r,o]of e)a[r]=o;return a},xe=Z(Ga,[["__scopeId","data-v-d2ce91a5"]]);class Va{constructor(e){s(this,"id");s(this,"name","Gerät");s(this,"power",0);s(this,"status","off");s(this,"energy",0);s(this,"runningTime",0);s(this,"configured",!1);s(this,"_showInGraph",!0);s(this,"color","white");s(this,"canSwitch",!1);s(this,"countAsHouse",!1);s(this,"energyPv",0);s(this,"energyBat",0);s(this,"pvPercentage",0);s(this,"tempConfigured",0);s(this,"temp",[300,300,300]);s(this,"on",!1);s(this,"isAutomatic",!0);s(this,"icon","");this.id=e}get showInGraph(){return this._showInGraph}set showInGraph(e){this._showInGraph=e,R()}setShowInGraph(e){this._showInGraph=e}}const L=F({});function Ut(t){t in L?console.info("Duplicate sh device message: "+t):(L[t]=new Va(t),L[t].color="var(--color-sh"+Object.values(L).length+")")}class Ea{constructor(){s(this,"graphToShow","powermeter");s(this,"cpToShow",0);s(this,"displayLocked",!0);s(this,"_showRelativeArcs",!1);s(this,"showTodayGraph",!0);s(this,"_graphPreference","live");s(this,"_usageStackOrder",0);s(this,"_displayMode","dark");s(this,"_showGrid",!1);s(this,"_smartHomeColors","normal");s(this,"_decimalPlaces",1);s(this,"_showQuickAccess",!0);s(this,"_simpleCpList",!1);s(this,"_shortCpList","no");s(this,"_showAnimations",!0);s(this,"_preferWideBoxes",!1);s(this,"_maxPower",4e3);s(this,"_fluidDisplay",!1);s(this,"_showClock","no");s(this,"_showButtonBar",!0);s(this,"_showCounters",!1);s(this,"_showVehicles",!1);s(this,"_showPrices",!1);s(this,"_debug",!1);s(this,"isEtEnabled",!1);s(this,"etPrice",20.5);s(this,"showRightButton",!0);s(this,"showLeftButton",!0);s(this,"animationDuration",300);s(this,"animationDelay",100);s(this,"zoomGraph",!1)}get showRelativeArcs(){return this._showRelativeArcs}set showRelativeArcs(e){this._showRelativeArcs=e,R()}setShowRelativeArcs(e){this._showRelativeArcs=e}get graphPreference(){return this._graphPreference}set graphPreference(e){this._graphPreference=e,R()}setGraphPreference(e){this._graphPreference=e}get usageStackOrder(){return this._usageStackOrder}set usageStackOrder(e){this._usageStackOrder=e,R()}setUsageStackOrder(e){this._usageStackOrder=e}get displayMode(){return this._displayMode}set displayMode(e){this._displayMode=e,za(e)}setDisplayMode(e){this._displayMode=e}get showGrid(){return this._showGrid}set showGrid(e){this._showGrid=e,R()}setShowGrid(e){this._showGrid=e}get decimalPlaces(){return this._decimalPlaces}set decimalPlaces(e){this._decimalPlaces=e,R()}setDecimalPlaces(e){this._decimalPlaces=e}get smartHomeColors(){return this._smartHomeColors}set smartHomeColors(e){this._smartHomeColors=e,Pt(e),R()}setSmartHomeColors(e){this._smartHomeColors=e,Pt(e)}get showQuickAccess(){return this._showQuickAccess}set showQuickAccess(e){this._showQuickAccess=e,R()}setShowQuickAccess(e){this._showQuickAccess=e}get simpleCpList(){return this._simpleCpList}set simpleCpList(e){this._simpleCpList=e,R()}setSimpleCpList(e){this._simpleCpList=e}get shortCpList(){return this._shortCpList}set shortCpList(e){this._shortCpList=e,R()}setShortCpList(e){this._shortCpList=e}get showAnimations(){return this._showAnimations}set showAnimations(e){this._showAnimations=e,R()}setShowAnimations(e){this._showAnimations=e}get preferWideBoxes(){return this._preferWideBoxes}set preferWideBoxes(e){this._preferWideBoxes=e,R()}setPreferWideBoxes(e){this._preferWideBoxes=e}get maxPower(){return this._maxPower}set maxPower(e){this._maxPower=e,R()}setMaxPower(e){this._maxPower=e}get fluidDisplay(){return this._fluidDisplay}set fluidDisplay(e){this._fluidDisplay=e,R()}setFluidDisplay(e){this._fluidDisplay=e}get showClock(){return this._showClock}set showClock(e){this._showClock=e,R()}setShowClock(e){this._showClock=e}get debug(){return this._debug}set debug(e){this._debug=e,R()}setDebug(e){this._debug=e}get showButtonBar(){return this._showButtonBar}set showButtonBar(e){this._showButtonBar=e,R()}setShowButtonBar(e){this._showButtonBar=e}get showCounters(){return this._showCounters}set showCounters(e){this._showCounters=e,R()}setShowCounters(e){this._showCounters=e}get showVehicles(){return this._showVehicles}set showVehicles(e){this._showVehicles=e,R()}setShowVehicles(e){this._showVehicles=e}get showPrices(){return this._showPrices}set showPrices(e){this._showPrices=e,R()}setShowPrices(e){this._showPrices=e}}const m=F(new Ea),Wa=992,pt=F({x:document.documentElement.clientWidth,y:document.documentElement.clientHeight});function Na(){pt.x=document.documentElement.clientWidth,pt.y=document.documentElement.clientHeight}const ja=p(()=>pt.x>=Wa),Te={stop:{mode:de.stop,name:"Stop",color:"var(--color-fg)",icon:"fa-power-off"},standby:{mode:de.standby,name:"Standby",color:"var(--color-axis",icon:"fa-pause"},pv_charging:{mode:de.pv_charging,name:"PV",color:"var(--color-pv",icon:"fa-solar-panel"},scheduled_charging:{mode:de.scheduled_charging,name:"Zielladen",color:"var(--color-battery)",icon:"fa-bullseye"},instant_charging:{mode:de.instant_charging,name:"Sofort",color:"var(--color-charging)",icon:"fa-bolt"}};function R(){Ua()}function za(t){const e=me("html");e.classed("theme-dark",t=="dark"),e.classed("theme-light",t=="light"),e.classed("theme-blue",t=="blue"),R()}function Pt(t){const e=me("html");e.classed("shcolors-normal",t=="normal"),e.classed("shcolors-standard",t=="standard"),e.classed("shcolors-advanced",t=="advanced")}function Ua(){const t={};t.hideSH=Object.values(L).filter(e=>!e.showInGraph).map(e=>e.id),t.showLG=m.graphPreference=="live",t.displayM=m.displayMode,t.stackO=m.usageStackOrder,t.showGr=m.showGrid,t.decimalP=m.decimalPlaces,t.smartHomeC=m.smartHomeColors,t.relPM=m.showRelativeArcs,t.maxPow=m.maxPower,t.showQA=m.showQuickAccess,t.simpleCP=m.simpleCpList,t.shortCP=m.shortCpList,t.animation=m.showAnimations,t.wideB=m.preferWideBoxes,t.fluidD=m.fluidDisplay,t.clock=m.showClock,t.showButtonBar=m.showButtonBar,t.showCounters=m.showCounters,t.showVehicles=m.showVehicles,t.showPrices=m.showPrices,t.debug=m.debug,document.cookie="openWBColorTheme="+JSON.stringify(t)+";max-age=16000000;samesite=strict"}const We=t=>(ke("data-v-126005ae"),t=t(),Me(),t),Fa={class:"navigation"},Ja={class:"graphbuttons"},Ra={class:"timedisplay"},Ha={class:"cpbuttons"},Ya=We(()=>u("span",{class:"fas fa-arrow-left px-2"},null,-1)),Qa=We(()=>u("span",{class:"fas fa-charging-station pe-2"},null,-1)),qa=We(()=>u("span",{class:"fas fa-lock px-4"},null,-1)),Xa=We(()=>u("span",{class:"fas fa-charging-station px-2"},null,-1)),Za=We(()=>u("span",{class:"fas fa-arrow-right pe-2"},null,-1)),Ka=A({__name:"NavigationBar",setup(t){let e;function a(){let d=Object.values(b).length;m.cpToShow=(m.cpToShow+1)%d}function r(){let d=Object.values(b).length;m.cpToShow=((m.cpToShow-1)%d+d)%d}function o(){m.graphToShow="powermeter"}function l(){m.graphToShow="powergraph"}function c(){m.graphToShow="energymeter"}return Ke(()=>{e=setInterval(()=>{xt.value=new Date},1e3)}),la(()=>{clearInterval(e)}),(d,h)=>(g(),y("div",Fa,[u("span",Ja,[u("span",Ra,B(n(va)(n(xt))),1),k(xe,{icon:"fa-chart-pie",onClick:o},{default:P(()=>[z("Leistung")]),_:1}),k(xe,{icon:"fa-chart-line",onClick:l},{default:P(()=>[z("Verlauf")]),_:1}),k(xe,{icon:"fa-chart-column",onClick:c},{default:P(()=>[z("Energie")]),_:1})]),k(xe,{icon:"fa-rectangle-list","data-bs-toggle":"modal","data-bs-target":"#statuspage"},{default:P(()=>[z("Status")]),_:1}),u("span",Ha,[k(xe,{color:"var(--color-cp0)",onClick:r},{default:P(()=>[Ya,Qa]),_:1}),k(xe,{bgcolor:n(ee).locked?"var(--color-evu)":"var(--color-pv)",onClick:n(ht)},{default:P(()=>[qa]),_:1},8,["bgcolor","onClick"]),k(xe,{color:"var(--color-cp0)",onClick:a},{default:P(()=>[Xa,Za]),_:1})])]))}}),er=Z(Ka,[["__scopeId","data-v-126005ae"]]),tr=["origin"],ar=A({__name:"PMSourceArc",props:{radius:{},cornerRadius:{},circleGapSize:{},emptyPower:{}},setup(t){const e=t,a=p(()=>{let r={name:"",power:e.emptyPower,energy:0,energyPv:0,energyBat:0,pvPercentage:0,color:"var(--color-bg)",icon:""},o=V;o["zz-empty"]=r;const l=Object.values(V).length-1,c=Lt().value(f=>f.power).startAngle(-Math.PI/2+e.circleGapSize).endAngle(Math.PI/2-e.circleGapSize).sort(null),d=Dt().innerRadius(e.radius/6*5).outerRadius(e.radius).cornerRadius(e.cornerRadius).padAngle(0),h=me("g#pmSourceArc");return h.selectAll("*").remove(),h.selectAll("sources").data(c(Object.values(o))).enter().append("path").attr("d",d).attr("fill",f=>f.data.color).attr("stroke",(f,v)=>v==l?f.data.power>0?"var(--color-scale)":"null":f.data.color),"pmSourceArc.vue"});return ua(()=>{let r=V.pv.power+V.evuIn.power+V.batOut.power;r>m.maxPower&&(m.maxPower=r)}),(r,o)=>(g(),y("g",{id:"pmSourceArc",origin:a.value},null,8,tr))}}),rr=["origin"],or=A({__name:"PMUsageArc",props:{radius:{},cornerRadius:{},circleGapSize:{},emptyPower:{}},setup(t){const e=t,a=p(()=>{let r={name:"",power:e.emptyPower,energy:0,energyPv:0,energyBat:0,pvPercentage:0,color:"var(--color-bg)",icon:""};const o=[$.evuOut,$.charging].concat(Object.values(L).filter(f=>f.configured&&!f.countAsHouse).sort((f,v)=>v.power-f.power)).concat([$.batIn,$.house]).concat(r),l=o.length-1,c=Lt().value(f=>f.power).startAngle(Math.PI*1.5-e.circleGapSize).endAngle(Math.PI/2+e.circleGapSize).sort(null),d=Dt().innerRadius(e.radius/6*5).outerRadius(e.radius).cornerRadius(e.cornerRadius),h=me("g#pmUsageArc");return h.selectAll("*").remove(),h.selectAll("consumers").data(c(o)).enter().append("path").attr("d",d).attr("fill",f=>f.data.color).attr("stroke",(f,v)=>v==l?f.data.power>0?"var(--color-scale)":"null":f.data.color),"pmUsageArc.vue"});return(r,o)=>(g(),y("g",{id:"pmUsageArc",origin:a.value},null,8,rr))}}),Ft=A({__name:"FormatWatt",props:{watt:{}},setup(t){const e=t,a=p(()=>Je(e.watt,m.decimalPlaces));return(r,o)=>B(a.value)}}),nr={key:0,id:"pmLabel"},sr=["x","y","fill","text-anchor"],ir=22,he=A({__name:"PMLabel",props:{x:{},y:{},data:{},props:{},anchor:{},labeltext:{},labelicon:{},labelcolor:{}},setup(t){const e=t,a=p(()=>e.labeltext?e.labeltext:e.props?e.props.icon+" ":e.labelicon?e.labelicon+" ":""),r=p(()=>e.labelcolor?e.labelcolor:e.props?e.props.color:""),o=p(()=>!e.data||e.data.power>0),l=p(()=>e.labeltext?"":"fas");return(c,d)=>o.value?(g(),y("g",nr,[u("text",{x:c.x,y:c.y,fill:r.value,"text-anchor":c.anchor,"font-size":ir,class:"pmLabel"},[u("tspan",{class:q(l.value)},B(a.value),3),u("tspan",null,[c.data!==void 0?(g(),E(Ft,{key:0,watt:c.data.power},null,8,["watt"])):I("",!0)])],8,sr)])):I("",!0)}}),cr={class:"wb-widget p-0 m-0 shadow"},lr={class:"d-flex justify-content-between"},ur={class:"m-4 me-0 mb-0"},dr=u("div",{class:"p-0"},"(title goes here)",-1),hr={class:"p-4 pb-0 ps-0 m-0",style:{"text-align":"right"}},pr={class:"px-4 pt-4 pb-2 wb-subwidget"},gr={class:"row"},mr={class:"col m-0 p-0"},fr={class:"container-fluid m-0 p-0"},vr={key:0},_r=u("hr",null,null,-1),yr={class:"px-4 py-2 wb-subwidget"},br={class:"row"},wr={class:"col"},Sr={class:"container-fluid m-0 p-0"},et=A({__name:"WBWidget",props:{variableWidth:{type:Boolean},fullWidth:{type:Boolean}},setup(t){const e=t,a=p(()=>e.fullWidth?"col-12":e.variableWidth&&m.preferWideBoxes?"col-lg-6":"col-lg-4");return(r,o)=>(g(),y("div",{class:q(["p-2 m-0 d-flex",a.value])},[u("div",cr,[u("div",lr,[u("h3",ur,[ue(r.$slots,"title",{},()=>[dr]),ue(r.$slots,"subtitle")]),u("div",hr,[ue(r.$slots,"buttons")])]),u("div",pr,[u("div",gr,[u("div",mr,[u("div",fr,[ue(r.$slots,"default")])])])]),r.$slots.footer!=null?(g(),y("div",vr,[_r,u("div",yr,[u("div",br,[u("div",wr,[u("div",Sr,[ue(r.$slots,"footer")])])])])])):I("",!0)])],2))}});class kr{constructor(){s(this,"active",!1);s(this,"etPriceList",new Map);s(this,"etProvider","");s(this,"etMaxPrice",0)}get etCurrentPriceString(){const[e]=ae.etPriceList.values();return(Math.round(e*10)/10).toFixed(1)+" ct"}}const ae=F(new kr),Mr={id:"powermeter",class:"p-0 m-0"},xr=["viewBox"],Pr=["transform"],Ir={transform:"scale(0.9294,1)"},$r=["x"],ve=500,_e=20,It=1,Cr=A({__name:"PowerMeter",setup(t){const e=ve,a=Math.PI/40,r=[[4],[4,6],[1,4,6],[0,2,4,6],[0,2,3,5,6]],o=[{x:-85,y:e/2*1/5},{x:0,y:e/2*1/5},{x:85,y:e/2*1/5},{x:-85,y:e/2*2/5},{x:0,y:e/2*2/5},{x:85,y:e/2*2/5},{x:0,y:e/2*3/5}],l=p(()=>ve/2-_e),c=p(()=>{let S="",j=Object.values(V).filter(W=>W.power>0);return j.length==1&&j[0].name=="PV"?S="Aktueller Verbrauch: ":S="Bezug/Verbrauch: ",S+Je($.house.power+$.charging.power+$.devices.power+$.batIn.power,m.decimalPlaces)}),d=p(()=>{let S=V.pv.power+V.evuIn.power+V.batOut.power;return m.maxPower>S?Je(m.maxPower,m.decimalPlaces):Je(S,m.decimalPlaces)}),h=p(()=>Object.values(b)),f=p(()=>{let S=0;return m.showRelativeArcs&&(S=m.maxPower-(V.pv.power+V.evuIn.power+V.batOut.power)),S<0?0:S}),v=p(()=>[$.evuOut,$.charging,$.devices,$.batIn,$.house].filter(S=>S.power>0)),O=p(()=>r[v.value.length-1]);function M(S){return o[O.value[S]]}function H(S){return Math.round(h.value[S].soc)}function se(S){return S.length>12?S.slice(0,11)+".":S}const fe=p(()=>{const[S]=ae.etPriceList.values();return Math.round(S*10)/10});return(S,j)=>(g(),E(et,{"full-width":!0},{title:P(()=>[z(" Aktuelle Leistung ")]),default:P(()=>[u("figure",Mr,[(g(),y("svg",{viewBox:"0 0 "+ve+" "+n(e)},[u("g",{transform:"translate("+ve/2+","+n(e)/2+")"},[u("g",Ir,[k(ar,{radius:l.value,"corner-radius":It,"circle-gap-size":a,"empty-power":f.value},null,8,["radius","empty-power"]),k(or,{"sh-device":n(L),radius:l.value,"corner-radius":It,"circle-gap-size":a,"empty-power":f.value},null,8,["sh-device","radius","empty-power"]),k(he,{x:0,y:-n(e)/10*2,data:n(V).pv,props:n(K).pv,anchor:"middle",config:n(m)},null,8,["y","data","props","config"]),k(he,{x:0,y:-n(e)/10*3,data:n(V).evuIn,props:n(K).evuIn,anchor:"middle",config:n(m)},null,8,["y","data","props","config"]),k(he,{x:0,y:-n(e)/10,data:n(V).batOut,props:n(K).batOut,anchor:"middle",config:n(m)},null,8,["y","data","props","config"]),n(ae).active?(g(),E(he,{key:0,x:0,y:-n(e)/10,data:n(V).batOut,props:n(K).batOut,anchor:"middle",config:n(m)},null,8,["y","data","props","config"])):I("",!0),(g(!0),y(Ie,null,Be(v.value,(W,C)=>(g(),E(he,{key:C,x:M(C).x,y:M(C).y,data:W,labelicon:W.icon,labelcolor:W.color,anchor:"middle",config:n(m)},null,8,["x","y","data","labelicon","labelcolor","config"]))),128)),h.value.length>0&&n(N)[h.value[0].connectedVehicle]?(g(),E(he,{key:1,x:-ve/2-_e/4+10,y:-n(e)/2+_e+5,labeltext:se(n(N)[h.value[0].connectedVehicle].name)+": "+H(0)+"%",labelcolor:h.value[0].color,anchor:"start",config:n(m)},null,8,["x","y","labeltext","labelcolor","config"])):I("",!0),h.value.length>1&&n(N)[h.value[1].connectedVehicle]?(g(),E(he,{key:2,x:ve/2+_e/4-10,y:-n(e)/2+_e+5,labeltext:se(n(N)[h.value[1].connectedVehicle].name)+": "+H(1)+"%",labelcolor:h.value[1].color,anchor:"end",config:n(m)},null,8,["x","y","labeltext","labelcolor","config"])):I("",!0),n(U).batterySoc>0?(g(),E(he,{key:3,x:-ve/2-_e/4+10,y:n(e)/2-_e+15,labeltext:"Speicher: "+n(U).batterySoc+"%",labelcolor:n($).batIn.color,anchor:"start",config:n(m)},null,8,["x","y","labeltext","labelcolor","config"])):I("",!0),n(ae).active?(g(),E(he,{key:4,x:ve/2+_e/4-10,y:n(e)/2-_e+15,value:fe.value,labeltext:n(ae).etCurrentPriceString,labelcolor:"var(--color-charging)",anchor:"end",config:n(m)},null,8,["x","y","value","labeltext","config"])):I("",!0),k(he,{x:0,y:0,labeltext:c.value,labelcolor:"var(--color-fg)",anchor:"middle",config:n(m)},null,8,["labeltext","config"]),n(m).showRelativeArcs?(g(),y("text",{key:5,x:ve/2-44,y:"2","text-anchor":"middle",fill:"var(--color-axis)","font-size":"12"}," Peak: "+B(d.value),9,$r)):I("",!0)])],8,Pr)],8,xr))])]),_:1}))}}),pe=500,ye=500,T={top:10,right:20,bottom:10,left:25},_t=["charging","house","batIn","devices"];class Or{constructor(){s(this,"data",[]);s(this,"_graphMode","")}get graphMode(){return this._graphMode}set graphMode(e){this._graphMode=e}}const i=F(new Or);let Xe=!0,Ve=!0;function $t(){Xe=!1}function Ct(){Ve=!1}function Br(t){Ve=t}function Ne(t){i.data=t}const Q=F({refreshTopicPrefix:"openWB/graph/alllivevaluesJson",updateTopic:"openWB/graph/lastlivevaluesJson",configTopic:"openWB/graph/config/#",initialized:!1,initCounter:0,graphRefreshCounter:0,rawDataPacks:[],duration:0,activate(){i.data=[],this.unsubscribeUpdates(),this.subscribeRefresh(),$e(this.configTopic),this.initialized=!1,this.initCounter=0,this.graphRefreshCounter=0,this.rawDataPacks=[],Gr(),qe.value=!0},deactivate(){this.unsubscribeRefresh(),this.unsubscribeUpdates(),Oe(this.configTopic)},subscribeRefresh(){for(let t=1;t<17;t++)$e(this.refreshTopicPrefix+t)},unsubscribeRefresh(){for(let t=1;t<17;t++)Oe(this.refreshTopicPrefix+t)},subscribeUpdates(){$e(this.updateTopic)},unsubscribeUpdates(){Oe(this.updateTopic)}}),J=F({topic:"openWB/log/daily/#",date:new Date,activate(){if(i.graphMode=="day"||i.graphMode=="today"){i.graphMode=="today"&&(this.date=new Date);const t=this.date.getFullYear().toString()+(this.date.getMonth()+1).toString().padStart(2,"0")+this.date.getDate().toString().padStart(2,"0");$e(this.topic),ft({command:"getDailyLog",data:{day:t}})}},deactivate(){Oe(this.topic)},back(){this.date=new Date(this.date.setTime(this.date.getTime()-864e5))},forward(){this.date=new Date(this.date.setTime(this.date.getTime()+864e5))},setDate(t){this.date=t},getDate(){return this.date}}),we=F({topic:"openWB/log/monthly/#",month:new Date().getMonth()+1,year:new Date().getFullYear(),activate(){const t=this.year.toString()+this.month.toString().padStart(2,"0");i.data=[],$e(this.topic),ft({command:"getMonthlyLog",data:{month:t}})},deactivate(){Oe(this.topic)},back(){this.month-=1,this.month<1&&(this.month=12,this.year-=1),this.activate()},forward(){const t=new Date;t.getFullYear()==this.year?this.month-112&&(this.month=1,this.year+=1)),this.activate()},getDate(){return new Date(this.year,this.month)}}),Pe=F({topic:"openWB/log/yearly/#",month:new Date().getMonth()+1,year:new Date().getFullYear(),activate(){const t=this.year.toString();i.data=[],$e(this.topic),ft({command:"getYearlyLog",data:{year:t}})},deactivate(){Oe(this.topic)},back(){this.year-=1,this.activate()},forward(){this.year0&&(w.items[t].energyPv+=1e3/12*(e[t]*(e.pv-e.evuOut))/(e.pv-e.evuOut+e.evuIn+e.batOut),w.items[t].energyBat+=1e3/12*(e[t]*e.batOut)/(e.pv-e.evuOut+e.evuIn+e.batOut))}function Lr(t,e){e[t]>0&&(w.items[t].energyPv+=1e3*(e[t]*(e.pv-e.evuOut))/(e.pv-e.evuOut+e.evuIn+e.batOut),w.items[t].energyBat+=1e3*(e[t]*e.batOut)/(e.pv-e.evuOut+e.evuIn+e.batOut))}const Dr=["evuIn","pv","batIn","evuOut"],De=Se(!1);function yt(t,e){Object.entries(t).length>0?(De.value=!1,Object.entries(t.counter).forEach(([a,r])=>{(e.length==0||e.includes(a))&&(w.items.evuIn.energy+=r.energy_imported,w.items.evuOut.energy+=r.energy_exported)}),w.items.pv.energy=t.pv.all.energy_exported,t.bat.all&&(w.items.batIn.energy=t.bat.all.energy_imported,w.items.batOut.energy=t.bat.all.energy_exported),Object.entries(t.cp).forEach(([a,r])=>{a=="all"?w.setEnergy("charging",r.energy_imported):w.setEnergy(a,r.energy_imported)}),w.setEnergy("devices",0),Object.entries(t.sh).forEach(([a,r])=>{w.setEnergy(a,r.energy_imported);const o=a.substring(2);L[+o].countAsHouse||(w.items.devices.energy+=r.energy_imported)}),t.hc&&t.hc.all?w.setEnergy("house",t.hc.all.energy_imported):w.calculateHouseEnergy(),w.keys().map(a=>{Dr.includes(a)||(w.setPvPercentage(a,Math.round((w.items[a].energyPv+w.items[a].energyBat)/w.items[a].energy*100)),_t.includes(a)&&($[a].energy=w.items[a].energy,$[a].energyPv=w.items[a].energyPv,$[a].energyBat=w.items[a].energyBat,$[a].pvPercentage=w.items[a].pvPercentage))}),i.graphMode=="today"&&(Object.values(b).map(a=>{const r=w.items["cp"+a.id];r&&(a.energyPv=r.energyPv,a.energyBat=r.energyBat,a.pvPercentage=r.pvPercentage)}),Object.values(L).map(a=>{const r=w.items["sh"+a.id];r&&(a.energy=r.energy,a.energyPv=r.energyPv,a.energyBat=r.energyBat,a.pvPercentage=r.pvPercentage)}))):De.value=!0,qe.value=!0}function Gr(){w.keys().map(t=>{_t.includes(t)&&($[t].energy=w.items[t].energy,$[t].energyPv=0,$[t].energyBat=0,$[t].pvPercentage=0)}),Object.values(b).map(t=>{t.energyPv=0,t.energyBat=0,t.pvPercentage=0}),Object.values(L).map(t=>{t.energyPv=0,t.energyBat=0,t.pvPercentage=0})}const ge=p(()=>{const t=Ee(i.data,e=>e.date);return t[1]?ut().domain(Array.from({length:t[1]},(e,a)=>a+1)).paddingInner(.4).range([0,pe-T.left-2]):ut().range([0,0])});function bt(){switch(i.graphMode){case"live":i.graphMode="today",m.showRightButton=!0,X();break;case"today":i.graphMode="day",J.date=new Date,J.back(),X();break;case"day":J.back(),X();break;case"month":we.back();break;case"year":Pe.back();break}}function Jt(){const t=new Date;switch(i.graphMode){case"live":break;case"today":i.graphMode="live",m.showRightButton=!1,X();break;case"day":J.forward(),J.date.getDate()==t.getDate()&&J.date.getMonth()==t.getMonth()&&J.date.getFullYear()==t.getFullYear()&&(i.graphMode="today"),X();break;case"month":we.forward();break;case"year":Pe.forward();break}}function Rt(){switch(i.graphMode){case"live":bt();break;case"day":case"today":i.graphMode="month",X();break;case"month":i.graphMode="year",X();break}}function Ht(){switch(i.graphMode){case"year":i.graphMode="month",X();break;case"month":i.graphMode="today",X();break;case"today":case"day":i.graphMode="live",X();break}}function Vr(t){if(i.graphMode=="day"||i.graphMode=="today"){J.setDate(t);const e=new Date;J.date.getDate()==e.getDate()&&J.date.getMonth()==e.getMonth()&&J.date.getFullYear()==e.getFullYear()?i.graphMode="today":i.graphMode="day",X()}}const Er=["origin","transform"],Wr=A({__name:"PGSourceGraph",props:{width:{},height:{},margin:{}},setup(t){const e=t,a={house:"var(--color-house)",batIn:"var(--color-battery)",inverter:"var(--color-pv)",batOut:"var(--color-battery)",selfUsage:"var(--color-pv)",evuOut:"var(--color-export)",evuIn:"var(--color-evu)"};var r,o;const l=m.showAnimations?m.animationDuration:0,c=m.showAnimations?m.animationDelay:0,d=p(()=>{const _=me("g#pgSourceGraph");i.graphMode=="month"||i.graphMode=="year"?C(_):W(_),_.selectAll(".axis").remove();const x=_.append("g").attr("class","axis");return x.call(fe.value),x.selectAll(".tick").attr("font-size",12),x.selectAll(".tick line").attr("stroke",j.value).attr("stroke-width",S.value),x.select(".domain").attr("stroke","var(--color-bg)"),"pgSourceGraph.vue"}),h=p(()=>i.graphMode=="month"||i.graphMode=="year"?["evuIn","batOut","selfUsage","evuOut"]:["selfUsage","evuOut","batOut","evuIn"]),f=p(()=>Ce().domain([0,i.data.length-1]).range([0,e.width])),v=p(()=>Gt().keys(h.value)),O=p(()=>v.value(i.data)),M=p(()=>Ce().range([e.height-10,0]).domain(i.graphMode=="year"?[0,Math.ceil(H.value[1]*10)/10]:[0,Math.ceil(H.value[1])])),H=p(()=>{let _=Ee(i.data,x=>Math.max(x.pv+x.evuIn+x.batOut,x.selfUsage+x.evuOut));return _[0]!=null&&_[1]!=null?(i.graphMode=="year"&&(_[0]=_[0]/1e3,_[1]=_[1]/1e3),_):[0,0]}),se=p(()=>i.graphMode=="month"||i.graphMode=="year"?-e.width-e.margin.right-22:-e.width),fe=p(()=>gt(M.value).tickSizeInner(se.value).ticks(4).tickFormat(_=>(_==0?"":Math.round(_*10)/10).toLocaleString(void 0))),S=p(()=>m.showGrid?"0.5":"1"),j=p(()=>m.showGrid?"var(--color-grid)":"var(--color-bg)");function W(_){const x=Re().x((G,le)=>f.value(le)).y(M.value(0)),D=Re().x((G,le)=>f.value(le)).y0(G=>M.value(i.graphMode=="year"?G[0]/1e3:G[0])).y1(G=>M.value(i.graphMode=="year"?G[1]/1e3:G[1]));Xe?(_.selectAll("*").remove(),r=_.selectAll(".sourceareas").data(O.value).enter().append("path").attr("fill",(G,le)=>a[h.value[le]]).attr("d",G=>x(G)),r.transition().duration(l).delay(c).ease(Le).attr("d",G=>D(G)),$t()):r.data(O.value).transition().duration(0).ease(Le).attr("d",G=>D(G))}function C(_){Xe?(_.selectAll("*").remove(),o=_.selectAll(".sourcebar").data(O.value).enter().append("g").attr("fill",(x,D)=>a[h.value[D]]).selectAll("rect").data(x=>x).enter().append("rect").attr("x",(x,D)=>ge.value(i.data[D].date)??0).attr("y",()=>M.value(0)).attr("height",0).attr("width",ge.value.bandwidth()),o.transition().duration(l).delay(c).ease(Le).attr("height",x=>i.graphMode=="year"?M.value(x[0]/1e3)-M.value(x[1]/1e3):M.value(x[0])-M.value(x[1])).attr("y",x=>i.graphMode=="year"?M.value(x[1]/1e3):M.value(x[1])),$t()):(_.selectAll("*").remove(),o=_.selectAll(".sourcebar").data(O.value).enter().append("g").attr("fill",(x,D)=>a[h.value[D]]).selectAll("rect").data(x=>x).enter().append("rect").attr("x",(x,D)=>ge.value(i.data[D].date)??0).attr("y",x=>i.graphMode=="year"?M.value(x[1]/1e3):M.value(x[1])).attr("width",ge.value.bandwidth()).attr("height",x=>i.graphMode=="year"?M.value(x[0]/1e3)-M.value(x[1]/1e3):M.value(x[0])-M.value(x[1])))}return(_,x)=>(g(),y("g",{id:"pgSourceGraph",origin:d.value,transform:"translate("+_.margin.left+","+_.margin.top+")"},null,8,Er))}}),Nr=["origin","transform"],jr=A({__name:"PGUsageGraph",props:{width:{},height:{},margin:{},stackOrder:{}},setup(t){const e=t,a=[["house","charging","devices","batIn"],["charging","devices","house","batIn"],["devices","charging","house","batIn"]],r={house:"var(--color-house)",charging:"var(--color-charging)",batIn:"var(--color-battery)",batOut:"var(--color-battery)",selfUsage:"var(--color-pv)",evuOut:"var(--color-export)",evuIn:"var(--color-evu)",cp0:"var(--color-cp0)",cp1:"var(--color-cp1)",cp2:"var(--color-cp2)",cp3:"var(--color-cp3)",sh1:"var(--color-sh1)",sh2:"var(--color-sh2)",sh3:"var(--color-sh3)",sh4:"var(--color-sh4)",devices:"var(--color-devices)"};var o,l;const c=m.showAnimations?m.animationDuration:0,d=m.showAnimations?m.animationDelay:0,h=p(()=>{const C=me("g#pgUsageGraph");i.graphMode=="month"||i.graphMode=="year"?W(C):j(C),C.selectAll(".axis").remove();const _=C.append("g").attr("class","axis");return _.call(S.value),_.selectAll(".tick").attr("font-size",12).attr("color","var(--color-axis)"),m.showGrid?_.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"):_.selectAll(".tick line").attr("stroke","var(--color-bg)"),_.select(".domain").attr("stroke","var(--color-bg)"),"pgUsageGraph.vue"}),f=p(()=>Gt().keys(H.value)),v=p(()=>f.value(i.data)),O=p(()=>Ce().domain([0,i.data.length-1]).range([0,e.width])),M=p(()=>Ce().range([e.height+10,2*e.height]).domain(i.graphMode=="year"?[0,Math.ceil(se.value[1]*10)/10]:[0,Math.ceil(se.value[1])])),H=p(()=>{if(i.graphMode!="today"&&i.graphMode!="day")return a[e.stackOrder];{const C=a[e.stackOrder].slice(),_=C.indexOf("charging");C.splice(_,1);const x=/cp\d+/;let D=[];return i.data.length>0&&(D=Object.keys(i.data[0]).reduce((G,le)=>(le.match(x)&&G.push(le),G),[])),D.map((G,le)=>{C.splice(_+le,0,G),r[G]="var(--color-cp"+le+")"}),C}}),se=p(()=>{let C=Ee(i.data,_=>_.house+_.charging+_.batIn+_.devices);return C[0]!=null&&C[1]!=null?(i.graphMode=="year"&&(C[0]=C[0]/1e3,C[1]=C[1]/1e3),C):[0,0]}),fe=p(()=>i.graphMode=="month"||i.graphMode=="year"?-e.width-e.margin.right-22:-e.width),S=p(()=>gt(M.value).tickSizeInner(fe.value).ticks(4).tickFormat(C=>(C==0?"":Math.round(C*10)/10).toLocaleString(void 0)));function j(C){const _=Re().x((D,G)=>O.value(G)).y(M.value(0)),x=Re().x((D,G)=>O.value(G)).y0(D=>M.value(D[0])).y1(D=>M.value(D[1]));m.showAnimations?Ve?(C.selectAll("*").remove(),o=C.selectAll(".usageareas").data(v.value).enter().append("path").attr("d",D=>_(D)).attr("fill",(D,G)=>r[H.value[G]]),o.transition().duration(300).delay(100).ease(Le).attr("d",D=>x(D)),Ct()):(C.selectAll("*").remove(),C.selectAll(".usageareas").data(v.value).enter().append("path").attr("d",D=>x(D)).attr("fill",(D,G)=>r[H.value[G]])):(C.selectAll("*").remove(),C.selectAll(".usageareas").data(v.value).enter().append("path").attr("d",D=>x(D)).attr("fill",(D,G)=>r[H.value[G]]))}function W(C){Ve?(C.selectAll("*").remove(),l=C.selectAll(".usagebar").data(v.value).enter().append("g").attr("fill",(_,x)=>r[a[e.stackOrder][x]]).selectAll("rect").data(_=>_).enter().append("rect").attr("x",(_,x)=>ge.value(i.data[x].date)??0).attr("y",()=>M.value(0)).attr("height",0).attr("width",ge.value.bandwidth()),l.transition().duration(c).delay(d).ease(Le).attr("y",_=>i.graphMode=="year"?M.value(_[0]/1e3):M.value(_[0])).attr("height",_=>i.graphMode=="year"?M.value(_[1]/1e3)-M.value(_[0]/1e3):M.value(_[1])-M.value(_[0])),Ct()):(C.selectAll("*").remove(),l=C.selectAll(".usagebar").data(v.value).enter().append("g").attr("fill",(_,x)=>r[a[e.stackOrder][x]]).selectAll("rect").data(_=>_).enter().append("rect").attr("x",(_,x)=>ge.value(i.data[x].date)??0).attr("y",_=>i.graphMode=="year"?M.value(_[0]/1e3):M.value(_[0])).attr("height",_=>i.graphMode=="year"?M.value(_[1]/1e3)-M.value(_[0]/1e3):M.value(_[1])-M.value(_[0])).attr("width",ge.value.bandwidth()))}return(C,_)=>(g(),y("g",{id:"pgUsageGraph",origin:h.value,transform:"translate("+C.margin.left+","+C.margin.top+")"},null,8,Nr))}}),zr=["transform"],Ur=["origin","transform"],Fr=["origin","transform"],Jr={key:0},Rr=["width","height"],Hr={key:1},Yr=["y","width","height"],nt=12,Qr=A({__name:"PGXAxis",props:{width:{},height:{},margin:{}},setup(t){const e=t,a=p(()=>tt(d.value).ticks(4).tickSizeInner(c.value).tickFormat(kt("%H:%M"))),r=p(()=>da(d.value).ticks(4).tickSizeInner(c.value+3).tickFormat(kt(""))),o=p(()=>tt(ge.value).ticks(4).tickSizeInner(c.value).tickFormat(v=>v.toString())),l=p(()=>tt(ge.value).ticks(4).tickSizeInner(c.value).tickFormat(()=>"")),c=p(()=>i.graphMode!=="month"&&i.graphMode!=="year"?m.showGrid?-(e.height/2-7):-10:0),d=p(()=>{let v=Ee(i.data,O=>O.date);return v[0]&&v[1]?He().domain(v).range([0,e.width]):He().range([0,0])}),h=p(()=>{let v=me("g#PGXAxis");return v.selectAll("*").remove(),i.graphMode=="month"||i.graphMode=="year"?v.call(o.value):v.call(a.value),v.selectAll(".tick > text").attr("fill",(O,M)=>M>0||i.graphMode=="month"||i.graphMode=="year"?"var(--color-axis)":"var(--color-bg)").attr("font-size",nt),m.showGrid?v.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"):v.selectAll(".tick line").attr("stroke","var(--color-bg)"),v.select(".domain").attr("stroke","var(--color-bg)"),v.append("text").attr("x",-e.margin.left).attr("y",12).attr("fill","var(--color-axis)").attr("font-size",nt).text(i.graphMode=="year"?"MW":"kW").attr("text-anchor","start"),"PGXAxis.vue"}),f=p(()=>{let v=me("g#PGXAxis2");return v.selectAll("*").remove(),i.graphMode=="month"||i.graphMode=="year"?v.call(l.value):v.call(r.value),v.selectAll(".tick > text").attr("fill",(O,M)=>M>0||i.graphMode=="month"||i.graphMode=="year"?"var(--color-axis)":"var(--color-bg)").attr("font-size",nt),m.showGrid?(v.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"),v.select(".domain").attr("stroke","var(--color-bg)")):v.selectAll(".tick line").attr("stroke","var(--color-bg)"),v.select(".domain").attr("stroke","var(--color-bg)"),"PGXAxis2.vue"});return(v,O)=>(g(),y("g",{transform:"translate("+v.margin.left+","+v.margin.top+")"},[u("g",{id:"PGXAxis",class:"axis",origin:h.value,transform:"translate(0,"+(v.height/2-6)+")"},null,8,Ur),u("g",{id:"PGXAxis2",class:"axis",origin:f.value,transform:"translate(0,"+(v.height/2+10)+")"},null,8,Fr),n(m).showGrid?(g(),y("g",Jr,[u("rect",{x:"0",y:"0",width:v.width,height:v.height/2-10,fill:"none",stroke:"var(--color-grid)","stroke-width":"0.5"},null,8,Rr)])):I("",!0),n(m).showGrid?(g(),y("g",Hr,[u("rect",{x:"0",y:v.height/2+10,width:v.width,height:v.height/2-10,fill:"none",stroke:"var(--color-grid)","stroke-width":"0.5"},null,8,Yr)])):I("",!0)],8,zr))}}),qr=["d"],Xr=["d","stroke"],Zr=["x","y","text-anchor"],st=A({__name:"PgSoc",props:{width:{},height:{},margin:{},order:{}},setup(t){const e=t,a=p(()=>{let O=Ee(i.data,M=>M.date);return O[0]&&O[1]?He().domain(O).range([0,e.width]):He().range([0,0])}),r=p(()=>Ce().range([e.height-10,0]).domain([0,100])),o=p(()=>{let M=ha().x(H=>a.value(H.date)).y(H=>r.value(e.order==2?H.batSoc:H["soc"+h.value.connectedVehicle])??r.value(0))(i.data);return M||""}),l=p(()=>e.order==2?"Speicher":h.value.vehicleName),c=p(()=>{switch(e.order){case 0:return"var(--color-cp1)";case 1:return"var(--color-cp2)";case 2:return"var(--color-battery)";default:return"red"}}),d=p(()=>{switch(e.order){case 0:return e.width-3;case 1:return 3;case 2:return e.width/2;default:return 0}}),h=p(()=>{const O=e.order==2?0:e.order;return Object.values(b)[O]}),f=p(()=>{if(i.data.length>0){let O;switch(e.order){case 0:return O=i.data.length-1,r.value(i.data[O]["soc"+h.value.connectedVehicle]+2);case 1:return O=0,r.value(i.data[O]["soc"+h.value.connectedVehicle]+2);case 2:return O=Math.round(i.data.length/2),r.value(i.data[O].batSoc+2);default:return 0}}else return 0}),v=p(()=>{switch(e.order){case 0:return"end";case 1:return"start";case 2:return"middle";default:return"middle"}});return(O,M)=>(g(),y(Ie,null,[u("path",{class:"soc-baseline",d:o.value,stroke:"var(--color-bg)","stroke-width":"1",fill:"none"},null,8,qr),u("path",{class:"soc-dashes",d:o.value,stroke:c.value,"stroke-width":"1",style:{strokeDasharray:"3,3"},fill:"none"},null,8,Xr),u("text",{class:"cpname",x:d.value,y:f.value,style:te({fill:c.value,fontSize:10}),"text-anchor":v.value},B(l.value),13,Zr)],64))}}),Kr=["transform"],eo=A({__name:"PgSocAxis",props:{width:{},height:{},margin:{}},setup(t){const e=t,a=p(()=>Ce().range([e.height-10,0]).domain([0,100])),r=p(()=>pa(a.value).ticks(5).tickFormat(l=>l.toString()+"%"));function o(){let l=me("g#PGSocAxis");l.call(r.value),l.selectAll(".tick").attr("font-size",12),l.selectAll(".tick line").attr("stroke","var(--color-bg)"),l.select(".domain").attr("stroke","var(--color-bg)")}return Ke(()=>{o()}),(l,c)=>(g(),y("g",{id:"PGSocAxis",class:"axis",transform:"translate("+(l.width-20)+",0)"},null,8,Kr))}}),to={class:"btn-group m-0",role:"group","aria-label":"radiobar"},ao=["id","value"],ro=A({__name:"RadioBarInput",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=e,o=p({get(){return a.modelValue},set(d){r("update:modelValue",d)}});function l(d){let h=a.options[d].color?a.options[d].color:"var(--color-fg)";return a.options[d].active?{color:"var(--color-bg)",background:h}:{color:h}}function c(d){let h=d.target;for(;h&&!h.value&&h.parentElement;)h=h.parentElement;h.value&&(o.value=h.value)}return(d,h)=>(g(),y("div",null,[u("div",to,[(g(!0),y(Ie,null,Be(d.options,(f,v)=>(g(),y("button",{id:"radio-"+f.value,key:v,class:q(["btn btn-outline-secondary btn-sm radiobutton mx-0 mb-0 px-2",f.value==o.value?"active":""]),value:f.value,style:te(l(v)),onClick:c},[u("span",{style:te(l(v)),class:"scaled"},[f.icon?(g(),y("i",{key:0,class:q(["fa-solid",f.icon])},null,2)):I("",!0),z(" "+B(f.text),1)],4)],14,ao))),128))])]))}}),Yt=Z(ro,[["__scopeId","data-v-60f5d4c2"]]),wt=t=>(ke("data-v-7fd067cd"),t=t(),Me(),t),oo=wt(()=>u("i",{class:"fa-solid fa-xl fa-chevron-circle-up"},null,-1)),no=[oo],so=wt(()=>u("span",{class:"fa-solid fa-xl fa-chevron-circle-left arrowButton"},null,-1)),io=[so],co={key:0,class:"fa-solid fa-xl fa-chevron-circle-down p-1",style:{color:"var(--color-bg)"}},lo=wt(()=>u("span",{class:"fa-solid fa-xl fa-circle-check"},null,-1)),uo=[lo],ho=A({__name:"PgSelector",props:{widgetid:{},showLeftButton:{type:Boolean},showRightButton:{type:Boolean},ignoreLive:{type:Boolean}},emits:["shiftLeft","shiftRight","shiftUp","shiftDown"],setup(t){const e=t,a=Se(0),r=p(()=>{switch(i.graphMode){case"live":return e.ignoreLive?"heute":`${Q.duration} min`;case"today":return"heute";case"day":return J.date.getDate()+"."+(J.date.getMonth()+1)+".";case"month":return _a(we.month-1,we.year);case"year":return Pe.year.toString();default:return"???"}}),o=["live","today","day","month","year"],l=["Live","Heute","Tag","Monat","Jahr"],c=p({get(){return i.graphMode},set(S){switch(S){case"day":f();break;case"today":v();break;case"live":h();break;case"month":O();break;case"year":M()}}});function d(){a.value+=1,a.value>1&&(a.value=0)}function h(){i.graphMode!="live"&&(i.graphMode="live",X())}function f(){i.graphMode!="day"&&i.graphMode!="today"&&(i.graphMode="day",X())}function v(){i.graphMode!="today"&&(i.graphMode="today",Vr(new Date),X())}function O(){i.graphMode!="month"&&(i.graphMode="month",X())}function M(){i.graphMode!="year"&&(i.graphMode="year",X())}const H=p(()=>a.value>0?{border:"1px solid var(--color-frame)"}:""),se=p(()=>a.value==1?"justify-content-between":"justify-content-end"),fe=p(()=>a.value==1?"justify-content-between":"justify-content-center");return(S,j)=>(g(),y("div",{class:"d-flex flex-column justify-content-center pgselector rounded",style:te(H.value)},[a.value==2?(g(),E(Yt,{key:0,id:"pgm2",modelValue:c.value,"onUpdate:modelValue":j[0]||(j[0]=W=>c.value=W),class:"m-2",options:o.map((W,C)=>({text:l[C],value:W,color:"var(--color-menu)",active:W==n(i).graphMode}))},null,8,["modelValue","options"])):I("",!0),a.value==1?(g(),y("span",{key:1,type:"button",class:q(["arrowButton d-flex align-self-center mb-3 mt-3",{disabled:!e.showLeftButton}]),onClick:j[1]||(j[1]=W=>S.$emit("shiftUp"))},no,2)):I("",!0),u("div",{class:q(["d-flex align-items-center",fe.value])},[a.value==1?(g(),y("span",{key:0,type:"button",class:q(["p-1",{disabled:!e.showLeftButton}]),onClick:j[2]||(j[2]=W=>S.$emit("shiftLeft"))},io,2)):I("",!0),a.value<2?(g(),y("span",{key:1,type:"button",class:"btn-outline-secondary p-2 px-3 badge rounded-pill datebadge",onClick:d},B(r.value),1)):I("",!0),a.value==1?(g(),y("span",{key:2,id:"graphRightButton",type:"button",class:q(["arrowButton fa-solid fa-xl fa-chevron-circle-right p-1",{disabled:!e.showRightButton}]),onClick:j[3]||(j[3]=W=>S.$emit("shiftRight"))},null,2)):I("",!0)],2),u("div",{class:q(["d-flex align-items-center",se.value])},[a.value==1?(g(),y("span",co)):I("",!0),a.value==1?(g(),y("span",{key:1,id:"graphLeftButton",type:"button",class:q(["arrowButton fa-solid fa-xl fa-chevron-circle-down p-1",{disabled:!e.showLeftButton}]),onClick:j[4]||(j[4]=W=>S.$emit("shiftDown"))},null,2)):I("",!0),a.value>0?(g(),y("span",{key:2,type:"button",class:"p-1",onClick:j[5]||(j[5]=W=>a.value=0)},uo)):I("",!0)],2)],4))}}),Qt=Z(ho,[["__scopeId","data-v-7fd067cd"]]),qt=t=>(ke("data-v-bb5945e3"),t=t(),Me(),t),po={class:"d-flex justify-content-end"},go=qt(()=>u("span",{class:"fa-solid fa-lg ps-1 fa-magnifying-glass"},null,-1)),mo=[go],fo=["viewBox"],vo=["transform"],_o={id:"button"},yo=["x","y"],bo=qt(()=>u("tspan",{fill:"var(--color-menu)",class:"fas fa-lg"},B(""),-1)),wo=[bo],So=2,ko="Leistung / Ladestand ",Mo=A({__name:"PowerGraph",setup(t){function e(){let r=m.usageStackOrder+1;r>So&&(r=0),m.usageStackOrder=r,Br(!0)}function a(){m.zoomGraph=!m.zoomGraph}return(r,o)=>(g(),E(et,{"full-width":!0},{title:P(()=>[z(B(ko))]),buttons:P(()=>[u("div",po,[k(Qt,{widgetid:"graphsettings","show-left-button":!0,"show-right-button":!0,"ignore-live":!1,onShiftLeft:n(bt),onShiftRight:n(Jt),onShiftUp:n(Rt),onShiftDown:n(Ht)},null,8,["onShiftLeft","onShiftRight","onShiftUp","onShiftDown"]),n(ja)?(g(),y("span",{key:0,type:"button",class:"ms-1 p-0 pt-1",onClick:a},mo)):I("",!0)])]),default:P(()=>[u("figure",{id:"powergraph",class:"p-0 m-0",onClick:e},[(g(),y("svg",{viewBox:"0 0 "+n(pe)+" "+n(ye)},[k(Wr,{width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T)},null,8,["width","height","margin"]),k(jr,{width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),"stack-order":n(m).usageStackOrder},null,8,["width","height","margin","stack-order"]),k(Qr,{width:n(pe)-n(T).left-2*n(T).right,height:n(ye)-n(T).top-n(T).bottom,margin:n(T),"graph-data":n(i)},null,8,["width","height","margin","graph-data"]),u("g",{transform:"translate("+n(T).left+","+n(T).top+")"},[(n(i).graphMode=="day"||n(i).graphMode=="today"||n(i).graphMode=="live")&&Object.values(n(b)).length>0?(g(),E(st,{key:0,width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),order:0},null,8,["width","height","margin"])):I("",!0),(n(i).graphMode=="day"||n(i).graphMode=="today"||n(i).graphMode=="live")&&Object.values(n(b)).length>1?(g(),E(st,{key:1,width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),order:1},null,8,["width","height","margin"])):I("",!0),(n(i).graphMode=="day"||n(i).graphMode=="today")&&n(U).isBatteryConfigured?(g(),E(st,{key:2,width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),order:2},null,8,["width","height","margin"])):I("",!0),n(i).graphMode=="day"||n(i).graphMode=="today"?(g(),E(eo,{key:3,width:n(pe)-n(T).left-n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T)},null,8,["width","height","margin"])):I("",!0)],8,vo),u("g",_o,[u("text",{x:n(pe),y:n(ye)-10,color:"var(--color-menu)","text-anchor":"end"},wo,8,yo)])],8,fo))])]),_:1}))}}),xo=Z(Mo,[["__scopeId","data-v-bb5945e3"]]),Po=["id"],Io=["x","width","height","fill"],$o=["x","width","height"],Co=["x","y","width","height"],Oo=A({__name:"EmBar",props:{item:{},xScale:{},yScale:{},margin:{},height:{},barcount:{},autarchy:{},autText:{}},setup(t){const e=t,a=p(()=>e.height-e.yScale(e.item.energy)-e.margin.top-e.margin.bottom),r=p(()=>e.item.energyPv>0?e.height-e.yScale(e.item.energyPv)-e.margin.top-e.margin.bottom:0),o=p(()=>e.item.energyPv>0?e.height-e.yScale(e.item.energyBat)-e.margin.top-e.margin.bottom:0);return(l,c)=>(g(),y("g",{id:"bar-"+e.item.name,transform:"scale(1,-1) translate (0,-445)"},[u("rect",{class:"bar",x:e.xScale(l.item.name),y:"0",width:e.xScale.bandwidth(),height:a.value,fill:l.item.color},null,8,Io),u("rect",{class:"bar",x:e.xScale(l.item.name)+e.xScale.bandwidth()/6,y:"0",width:e.xScale.bandwidth()*2/3,height:r.value,fill:"var(--color-pv)","fill-opacity":"66%"},null,8,$o),u("rect",{class:"bar",x:e.xScale(l.item.name)+e.xScale.bandwidth()/6,y:r.value,width:e.xScale.bandwidth()*2/3,height:o.value,fill:"var(--color-battery)","fill-opacity":"66%"},null,8,Co)],8,Po))}}),Bo={id:"emBargraph"},To=u("animateTransform",{"attribute-name":"transform",type:"scale",from:"1 0",to:"1 1",begin:"0s",dur:"2s"},null,-1),Ao=A({__name:"EMBarGraph",props:{plotdata:{},xScale:{},yScale:{},margin:{},height:{}},setup(t){const e=t;function a(o){if(o.name=="PV"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,d=(i.graphMode=="live"||i.graphMode=="day"?$:w.items).evuOut.energy,h=l.pv.energy;return Math.round((h-d)/h*100)}else if(o.name=="Netz"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,c=i.graphMode=="live"||i.graphMode=="day"?$:w.items,d=c.evuOut.energy,h=l.evuIn.energy,f=l.pv.energy,v=l.batOut.energy,O=c.batIn.energy;return Math.round((f+v-d-O)/(f+v+h-d-O)*100)}else return o.pvPercentage}function r(o){return o.name=="PV"?"Eigen":"Aut"}return(o,l)=>(g(),y("g",Bo,[(g(!0),y(Ie,null,Be(e.plotdata,(c,d)=>(g(),y("g",{key:d},[k(Oo,{item:c,"x-scale":e.xScale,"y-scale":e.yScale,margin:e.margin,height:e.height,barcount:e.plotdata.length,"aut-text":r(c),autarchy:a(c)},null,8,["item","x-scale","y-scale","margin","height","barcount","aut-text","autarchy"])]))),128)),To]))}}),Lo=["origin"],Do=A({__name:"EMYAxis",props:{yScale:{type:[Function,Object]},width:{},fontsize:{}},setup(t){const e=t,a=p(()=>gt(e.yScale).tickFormat(o=>o>0?(o/1e3).toString():"").ticks(6).tickSizeInner(-e.width)),r=p(()=>{const o=me("g#emYAxis");return o.attr("class","axis").call(a.value),o.append("text").attr("y",6).attr("dy","0.71em").attr("text-anchor","end").text("energy"),o.selectAll(".tick").attr("font-size",e.fontsize),m.showGrid?o.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"):o.selectAll(".tick line").attr("stroke","var(--color-bg)"),o.select(".domain").attr("stroke","var(--color-bg)"),"emYAxis.vue"});return(o,l)=>(g(),y("g",{id:"emYAxis",class:"axis",origin:r.value},null,8,Lo))}}),Go=["id"],Vo=["x","y","font-size"],Eo=["x","y","font-size","fill"],Wo=["x","y","font-size","fill"],No=A({__name:"EmLabel",props:{item:{},xScale:{},yScale:{},margin:{},height:{},barcount:{},autarchy:{},autText:{}},setup(t){const e=t,a=p(()=>e.autarchy?e.yScale(e.item.energy)-25:e.yScale(e.item.energy)-10),r=p(()=>{let h=16,f=e.barcount;return f<=5?h=16:f==6?h=14:f>6&&f<=8?h=13:f==9?h=11:f==10?h=10:h=9,h}),o=p(()=>{let h=12,f=e.barcount;return f<=5?h=12:f==6?h=11:f>6&&f<=8||f==9?h=8:f==10?h=7:h=6,h});function l(h,f){return f.length>o.value?f.substring(0,o.value)+".":f}function c(){return e.autarchy?e.autText+": "+e.autarchy.toLocaleString(void 0)+" %":""}function d(){return"var(--color-pv)"}return(h,f)=>(g(),y("g",{id:"barlabel-"+e.item.name},[u("text",{x:e.xScale(h.item.name)+e.xScale.bandwidth()/2,y:a.value,"font-size":r.value,"text-anchor":"middle",fill:"var(--color-menu)"},B(n(Vt)(h.item.energy,n(m).decimalPlaces,!1)),9,Vo),u("text",{x:e.xScale(h.item.name)+e.xScale.bandwidth()/2,y:e.yScale(h.item.energy)-10,"font-size":r.value-2,"text-anchor":"middle",fill:d()},B(c()),9,Eo),u("text",{x:e.xScale(h.item.name)+e.xScale.bandwidth()/2,y:e.height-e.margin.bottom-5,"font-size":r.value,"text-anchor":"middle",fill:h.item.color,class:q(h.item.icon.length<=2?"fas":"")},B(l(h.item.name,h.item.icon)),11,Wo)],8,Go))}}),jo={id:"emBarLabels"},zo=A({__name:"EMLabels",props:{plotdata:{},xScale:{},yScale:{},height:{},margin:{}},setup(t){const e=t;function a(o){if(o.name=="PV"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,d=(i.graphMode=="live"||i.graphMode=="day"?$:w.items).evuOut.energy,h=l.pv.energy;return Math.round((h-d)/h*100)}else if(o.name=="Netz"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,c=i.graphMode=="live"||i.graphMode=="day"?$:w.items,d=c.evuOut.energy,h=l.evuIn.energy,f=l.pv.energy,v=l.batOut.energy,O=c.batIn.energy;return f+v-d-O>0?Math.round((f+v-d-O)/(f+v+h-d-O)*100):0}else return o.pvPercentage}function r(o){return o.name=="PV"?"Eigen":"Aut"}return(o,l)=>(g(),y("g",jo,[(g(!0),y(Ie,null,Be(e.plotdata,(c,d)=>(g(),y("g",{key:d},[k(No,{item:c,"x-scale":e.xScale,"y-scale":e.yScale,margin:e.margin,height:e.height,barcount:e.plotdata.length,"aut-text":r(c),autarchy:a(c)},null,8,["item","x-scale","y-scale","margin","height","barcount","aut-text","autarchy"])]))),128))]))}}),Uo={id:"energymeter",class:"p-0 m-0"},Fo={viewBox:"0 0 500 500"},Jo=["transform"],Ro=["x"],Ho={key:0},Ot=500,it=500,Bt=12,Yo="Energie",Qo=A({__name:"EnergyMeter",setup(t){const e={top:25,bottom:30,left:25,right:0},a=p(()=>{let c=Object.values(V),d=l.value,h=w.values(),f=[];switch(m.debug&&(console.debug("----------------------- source summary -----------------"),console.debug(V),console.debug("----------------------- usage details ------------------"),console.debug(l.value),console.debug("----------------------- historic summary ---------------"),console.debug(w),console.debug("--------------------------------------------------------")),qe.value==!0&&(qe.value=!1),i.graphMode){default:case"live":case"today":f=c.concat(d).filter(v=>v.energy>0);break;case"day":case"month":case"year":h.length==0?De.value=!0:(De.value=!1,f=h.filter(v=>v.energy>0))}return f}),r=p(()=>ut().range([0,Ot-e.left-e.right]).domain(a.value.map(c=>c.name)).padding(.4)),o=p(()=>Ce().range([it-e.bottom-e.top,15]).domain([0,ga(a.value,c=>c.energy)])),l=p(()=>{const c=Object.values(b).length,d=Object.values(L).filter(h=>h.configured).length;return[$.evuOut,$.devices,$.charging].concat(c>1?Object.values(b).map(h=>h.toPowerItem()):[]).concat(d>1?Object.values(L).filter(h=>h.configured&&h.showInGraph):[]).concat([$.batIn,$.house])});return(c,d)=>(g(),E(et,{"full-width":!0},{title:P(()=>[z(B(Yo))]),buttons:P(()=>[k(Qt,{widgetid:"graphsettings","show-left-button":!0,"show-right-button":!0,"ignore-live":!0,onShiftLeft:n(bt),onShiftRight:n(Jt),onShiftUp:n(Rt),onShiftDown:n(Ht)},null,8,["onShiftLeft","onShiftRight","onShiftUp","onShiftDown"])]),default:P(()=>[u("figure",Uo,[(g(),y("svg",Fo,[u("g",{transform:"translate("+e.left+","+e.top+")"},[k(Ao,{plotdata:a.value,"x-scale":r.value,"y-scale":o.value,height:it,margin:e},null,8,["plotdata","x-scale","y-scale"]),k(Do,{"y-scale":o.value,width:Ot,fontsize:Bt,config:n(m)},null,8,["y-scale","config"]),u("text",{x:-e.left,y:"-15",fill:"var(--color-axis)","font-size":Bt},B(n(i).graphMode=="year"?"MWh":"kWh"),9,Ro),k(zo,{plotdata:a.value,"x-scale":r.value,"y-scale":o.value,height:it,margin:e,config:n(m)},null,8,["plotdata","x-scale","y-scale","config"])],8,Jo)]))]),n(De)?(g(),y("p",Ho,"No data")):I("",!0)]),_:1}))}}),Xt=t=>(ke("data-v-07e94a61"),t=t(),Me(),t),qo=["id"],Xo={class:"modal-dialog modal-lg modal-fullscreen-sm-down"},Zo={class:"modal-content"},Ko={class:"modal-header"},en={class:"modal-title scaled"},tn=Xt(()=>u("button",{type:"button",class:"btn-close buttonTextSize d-flex justify-content-center pt-3 pb-0","data-bs-dismiss":"modal"},[u("i",{class:"fa-solid fa-lg fa-circle-check m-0 p-0"})],-1)),an={class:"modal-body",style:{"background-color":"var(--color-fg)"}},rn=Xt(()=>u("div",{class:"modal-footer"},null,-1)),on=A({__name:"ModalComponent",props:{modalId:{}},setup(t){const e=t;return Ke(()=>{}),(a,r)=>(g(),y("div",{id:e.modalId,class:"modal fade"},[u("div",Xo,[u("div",Zo,[u("div",Ko,[u("h3",en,[ue(a.$slots,"title",{},void 0,!0)]),tn]),u("div",an,[ue(a.$slots,"default",{},void 0,!0)]),rn])])],8,qo))}}),ct=Z(on,[["__scopeId","data-v-07e94a61"]]),nn={class:"digit scaled",type:"button"},sn=A({__name:"PadButton",props:{modelValue:{},color:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=Se(!1);function o(){r.value=!0,c("update:modelValue",a.modelValue),setTimeout(()=>{r.value=!1},300)}const l=p(()=>r.value?{"background-color":"white",color:"black"}:{"background-color":a.color??"var(--color-axis)"}),c=e;return(d,h)=>(g(),y("div",{class:"padbutton",style:te(l.value),onClick:o},[u("span",nn,[ue(d.$slots,"default",{},void 0,!0)])],4))}}),ze=Z(sn,[["__scopeId","data-v-29589225"]]),Zt=t=>(ke("data-v-47b8fdb7"),t=t(),Me(),t),cn={class:"numberpad"},ln={class:"codedisplay scaled"},un={class:"numberentry"},dn=Zt(()=>u("span",{class:"fas fa-delete-left"},null,-1)),hn=Zt(()=>u("span",{class:"fas fa-circle-check"},null,-1)),pn=A({__name:"NumberPad",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const r=Se(t.modelValue),o=e,l=p(()=>r.value.length==0?"Bitte geben Sie die PIN ein":"*".repeat(r.value.length));function c(d){d==-1?r.value=r.value.slice(0,-1):d==-2?(o("update:modelValue",r.value),r.value=""):r.value=r.value+d.toString()}return(d,h)=>(g(),y("div",cn,[u("p",ln,B(l.value),1),u("div",un,[(g(),y(Ie,null,Be(9,f=>k(ze,{key:f,"model-value":f,"onUpdate:modelValue":c},{default:P(()=>[z(B(f),1)]),_:2},1032,["model-value"])),64)),k(ze,{"model-value":0,"onUpdate:modelValue":c},{default:P(()=>[z("0")]),_:1}),k(ze,{"model-value":-1,color:"var(--color-devices)","onUpdate:modelValue":c},{default:P(()=>[dn]),_:1}),k(ze,{"model-value":-2,color:"var(--color-devices)","data-bs-dismiss":"modal","onUpdate:modelValue":c},{default:P(()=>[hn]),_:1})])]))}}),gn=Z(pn,[["__scopeId","data-v-47b8fdb7"]]),je=t=>(ke("data-v-ecac4e45"),t=t(),Me(),t),mn={class:"statustable"},fn=je(()=>u("span",{class:"header"},"IP-Adresse:",-1)),vn=je(()=>u("span",{class:"header"},"Systemzeit:",-1)),_n=je(()=>u("span",{class:"header"},"Version:",-1)),yn=je(()=>u("span",{class:"header"},"Version (Details):",-1)),bn=je(()=>u("span",{class:"header"},"Entwicklungszweig:",-1)),wn=A({__name:"StatusPage",setup(t){return(e,a)=>(g(),y("div",mn,[fn,u("span",null,B(n(U).ipAddress),1),vn,u("span",null,B(new Date(n(U).systemTime*1e3).toLocaleString(void 0)),1),_n,u("span",null,B(n(U).version),1),yn,u("span",null,B(n(U).versionDetails),1),bn,u("span",null,B(n(U).devBranch),1)]))}}),Sn=Z(wn,[["__scopeId","data-v-ecac4e45"]]),kn={class:"configitem subgrid"},Mn={class:"d-flex align-items-baseline m-0 p-0 grid-col-6 scaled"},xn={class:"ms-1 mb-2 p-0 pt-2 d-flex justify-content-stretch align-items-center grid-col-6"},Pn={class:"justify-content-stretch d-flex"},In=A({__name:"ConfigItem",props:{title:{},infotext:{},icon:{},iconcolor:{},fullwidth:{type:Boolean}},setup(t){const e=t;return(a,r)=>(g(),y("div",kn,[u("span",Mn,[e.icon?(g(),y("i",{key:0,class:q(["fa-solid fa-sm m-0 p-0 me-2 item-icon",e.icon]),style:te({color:e.iconcolor?e.iconcolor:"var(--color-charging)"})},null,6)):I("",!0),z(" "+B(a.title),1)]),u("div",xn,[u("span",Pn,[ue(a.$slots,"default",{},void 0,!0)])])]))}}),Ae=Z(In,[["__scopeId","data-v-73b192d9"]]),$n=["id","value"],Cn=A({__name:"RadioInput",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=e,o=p({get(){return a.modelValue},set(d){r("update:modelValue",d)}});function l(d){return a.options[d][2]?{color:a.options[d][2]}:{color:"var(--color-charging)"}}function c(d){let h=d.target;for(;h&&!h.value&&h.parentElement;)h=h.parentElement;h.value&&(o.value=h.value)}return(d,h)=>(g(),y("div",null,[(g(!0),y(Ie,null,Be(d.options,(f,v)=>(g(),y("button",{id:"radio-"+f[1],key:v,class:q(["btn btn-outline-secondary radiobutton me-2 mb-0 px-2",f[1]==o.value?"active":""]),value:f[1],style:te(l(v)),onClick:c},[u("span",{style:te(l(v)),class:"scaled"},[f[3]?(g(),y("i",{key:0,class:q(["fa-solid",f[3]])},null,2)):I("",!0),z(" "+B(f[0]),1)],4)],14,$n))),128))]))}}),lt=Z(Cn,[["__scopeId","data-v-18eb8489"]]),On={class:"form-check form-switch"},Tt=A({__name:"SwitchInput",props:{modelValue:{type:Boolean},onColor:{},offColor:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=e,o=p({get(){return a.modelValue},set(c){r("update:modelValue",c)}}),l=p(()=>o.value?{"background-color":"green","font-size":"20px"}:{"background-color":"white","font-size":"20px"});return(c,d)=>(g(),y("div",On,[Fe(u("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>o.value=h),class:"form-check-input",type:"checkbox",role:"switch",style:te(l.value)},null,4),[[ma,o.value]])]))}}),Kt=t=>(ke("data-v-52884c1a"),t=t(),Me(),t),Bn={class:"settingslist"},Tn=Kt(()=>u("hr",{class:"grid-col-12"},null,-1)),An=Kt(()=>u("hr",{class:"grid-col-12"},null,-1)),Ln=A({__name:"SettingsPage",props:{chargepoint:{}},setup(t){const e=t,a=p({get:()=>e.chargepoint.etActive,set:l=>{b[e.chargepoint.id].etActive=l}}),r=p({get:()=>e.chargepoint.timedCharging,set:l=>{b[e.chargepoint.id].timedCharging=l}}),o=p({get:()=>e.chargepoint.connectedVehicle,set:l=>{b[e.chargepoint.id].connectedVehicle=l}});return(l,c)=>(g(),y("div",Bn,[n(U).isBatteryConfigured?(g(),E(Ae,{key:0,title:"PV-Priorität (global)",icon:"fa-car-battery",iconcolor:"var(--color-battery)",infotext:"Priority during PV production",fullwidth:!0},{default:P(()=>[k(lt,{modelValue:n(U).pvBatteryPriority,"onUpdate:modelValue":c[0]||(c[0]=d=>n(U).pvBatteryPriority=d),options:n(Ta)},null,8,["modelValue","options"])]),_:1})):I("",!0),Tn,k(Ae,{title:"Fahrzeug wechseln",icon:"fa-car",fullwidth:!0},{default:P(()=>[k(lt,{modelValue:o.value,"onUpdate:modelValue":c[1]||(c[1]=d=>o.value=d),modelModifiers:{number:!0},options:Object.values(n(N)).map(d=>[d.name,d.id])},null,8,["modelValue","options"])]),_:1}),An,k(Ae,{title:"Strompreisbasiert laden",icon:"fa-coins",iconcolor:"var(--color-battery)",infotext:"Settings"},{default:P(()=>[k(Tt,{modelValue:a.value,"onUpdate:modelValue":c[2]||(c[2]=d=>a.value=d)},null,8,["modelValue"])]),_:1}),k(Ae,{title:"Zeitplan aktivieren",icon:"fa-clock",iconcolor:"var(--color-battery)"},{default:P(()=>[k(Tt,{modelValue:r.value,"onUpdate:modelValue":c[3]||(c[3]=d=>r.value=d)},null,8,["modelValue"])]),_:1}),k(Ae,{title:"Ladeprofil",icon:"fa-sliders",iconcolor:"var(--color-pv)"},{default:P(()=>[n(N)[o.value]?(g(),E(lt,{key:0,modelValue:n(N)[o.value].chargeTemplateId,"onUpdate:modelValue":c[4]||(c[4]=d=>n(N)[o.value].chargeTemplateId=d),modelModifiers:{number:!0},options:Object.keys(n(ce)).map(d=>[n(ce)[+d].name,d])},null,8,["modelValue","options"])):I("",!0)]),_:1})]))}}),Dn=Z(Ln,[["__scopeId","data-v-52884c1a"]]);function Gn(t,e){t=="openWB/graph/boolDisplayLiveGraph"?U.displayLiveGraph=+e==1:t.match(/^openwb\/graph\/alllivevaluesJson[1-9][0-9]*$/i)?Vn(t,e):t=="openWB/graph/lastlivevaluesJson"?En(t,e):t=="openWB/graph/config/duration"&&(Q.duration=JSON.parse(e))}function Vn(t,e){if(!Q.initialized){let a=[];const r=e.toString().split(` -`);r.length>1?a=r.map(c=>JSON.parse(c)):a=[];const o=t.match(/(\d+)$/g),l=o?o[0]:"";l!=""&&typeof Q.rawDataPacks[+l-1]>"u"&&(Q.rawDataPacks[+l-1]=a,Q.initCounter++)}if(Q.initCounter==16){const a=[];Q.unsubscribeRefresh(),Q.initialized=!0,Q.rawDataPacks.map(r=>{r.map(o=>{const l=ea(o);a.push(l)})}),Ne(a),Q.subscribeUpdates()}}function En(t,e){const a=JSON.parse(e),r=ea(a);Q.graphRefreshCounter++,Ne(i.data.concat(r)),Q.graphRefreshCounter>60&&Q.activate()}function ea(t){const e={};e.date=Wn(t.time).valueOf(),+t.grid>0?(e.evuIn=+t.grid,e.evuOut=0):+t.grid<=0?(e.evuIn=0,e.evuOut=-t.grid):(e.evuIn=0,e.evuOut=0),+t["pv-all"]>=0?(e.pv=+t["pv-all"],e.inverter=0):(e.pv=0,e.inverter=-t["pv-all"]),e.house=+t["house-power"],+t["bat-all-power"]>0?(e.batOut=0,e.batIn=+t["bat-all-power"]):+t["bat-all-power"]<0?(e.batOut=-t["bat-all-power"],e.batIn=0):(e.batOut=0,e.batIn=0),t["bat-all-soc"]?e.batterySoc=+t["bat-all-soc"]:e.batterySoc=0,t["ev0-soc"]&&(e.soc0=+t["ev0-soc"]),t["ev1-soc"]&&(e.soc1=+t["ev1-soc"]),e.charging=+t["charging-all"];for(let a=0;a<10;a++){const r="cp"+a;e[r]=+(t[r+"-power"]??0)}return e.selfUsage=e.pv-e.evuOut,e.selfUsage<0&&(e.selfUsage=0),e.devices=0,e}function Wn(t){const e=new Date(Date.now()),a=864e5;let r=new Date;const o=Ye("%H:%M:%S")(t);return o&&(r=o,r.setDate(e.getDate()),r.setMonth(e.getMonth()),r.setFullYear(e.getFullYear()),r.getHours()>e.getHours()&&(r=new Date(r.getTime()-a))),r}const Nn=["evuIn","pv","batIn","evuOut"];let Ze=[];function jn(t,e){const a=JSON.parse(e).entries,r=JSON.parse(e).totals;vt(),Ze=[],_t.map(l=>{w.setEnergyPv(l,0),w.setEnergyBat(l,0)});const o=zn(a);Ne(o),yt(r,Ze),m.debug&&(console.debug("---------------------------------------- Graph Data ---------------------------"),console.debug("--- Incoming graph data:"),console.debug(a),console.debug("data to be displayed:"),console.debug(o),console.debug("-------------------------------------------------------------------------------")),i.graphMode=="today"&&setTimeout(()=>J.activate(),3e5)}function zn(t){const e=[];let a={};return t.map(r=>{a=Un(r);const o=a;e.push(o)}),e}function Un(t){const e={};if(i.graphMode=="day"||i.graphMode=="today")if(typeof t.date=="number")e.date=new Date(+t.date*1e3).getTime();else{const r=Ye("%H:%M")(t.date);r&&(r.setMonth(J.date.getMonth()),r.setDate(J.date.getDate()),r.setFullYear(J.date.getFullYear()),e.date=r.getTime())}else if(typeof t.date=="string"){const r=Ye("%Y%m%d")(t.date);r&&(e.date=r.getDate())}return e.evuOut=0,e.evuIn=0,Object.entries(t.counter).forEach(([r,o])=>{o.grid&&(e.evuOut+=o.power_exported,e.evuIn+=o.power_imported,Ze.includes(r)||Ze.push(r))}),e.evuOut==0&&e.evuIn==0&&Object.entries(t.counter).forEach(r=>{e.evuOut+=r[1].power_exported,e.evuIn+=r[1].power_imported}),e.pv=t.pv.all.power_exported,Object.entries(t.bat).length>0?(e.batIn=t.bat.all.power_imported,e.batOut=t.bat.all.power_exported,e.batSoc=t.bat.all.soc??0):(e.batIn=0,e.batOut=0,e.batSoc=0),Object.entries(t.cp).forEach(([r,o])=>{r!="all"?(e[r]=o.power_imported,w.keys().includes(r)||w.addItem(r)):e.charging=o.power_imported}),Object.entries(t.ev).forEach(([r,o])=>{r!="all"&&(e["soc"+r.substring(2)]=o.soc)}),e.devices=0,Object.entries(t.sh).forEach(([r,o])=>{r!="all"&&(e[r]=o.power_imported??0,e.devices+=o.power_imported??0,w.keys().includes(r)||w.addItem(r))}),e.selfUsage=e.pv-e.evuOut,t.hc&&t.hc.all?e.house=t.hc.all.power_imported:e.house=e.evuIn+e.batOut+e.pv-e.evuOut-e.charging-e.devices-e.batOut,e.evuIn+e.batOut+e.pv>0?w.keys().filter(r=>!Nn.includes(r)).map(r=>{Ar(r,e)}):Object.keys(e).map(r=>{e[r+"Pv"]=0,e[r+"Bat"]=0}),e}let Ue={};const St=["charging","house","batIn","devices"],Fn=["evuIn","pv","batIn","evuOut"];let Ge=[];function Jn(t,e){const a=JSON.parse(e).entries,r=JSON.parse(e).totals;vt(),Ge=[],St.map(o=>{w.items[o].energyPv=0,w.items[o].energyBat=0}),a.length>0&&Ne(ta(a)),yt(r,[])}function Rn(t,e){const a=JSON.parse(e).entries,r=JSON.parse(e).totals;vt(),Ge=[],St.forEach(o=>{w.items[o].energyPv=0,w.items[o].energyBat=0}),Ne(ta(a)),yt(r,[])}function ta(t){const e=[];let a={};return Ue={},t.map(r=>{a=Hn(r),e.push(a),Object.keys(a).forEach(o=>{o!="date"&&(a[o]<0&&(console.warn(`Negative energy value for ${o} in row ${a.date}. Ignoring the value.`),a[o]=0),Ue[o]?Ue[o]+=a[o]:Ue[o]=a[o])})}),e}function Hn(t){const e={},a=Ye("%Y%m%d")(t.date);a&&(e.date=i.graphMode=="month"?a.getDate():a.getMonth()+1),e.evuOut=0,e.evuIn=0;let r=0,o=0;return Object.entries(t.counter).forEach(([c,d])=>{r+=d.energy_exported,o+=d.energy_imported,d.grid&&(e.evuOut+=d.energy_exported,e.evuIn+=d.energy_imported,Ge.includes(c)||Ge.push(c))}),Ge.length==0&&(e.evuOut=r,e.evuIn=o),e.pv=t.pv.all.energy_exported,Object.entries(t.bat).length>0?(t.bat.all.energy_imported>=0?e.batIn=t.bat.all.energy_imported:(console.warn("ignoring negative value for batIn on day "+e.date),e.batIn=0),t.bat.all.energy_exported>=0?e.batOut=t.bat.all.energy_exported:(console.warn("ignoring negative value for batOut on day "+e.date),e.batOut=0)):(e.batIn=0,e.batOut=0),Object.entries(t.cp).forEach(([c,d])=>{c!="all"?(w.keys().includes(c)||w.addItem(c),e[c]=d.energy_imported):e.charging=d.energy_imported}),Object.entries(t.ev).forEach(([c,d])=>{c!="all"&&(e["soc-"+c]=d.soc)}),e.devices=Object.entries(t.sh).reduce((c,d)=>(w.keys().includes(d[0])||w.addItem(d[0]),d[1].energy_imported>=0?c+=d[1].energy_imported:console.warn(`Negative energy value for device ${d[0]} in row ${e.date}. Ignoring this value`),c),0),e.house=e.pv+e.evuIn+e.batOut-e.evuOut-e.batIn-e.charging,e.selfUsage=e.pv-e.evuOut,e.evuIn+e.batOut+e.pv>0?w.keys().filter(c=>!Fn.includes(c)).map(c=>{Lr(c,e)}):St.map(c=>{e[c+"Pv"]=0,e[c+"Bat"]=0}),e}class Yn{constructor(e){s(this,"id");s(this,"dailyYieldExport",0);s(this,"dailyYieldImport",0);s(this,"exported",0);s(this,"faultState",0);s(this,"faultStr","");s(this,"imported",0);s(this,"power",0);s(this,"soc",0);this.id=e}}class Qn{constructor(){s(this,"dailyExport",0);s(this,"dailyImport",0);s(this,"exported",0);s(this,"imported",0);s(this,"power",0);s(this,"soc",0)}}const oe=F({});F(new Qn);function qn(t){t in oe?console.info("Duplicate battery message: "+t):oe[t]=new Yn(t)}function Xn(){Object.keys(oe).forEach(t=>{delete oe[parseInt(t)]})}function Zn(t,e){const a=Kn(t);if(a&&!(a in oe)){console.warn("Invalid battery index received: "+a);return}t=="openWB/bat/config/configured"?U.isBatteryConfigured=e=="true":t=="openWB/bat/get/power"?+e>0?($.batIn.power=+e,V.batOut.power=0):($.batIn.power=0,V.batOut.power=-e):t=="openWB/bat/get/soc"?U.batterySoc=+e:t=="openWB/bat/get/daily_exported"?V.batOut.energy=+e:t=="openWB/bat/get/daily_imported"?$.batIn.energy=+e:a&&(t.match(/^openwb\/bat\/[0-9]+\/get\/daily_yield_export$/i)?oe[a].dailyYieldExport=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/daily_yield_import$/i)?oe[a].dailyYieldImport=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/exported$/i)?oe[a].exported=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/fault_state$/i)?oe[a].faultState=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/fault_str$/i)?oe[a].faultStr=e:t.match(/^openwb\/bat\/[0-9]+\/get\/imported$/i)?oe[a].imported=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/power$/i)?oe[a].power=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/soc$/i)&&(oe[a].soc=+e))}function Kn(t){let e=0;try{const a=t.match(/(?:\/)([0-9]+)(?=\/)/g);return a?(e=+a[0].replace(/[^0-9]+/g,""),e):void 0}catch{console.warn("Parser error in getIndex for topic "+t)}}function es(t,e){if(t=="openWB/optional/et/provider")JSON.parse(e).type==null?ae.active=!1:(ae.active=!0,ae.etProvider=JSON.parse(e).name);else if(t=="openWB/optional/et/get/prices"){const a=JSON.parse(e);ae.etPriceList=new Map,Object.keys(a).map(r=>{ae.etPriceList.set(new Date(+r*1e3),a[r]*1e5)})}}function ts(t,e){const a=aa(t);if(a&&!(a in b)){console.warn("Invalid chargepoint id received: "+a);return}if(t=="openWB/chargepoint/get/power"?$.charging.power=+e:t=="openWB/chargepoint/get/daily_imported"&&($.charging.energy=+e),t=="openWB/chargepoint/get/daily_exported")U.cpDailyExported=+e;else if(a){if(t.match(/^openwb\/chargepoint\/[0-9]+\/config$/i))if(b[a]){const r=JSON.parse(e);b[a].name=r.name,b[a].icon=r.name,K["cp"+a]?(K["cp"+a].name=r.name,K["cp"+a].icon=r.name):K["cp"+a]={name:r.name,icon:r.name,color:"var(--color-charging)"}}else console.warn("invalid chargepoint index: "+a);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/state_str$/i))b[a].stateStr=JSON.parse(e);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/fault_str$/i))b[a].faultStr=JSON.parse(e);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/fault_state$/i))b[a].faultState=+e;else if(t.match(/^openWB\/chargepoint\/[0-9]+\/get\/power$/i))b[a].power=+e;else if(t.match(/^openWB\/chargepoint\/[0-9]+\/get\/daily_imported$/i))b[a].dailyYield=+e;else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/plug_state$/i))b[a].isPluggedIn=e=="true";else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/charge_state$/i))b[a].isCharging=e=="true";else if(t.match(/^openwb\/chargepoint\/[0-9]+\/set\/manual_lock$/i))b[a].updateIsLocked(e=="true");else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/enabled$/i))b[a].isEnabled=e=="1";else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/phases_in_use/i))b[a].phasesInUse=+e;else if(t.match(/^openwb\/chargepoint\/[0-9]+\/set\/current/i))b[a].current=+e;else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/currents/i))b[a].currents=JSON.parse(e);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/set\/log/i)){const r=JSON.parse(e);b[a].chargedSincePlugged=r.imported_since_plugged}else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/connected_vehicle\/soc$/i)){const r=JSON.parse(e);b[a].soc=r.soc,b[a].waitingForSoc=!1,b[a].rangeCharged=r.range_charged,b[a].rangeUnit=r.range_unit}else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/connected_vehicle\/info$/i)){const r=JSON.parse(e);b[a].vehicleName=String(r.name),b[a].updateConnectedVehicle(+r.id)}else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/connected_vehicle\/config$/i)){const r=JSON.parse(e);switch(r.chargemode){case"instant_charging":b[a].updateChargeMode(de.instant_charging);break;case"pv_charging":b[a].updateChargeMode(de.pv_charging);break;case"scheduled_charging":b[a].updateChargeMode(de.scheduled_charging);break;case"standby":b[a].updateChargeMode(de.standby);break;case"stop":b[a].updateChargeMode(de.stop);break}b[a].chargeTemplate=r.charge_template,b[a].averageConsumption=r.average_consumption}}}function as(t,e){const a=aa(t);if(a!=null){if(!(a in N)){const r=new Pa(a);N[a]=r}if(t.match(/^openwb\/vehicle\/[0-9]+\/name$/i))Object.values(b).forEach(r=>{r.connectedVehicle==a&&(r.vehicleName=JSON.parse(e))}),N[a].name=JSON.parse(e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/get\/soc$/i))N[a].soc=JSON.parse(e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/get\/range$/i))N[a].range=+e;else if(t.match(/^openwb\/vehicle\/[0-9]+\/charge_template$/i))N[a].updateChargeTemplateId(+e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/ev_template$/i))N[a].updateEvTemplateId(+e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/soc_module\/config$/i)){const r=JSON.parse(e);Object.values(b).forEach(o=>{o.connectedVehicle==a&&(o.isSocConfigured=r.type!==null,o.isSocManual=r.type=="manual")})}}}function rs(t,e){if(t.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+$/i)){const a=t.match(/[0-9]+$/i);if(a){const r=+a[0],o=JSON.parse(e);ce[r]=o,os(r,o)}}else if(t.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+\/time_charging\/plans\/[0-9]+$/i)){const a=t.match(/(?:\/)([0-9]+)(?:\/)/g),r=t.match(/[0-9]+$/i);if(a&&r){const o=+a[0].replace(/[^0-9]+/g,""),l=+r[0],c=JSON.parse(e);o in ot||(ot[o]=[]),ot[o][l]=c}}else if(t.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+\/chargemode\/scheduled_charging\/plans\/[0-9]+$/i)){const a=t.match(/(?:\/)([0-9]+)(?:\/)/g),r=t.match(/[0-9]+$/i);if(a&&r){const o=+a[0].replace(/[^0-9]+/g,""),l=+r[0],c=JSON.parse(e);o in rt||(rt[o]=[]),rt[o][l]=c}}else if(t.match(/^openwb\/vehicle\/template\/ev_template\/[0-9]+$/i)){const a=t.match(/[0-9]+$/i);if(a){const r=+a[0],o=JSON.parse(e);Ia[r]=o}}}function os(t,e){Object.values(b).forEach(a=>{a.chargeTemplate==t&&(a.updateCpPriority(e.prio),a.updateInstantChargeLimitMode(e.chargemode.instant_charging.limit.selected),a.updateInstantTargetCurrent(e.chargemode.instant_charging.current),a.updateInstantTargetSoc(e.chargemode.instant_charging.limit.soc),a.updateInstantMaxEnergy(e.chargemode.instant_charging.limit.amount),a.updatePvFeedInLimit(e.chargemode.pv_charging.feed_in_limit),a.updatePvMinCurrent(e.chargemode.pv_charging.min_current),a.updatePvMaxSoc(e.chargemode.pv_charging.max_soc),a.updatePvMinSoc(e.chargemode.pv_charging.min_soc),a.updatePvMinSocCurrent(e.chargemode.pv_charging.min_soc_current))})}function aa(t){let e=0;try{const a=t.match(/(?:\/)([0-9]+)(?=\/)/g);return a?(e=+a[0].replace(/[^0-9]+/g,""),e):void 0}catch{console.warn("Parser error in getIndex for topic "+t)}}function ns(t,e){t.match(/^openWB\/LegacySmarthome\/config\//i)?ss(t,e):t.match(/^openWB\/LegacySmarthome\/Devices\//i)&&is(t,e)}function ss(t,e){const a=ra(t);a!=null&&(a in L||Ut(a),t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_configured$/i)?L[a].configured=e!="0":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_name$/i)?(L[a].name=e.toString(),L[a].icon=e.toString(),K["sh"+a].name=e.toString(),K["sh"+a].icon=e.toString()):t.match(/^openWB\/LegacySmarthome\/config\/set\/Devices\/[0-9]+\/mode$/i)?L[a].isAutomatic=e=="0":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_canSwitch$/i)?L[a].canSwitch=e=="1":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_homeConsumtion$/i)?L[a].countAsHouse=e=="1":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_temperatur_configured$/i)&&(L[a].tempConfigured=+e))}function is(t,e){const a=ra(t);if(a==null){console.warn("Smarthome: Missing index in "+t);return}if(a in L||Ut(a),t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/Watt$/i))L[a].power=+e,cs("power");else if(!t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/Wh$/i)){if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/RunningTimeToday$/i))L[a].runningTime=+e;else if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/TemperatureSensor0$/i))L[a].temp[0]=+e;else if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/TemperatureSensor1$/i))L[a].temp[1]=+e;else if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/TemperatureSensor2$/i))L[a].temp[2]=+e;else if(t.match(/^openWB\/LegacySmartHome\/Devices\/[0-9]+\/Status$/i))switch(+e){case 10:L[a].status="off";break;case 11:L[a].status="on";break;case 20:L[a].status="detection";break;case 30:L[a].status="timeout";break;default:L[a].status="off"}}}function cs(t){switch(t){case"power":$.devices.power=Object.values(L).filter(e=>e.configured&&!e.countAsHouse).reduce((e,a)=>e+a.power,0);break;case"energy":$.devices.energy=Object.values(L).filter(e=>e.configured&&!e.countAsHouse).reduce((e,a)=>e+a.energy,0);break;default:console.error("Unknown category")}}function ra(t){let e=0;try{const a=t.match(/(?:\/)([0-9]+)(?=\/)/g);return a?(e=+a[0].replace(/[^0-9]+/g,""),e):void 0}catch{console.warn("Parser error in getIndex for topic "+t)}}class ls{constructor(e){s(this,"id");s(this,"name","Zähler");s(this,"power",0);s(this,"energy_imported",0);s(this,"energy_exported",0);s(this,"grid",!1);s(this,"type","counter");s(this,"color","var(--color-evu)");s(this,"energyPv",0);s(this,"energyBat",0);s(this,"pvPercentage",0);s(this,"icon","");this.id=e}}const ie=F({});function us(t,e){if(t in ie)console.info("Duplicate counter message: "+t);else switch(ie[t]=new ls(t),ie[t].type=e,e){case"counter":ie[t].color="var(--color-evu)";break;case"inverter":ie[t].color="var(--color-pv)";break;case"cp":ie[t].color="var(--color-charging)";break;case"bat":ie[t].color="var(--color-bat)";break}}const ds=["openWB/counter/#","openWB/bat/#","openWB/pv/get/#","openWB/chargepoint/#","openWB/vehicle/#","openWB/general/chargemode_config/pv_charging/#","openWB/optional/et/#","openWB/system/#","openWB/LegacySmartHome/#","openWB/command/"+mt()+"/#","openWB/optional/int_display/#"];function hs(){Ma(ps),ds.forEach(t=>{$e(t)}),X()}function ps(t,e){const a=e.toString();t.match(/^openwb\/counter\/[0-9]+\//i)?gs(t,a):t.match(/^openwb\/counter\//i)?ms(t,a):t.match(/^openwb\/bat\//i)?Zn(t,a):t.match(/^openwb\/pv\//i)?fs(t,a):t.match(/^openwb\/chargepoint\//i)?ts(t,a):t.match(/^openwb\/vehicle\/template\//i)?rs(t,a):t.match(/^openwb\/vehicle\//i)?as(t,a):t.match(/^openwb\/general\/chargemode_config\/pv_charging\//i)?vs(t,a):t.match(/^openwb\/graph\//i)?Gn(t,a):t.match(/^openwb\/log\/daily\//i)?jn(t,a):t.match(/^openwb\/log\/monthly\//i)?Jn(t,a):t.match(/^openwb\/log\/yearly\//i)?Rn(t,a):t.match(/^openwb\/optional\/et\//i)?es(t,a):t.match(/^openwb\/system\//i)?ys(t,a):t.match(/^openwb\/LegacySmartHome\//i)?ns(t,a):t.match(/^openwb\/command\//i)?bs(t,a):t.match(/^openwb\/optional\//i)&&ws(t,a)}function gs(t,e){const a=t.split("/"),r=+a[2];if(r==U.evuId?_s(t,e):a[3]=="config",a[3]=="get"&&r in ie)switch(a[4]){case"power":ie[r].power=+e;break;case"config":break;case"fault_str":break;case"fault_state":break;case"power_factors":break;case"imported":break;case"exported":break;case"frequency":break;case"daily_imported":ie[r].energy_imported=+e;break;case"daily_exported":ie[r].energy_exported=+e;break}}function ms(t,e){if(t.match(/^openwb\/counter\/get\/hierarchy$/i)){const a=JSON.parse(e);if(a.length){Ca(),Xn();for(const r of a)r.type=="counter"&&(U.evuId=r.id);oa(a[0])}}else t.match(/^openwb\/counter\/set\/home_consumption$/i)?($.house.power=+e,La()):t.match(/^openwb\/counter\/set\/daily_yield_home_consumption$/i)&&($.house.energy=+e)}function oa(t){switch(t.type){case"counter":us(t.id,t.type);break;case"cp":$a(t.id);break;case"bat":qn(t.id);break}t.children.forEach(e=>oa(e))}function fs(t,e){switch(t){case"openWB/pv/get/power":V.pv.power=-e;break;case"openWB/pv/get/daily_exported":V.pv.energy=+e;break}}function vs(t,e){const a=t.split("/");if(a.length>0)switch(a[4]){case"bat_prio":U.updatePvBatteryPriority(e=="true");break}}function _s(t,e){switch(t.split("/")[4]){case"power":+e>0?(V.evuIn.power=+e,$.evuOut.power=0):(V.evuIn.power=0,$.evuOut.power=-e);break;case"daily_imported":V.evuIn.energy=+e;break;case"daily_exported":$.evuOut.energy=+e;break}}function ys(t,e){if(t.match(/^openWB\/system\/device\/[0-9]+\/component\/[0-9]+\/config$/i)){const a=JSON.parse(e);a.type=="counter"&&(ie[a.id].name=a.name)}else t.match(/^openWB\/system\/ip_address$/i)?U.ipAddress=JSON.parse(e):t.match(/^openWB\/system\/time$/i)?U.systemTime=JSON.parse(e):t.match(/^openWB\/system\/version$/i)?U.version=JSON.parse(e):t.match(/^openWB\/system\/current_commit$/i)?U.versionDetails=JSON.parse(e):t.match(/^openWB\/system\/current_branch$/i)&&(U.devBranch=JSON.parse(e))}function bs(t,e){const a=t.split("/");if(t.match(/^openWB\/command\/[a-z]+\/error$/i)&&a[2]==mt()){const r=JSON.parse(e);console.error(`Error message from openWB: +var sa=Object.defineProperty;var ia=(t,e,a)=>e in t?sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var s=(t,e,a)=>ia(t,typeof e!="symbol"?e+"":e,a);import{m as ca,r as F,a as Se,M as At,d as A,o as g,c as y,n as q,b as I,e as u,f as ue,g as te,h as p,s as me,i as Ke,j as la,t as B,u as n,k,w as P,l as z,p as ke,q as Me,v as Lt,x as Dt,y as ua,z as E,F as Ie,A as Be,B as Ee,C as ut,D as Ce,E as Gt,G as gt,H as Re,I as Le,J as tt,K as kt,L as da,N as He,O as ha,P as pa,Q as ga,R as Fe,S as ma,T as Ye,U as at,V as fa}from"./vendor-DkUHBf2M.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function a(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=a(o);fetch(o.href,l)}})();function Je(t,e=1){let a;if(t>=1e3&&e<4){switch(e){case 0:a=Math.round(t/1e3);break;case 1:a=Math.round(t/100)/10;break;case 2:a=Math.round(t/10)/100;break;case 3:a=Math.round(t)/1e3;break;default:a=Math.round(t/100)/10;break}return(a==null?void 0:a.toLocaleString(void 0,{minimumFractionDigits:e}))+" kW"}else return Math.round(t).toLocaleString(void 0)+" W"}function Vt(t,e=1,a=!1){let r;if(t>1e6&&(a=!0,t=t/1e3),t>=1e3&&e<4){switch(e){case 0:r=Math.round(t/1e3);break;case 1:r=(Math.round(t/100)/10).toFixed(1);break;case 2:r=(Math.round(t/10)/100).toFixed(2);break;case 3:r=(Math.round(t)/1e3).toFixed(3);break;default:r=Math.round(t/100)/10;break}return r.toLocaleString(void 0,{minimumFractionDigits:e})+(a?" MWh":" kWh")}else return Math.round(t).toLocaleString(void 0)+(a?" kWh":" Wh")}function va(t){return t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function _a(t,e){return["Jan","Feb","März","April","Mai","Juni","Juli","Aug","Sep","Okt","Nov","Dez"][t]+" "+e}const ya=0,Et={host:location.hostname,port:location.protocol=="https:"?443:80,endpoint:"/ws",protocol:location.protocol=="https:"?"wss":"ws",connectTimeout:4e3,reconnectPeriod:4e3,clean:!1,clientId:Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,6)},Qe={topic:"",qos:ya};let ne;const{host:ba,port:wa,endpoint:Sa,...Wt}=Et,ka=`${Wt.protocol}://${ba}:${wa}${Sa}`;try{ne=ca.connect(ka,Wt),ne.on("connect",()=>{console.info("MQTT connection successful.")}),ne.on("disconnect",()=>{console.info("MQTT disconnected")}),ne.on("error",t=>{console.error("MQTT connection failed: ",t)})}catch(t){console.error("MQTT connect error: ",t)}async function Ma(t){await Nt(),ne?ne.on("message",t):console.error("MqttRegister: MQTT client not available")}async function $e(t){Qe.topic=t;const{topic:e,qos:a}=Qe;await Nt(),ne.subscribe(e,{qos:a},r=>{if(r){console.error("MQTT Subscription error: "+r);return}})}function Oe(t){Qe.topic=t;const{topic:e}=Qe;ne.unsubscribe(e,a=>{if(a){console.error("MQTT Unsubscribe from "+t+" failed: "+a);return}})}async function dt(t,e){let r=ne.connected,o=0;for(;!r&&o<10;)console.warn("MQTT not connected. Waiting 0.1 seconds"),await jt(100),r=ne.connected,o+=1;if(o<10)try{ne.publish(t,e,{qos:0},l=>{l&&console.warn("MQTT publish error: ",l),console.info("MQTT publish: Message sent: ["+t+"]("+e+")")})}catch(l){console.warn("MQTT publish: caught error: "+l)}else console.error("MQTT publish: Lost connection to MQTT server. Please reload the page")}function mt(){return Et.clientId}const Mt=20;async function Nt(){let t=ne.connected,e=0;for(;!t&&e{esetTimeout(e,t))}class xa{constructor(e){s(this,"id");s(this,"name","Ladepunkt");s(this,"icon","Ladepunkt");s(this,"type","");s(this,"ev",0);s(this,"template",0);s(this,"connectedPhases",0);s(this,"phase_1",0);s(this,"autoPhaseSwitchHw",!1);s(this,"controlPilotInterruptionHw",!1);s(this,"isEnabled",!0);s(this,"isPluggedIn",!1);s(this,"isCharging",!1);s(this,"_isLocked",!1);s(this,"_connectedVehicle",0);s(this,"chargeTemplate",0);s(this,"evTemplate",0);s(this,"_chargeMode","pv_charging");s(this,"_hasPriority",!1);s(this,"currentPlan","");s(this,"averageConsumption",0);s(this,"vehicleName","");s(this,"rangeCharged",0);s(this,"rangeUnit","");s(this,"counter",0);s(this,"dailyYield",0);s(this,"energyPv",0);s(this,"energyBat",0);s(this,"pvPercentage",0);s(this,"faultState",0);s(this,"faultStr","");s(this,"phasesInUse",0);s(this,"power",0);s(this,"chargedSincePlugged",0);s(this,"stateStr","");s(this,"current",0);s(this,"currents",[0,0,0]);s(this,"phasesToUse",0);s(this,"isSocConfigured",!0);s(this,"isSocManual",!1);s(this,"waitingForSoc",!1);s(this,"color","white");s(this,"_timedCharging",!1);s(this,"_instantChargeLimitMode","");s(this,"_instantTargetCurrent",0);s(this,"_instantTargetSoc",0);s(this,"_instantMaxEnergy",0);s(this,"_pvFeedInLimit",!1);s(this,"_pvMinCurrent",0);s(this,"_pvMaxSoc",0);s(this,"_pvMinSoc",0);s(this,"_pvMinSocCurrent",0);s(this,"_etActive",!1);s(this,"_etMaxPrice",20);this.id=e}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked=e,Y("cpLock",e,this.id)}updateIsLocked(e){this._isLocked=e}get connectedVehicle(){return this._connectedVehicle}set connectedVehicle(e){this._connectedVehicle=e,Y("cpVehicle",e,this.id)}updateConnectedVehicle(e){this._connectedVehicle=e}get soc(){return N[this.connectedVehicle]?N[this.connectedVehicle].soc:0}set soc(e){N[this.connectedVehicle]&&(N[this.connectedVehicle].soc=e)}get chargeMode(){return this._chargeMode}set chargeMode(e){this._chargeMode=e,Y("chargeMode",e,this.id)}updateChargeMode(e){this._chargeMode=e}get hasPriority(){return this._hasPriority}set hasPriority(e){this._hasPriority=e,Y("cpPriority",e,this.id)}updateCpPriority(e){this._hasPriority=e}get timedCharging(){return ce[this.chargeTemplate]?ce[this.chargeTemplate].time_charging.active:!1}set timedCharging(e){ce[this.chargeTemplate].time_charging.active=e,Y("cpTimedCharging",e,this.chargeTemplate)}get instantTargetCurrent(){return this._instantTargetCurrent}set instantTargetCurrent(e){this._instantTargetCurrent=e,Y("cpInstantTargetCurrent",e,this.id)}updateInstantTargetCurrent(e){this._instantTargetCurrent=e}get instantChargeLimitMode(){return this._instantChargeLimitMode}set instantChargeLimitMode(e){this._instantChargeLimitMode=e,Y("cpInstantChargeLimitMode",e,this.id)}updateInstantChargeLimitMode(e){this._instantChargeLimitMode=e}get instantTargetSoc(){return this._instantTargetSoc}set instantTargetSoc(e){this._instantTargetSoc=e,Y("cpInstantTargetSoc",e,this.id)}updateInstantTargetSoc(e){this._instantTargetSoc=e}get instantMaxEnergy(){return this._instantMaxEnergy}set instantMaxEnergy(e){this._instantMaxEnergy=e,Y("cpInstantMaxEnergy",e,this.id)}updateInstantMaxEnergy(e){this._instantMaxEnergy=e}get pvFeedInLimit(){return this._pvFeedInLimit}set pvFeedInLimit(e){this._pvFeedInLimit=e,Y("cpPvFeedInLimit",e,this.id)}updatePvFeedInLimit(e){this._pvFeedInLimit=e}get pvMinCurrent(){return this._pvMinCurrent}set pvMinCurrent(e){this._pvMinCurrent=e,Y("cpPvMinCurrent",e,this.id)}updatePvMinCurrent(e){this._pvMinCurrent=e}get pvMaxSoc(){return this._pvMaxSoc}set pvMaxSoc(e){this._pvMaxSoc=e,Y("cpPvMaxSoc",e,this.id)}updatePvMaxSoc(e){this._pvMaxSoc=e}get pvMinSoc(){return this._pvMinSoc}set pvMinSoc(e){this._pvMinSoc=e,Y("cpPvMinSoc",e,this.id)}updatePvMinSoc(e){this._pvMinSoc=e}get pvMinSocCurrent(){return this._pvMinSocCurrent}set pvMinSocCurrent(e){this._pvMinSocCurrent=e,Y("cpPvMinSocCurrent",e,this.id)}updatePvMinSocCurrent(e){this._pvMinSocCurrent=e}get realCurrent(){switch(this.phasesInUse){case 0:return 0;case 1:return this.currents[0];case 2:return(this.currents[0]+this.currents[1])/2;case 3:return(this.currents[0]+this.currents[1]+this.currents[2])/3;default:return 0}}get etActive(){return N[this.connectedVehicle]?N[this.connectedVehicle].etActive:!1}set etActive(e){N[this.connectedVehicle]&&(N[this.connectedVehicle].etActive=e)}get etMaxPrice(){return N[this.connectedVehicle].etMaxPrice??0}set etMaxPrice(e){console.log("Setting et max price needs to be implemented"),Y("cpEtMaxPrice",Math.round(e*10)/1e6,this.id)}toPowerItem(){return{name:this.name,power:this.power,energy:this.dailyYield,energyPv:this.energyPv,energyBat:this.energyBat,pvPercentage:this.pvPercentage,color:this.color,icon:this.icon}}}class Pa{constructor(e){s(this,"id");s(this,"name","");s(this,"_chargeTemplateId",0);s(this,"_evTemplateId",0);s(this,"tags",[]);s(this,"config",{});s(this,"soc",0);s(this,"range",0);s(this,"_etActive",!1);s(this,"_etMaxPrice",20);this.id=e}get chargeTemplateId(){return this._chargeTemplateId}set chargeTemplateId(e){this._chargeTemplateId=e,Y("vhChargeTemplateId",e,this.id)}updateChargeTemplateId(e){this._chargeTemplateId=e}get evTemplateId(){return this._evTemplateId}set evTemplateId(e){this._evTemplateId=e,Y("vhEvTemplateId",e,this.id)}updateEvTemplateId(e){this._evTemplateId=e}get etActive(){return ce[this.chargeTemplateId]?ce[this.chargeTemplateId].et.active:!1}set etActive(e){ce[this.chargeTemplateId]&&Y("priceCharging",e,this.chargeTemplateId)}get etMaxPrice(){if(ce[this.chargeTemplateId]&&ce[this.chargeTemplateId].et.active)return ce[this.chargeTemplateId].et.max_price*1e5}get chargepoint(){for(const e of Object.values(b))if(e.connectedVehicle==this.id)return e}}var de=(t=>(t.instant_charging="instant_charging",t.pv_charging="pv_charging",t.scheduled_charging="scheduled_charging",t.standby="standby",t.stop="stop",t))(de||{});const b=F({}),N=F({}),ce=F({}),rt=F({}),ot=F({}),Ia=F({});function $a(t){t in b||(b[t]=new xa(t),b[t].color="var(--color-cp"+(Object.values(b).length-1)+")")}function Ca(){Object.keys(b).forEach(t=>{delete b[parseInt(t)]})}const Oa={cpLock:"openWB/set/chargepoint/%/set/manual_lock",chargeMode:"openWB/set/vehicle/template/charge_template/%/chargemode/selected",cpPriority:"openWB/set/vehicle/template/charge_template/%/prio",cpTimedCharging:"openWB/set/vehicle/template/charge_template/%/time_charging/active",pvBatteryPriority:"openWB/set/general/chargemode_config/pv_charging/bat_mode",cpVehicle:"openWB/set/chargepoint/%/config/ev",cpInstantChargeLimitMode:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/limit/selected",cpInstantTargetCurrent:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/current",cpInstantTargetSoc:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/limit/soc",cpInstantMaxEnergy:"openWB/set/vehicle/template/charge_template/%/chargemode/instant_charging/limit/amount",cpPvFeedInLimit:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/feed_in_limit",cpPvMinCurrent:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/min_current",cpPvMaxSoc:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/max_soc",cpPvMinSoc:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/min_soc",cpPvMinSocCurrent:"openWB/set/vehicle/template/charge_template/%/chargemode/pv_charging/min_soc_current",cpEtMaxPrice:"openWB/set/vehicle/template/charge_template/%/et/max_price",vhChargeTemplateId:"openWB/set/vehicle/%/charge_template",vhEvTemplateId:"openWB/set/vehicle/%/ev_template",shSetManual:"openWB/set/LegacySmartHome/config/set/Devices/%/mode",shSwitchOn:"openWB/set/LegacySmartHome/config/set/Devices/%/device_manual_control",socUpdate:"openWB/set/vehicle/%/get/force_soc_update",setSoc:"openWB/set/vehicle/%/soc_module/calculated_soc_state/manual_soc",priceCharging:"openWB/set/vehicle/template/charge_template/%/et/active"};function Y(t,e,a=0){if(isNaN(a)){console.warn("Invalid index");return}let r=Oa[t];if(!r){console.warn("No topic for update type "+t);return}switch(t){case"chargeMode":case"cpPriority":case"cpScheduledCharging":case"cpInstantTargetCurrent":case"cpInstantChargeLimitMode":case"cpInstantTargetSoc":case"cpInstantMaxEnergy":case"cpPvFeedInLimit":case"cpPvMinCurrent":case"cpPvMaxSoc":case"cpPvMinSoc":case"cpEtMaxPrice":case"cpPvMinSocCurrent":r=r.replace("%",b[a].chargeTemplate.toString());break;default:r=r.replace("%",String(a))}switch(typeof e){case"number":dt(r,JSON.stringify(+e));break;default:dt(r,JSON.stringify(e))}}function ft(t){dt("openWB/set/command/"+mt()+"/todo",JSON.stringify(t))}class Ba{constructor(){s(this,"batterySoc",0);s(this,"isBatteryConfigured",!0);s(this,"chargeMode","0");s(this,"_pvBatteryPriority","ev_mode");s(this,"displayLiveGraph",!0);s(this,"isEtEnabled",!0);s(this,"etMaxPrice",0);s(this,"etCurrentPrice",0);s(this,"cpDailyExported",0);s(this,"evuId",0);s(this,"etProvider","");s(this,"ipAddress","");s(this,"systemTime","");s(this,"version","");s(this,"versionDetails","");s(this,"devBranch","")}get pvBatteryPriority(){return this._pvBatteryPriority}set pvBatteryPriority(e){this._pvBatteryPriority=e,Y("pvBatteryPriority",e)}updatePvBatteryPriority(e){this._pvBatteryPriority=e}}const Ta=[["EV","ev_mode"],["Speicher","bat_mode"],["MinSoc","min_soc_bat_mode"]],K=F({evuIn:{name:"Netz",color:"var(--color-evu)",icon:""},pv:{name:"PV",color:"var(--color-pv",icon:""},batOut:{name:"Bat >",color:"var(--color-battery)",icon:""},evuOut:{name:"Export",color:"var(--color-export)",icon:""},charging:{name:"Laden",color:"var(--color-charging)",icon:""},devices:{name:"Geräte",color:"var(--color-devices)",icon:""},batIn:{name:"> Bat",color:"var(--color-battery)",icon:""},house:{name:"Haus",color:"var(--color-house)",icon:""},cp1:{name:"Ladepunkt",color:"var(--color-cp1)",icon:"Ladepunkt"},cp2:{name:"Ladepunkt",color:"var(--color-cp2)",icon:"Ladepunkt"},cp3:{name:"Ladepunkt",color:"var(--color-cp3)",icon:"Ladepunkt"},cp4:{name:"Ladepunkt",color:"var(--color-cp4)",icon:"Ladepunkt"},cp5:{name:"Ladepunkt",color:"var(--color-cp5)",icon:"Ladepunkt"},cp6:{name:"Ladepunkt",color:"var(--color-cp6)",icon:"Ladepunkt"},cp7:{name:"Ladepunkt",color:"var(--color-cp7)",icon:"Ladepunkt"},cp8:{name:"Ladepunkt",color:"var(--color-cp8)",icon:"Ladepunkt"},sh1:{name:"Gerät",color:"var(--color-sh1)",icon:"Gerät"},sh2:{name:"Gerät",color:"var(--color-sh2)",icon:"Gerät"},sh3:{name:"Gerät",color:"var(--color-sh3)",icon:"Gerät"},sh4:{name:"Gerät",color:"var(--color-sh4)",icon:"Gerät"},sh5:{name:"Gerät",color:"var(--color-sh5)",icon:"Gerät"},sh6:{name:"Gerät",color:"var(--color-sh6)",icon:"Gerät"},sh7:{name:"Gerät",color:"var(--color-sh7)",icon:"Gerät"},sh8:{name:"Gerät",color:"var(--color-sh8)",icon:"Gerät"},sh9:{name:"Gerät",color:"var(--color-sh9)",icon:"Gerät"}});class zt{constructor(){s(this,"_items",{});this.addItem("evuIn"),this.addItem("pv"),this.addItem("batOut"),this.addItem("evuOut"),this.addItem("charging"),this.addItem("devices"),this.addItem("batIn"),this.addItem("house")}get items(){return this._items}keys(){return Object.keys(this._items)}values(){return Object.values(this._items)}addItem(e){this._items[e]=be(e)}setEnergy(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].energy=a}setEnergyPv(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].energyPv=a}setEnergyBat(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].energyBat=a}setPvPercentage(e,a){this.keys().includes(e)||this.addItem(e),this._items[e].pvPercentage=a}calculateHouseEnergy(){this._items.house.energy=this._items.evuIn.energy+this._items.pv.energy+this._items.batOut.energy-this._items.evuOut.energy-this._items.batIn.energy-this._items.charging.energy-this._items.devices.energy}}let w=new zt;function vt(){w=new zt}const V=F({evuIn:be("evuIn"),pv:be("pv"),batOut:be("batOut")}),$=F({evuOut:be("evuOut"),charging:be("charging"),devices:be("devices"),batIn:be("batIn"),house:be("house")}),U=F(new Ba);Se("");const qe=Se(!1);function be(t){return{name:K[t]?K[t].name:"item",power:0,energy:0,energyPv:0,energyBat:0,pvPercentage:0,color:K[t]?K[t].color:"var(--color-charging)",icon:K[t]?K[t].icon:""}}const ee=F({active:!1,locked:!0,usePin:!1,code:"",timeout:60,localCpOnly:!1});function ht(){ee.usePin&&ee.locked?new At("#numberpad").toggle():(ee.locked=!1,setTimeout(()=>{ee.locked=!0},ee.timeout*1e3))}function Aa(t){return t==ee.code}function La(){$.house.power=$.house.power-$.devices.power}const xt=Se(new Date),Da={class:"scaled"},Ga=A({__name:"DisplayButton",props:{icon:{},bgcolor:{},color:{}},emits:["click"],setup(t,{emit:e}){const a=t,r=e;function o(){r("click",!0)}return(l,c)=>(g(),y("div",{style:te({"background-color":a.bgcolor?a.bgcolor:"var(--color-bg)",color:a.color?a.color:"var(--color-title)"}),class:"displaybutton rounded-pill",type:"button",onClick:o},[a.icon?(g(),y("span",{key:0,class:q(["fas me-2 scaled",a.icon])},null,2)):I("",!0),u("span",Da,[ue(l.$slots,"default",{},void 0,!0)])],4))}}),Z=(t,e)=>{const a=t.__vccOpts||t;for(const[r,o]of e)a[r]=o;return a},xe=Z(Ga,[["__scopeId","data-v-d2ce91a5"]]);class Va{constructor(e){s(this,"id");s(this,"name","Gerät");s(this,"power",0);s(this,"status","off");s(this,"energy",0);s(this,"runningTime",0);s(this,"configured",!1);s(this,"_showInGraph",!0);s(this,"color","white");s(this,"canSwitch",!1);s(this,"countAsHouse",!1);s(this,"energyPv",0);s(this,"energyBat",0);s(this,"pvPercentage",0);s(this,"tempConfigured",0);s(this,"temp",[300,300,300]);s(this,"on",!1);s(this,"isAutomatic",!0);s(this,"icon","");this.id=e}get showInGraph(){return this._showInGraph}set showInGraph(e){this._showInGraph=e,R()}setShowInGraph(e){this._showInGraph=e}}const L=F({});function Ut(t){t in L?console.info("Duplicate sh device message: "+t):(L[t]=new Va(t),L[t].color="var(--color-sh"+Object.values(L).length+")")}class Ea{constructor(){s(this,"graphToShow","powermeter");s(this,"cpToShow",0);s(this,"displayLocked",!0);s(this,"_showRelativeArcs",!1);s(this,"showTodayGraph",!0);s(this,"_graphPreference","live");s(this,"_usageStackOrder",0);s(this,"_displayMode","dark");s(this,"_showGrid",!1);s(this,"_smartHomeColors","normal");s(this,"_decimalPlaces",1);s(this,"_showQuickAccess",!0);s(this,"_simpleCpList",!1);s(this,"_shortCpList","no");s(this,"_showAnimations",!0);s(this,"_preferWideBoxes",!1);s(this,"_maxPower",4e3);s(this,"_fluidDisplay",!1);s(this,"_showClock","no");s(this,"_showButtonBar",!0);s(this,"_showCounters",!1);s(this,"_showVehicles",!1);s(this,"_showPrices",!1);s(this,"_debug",!1);s(this,"isEtEnabled",!1);s(this,"etPrice",20.5);s(this,"showRightButton",!0);s(this,"showLeftButton",!0);s(this,"animationDuration",300);s(this,"animationDelay",100);s(this,"zoomGraph",!1)}get showRelativeArcs(){return this._showRelativeArcs}set showRelativeArcs(e){this._showRelativeArcs=e,R()}setShowRelativeArcs(e){this._showRelativeArcs=e}get graphPreference(){return this._graphPreference}set graphPreference(e){this._graphPreference=e,R()}setGraphPreference(e){this._graphPreference=e}get usageStackOrder(){return this._usageStackOrder}set usageStackOrder(e){this._usageStackOrder=e,R()}setUsageStackOrder(e){this._usageStackOrder=e}get displayMode(){return this._displayMode}set displayMode(e){this._displayMode=e,za(e)}setDisplayMode(e){this._displayMode=e}get showGrid(){return this._showGrid}set showGrid(e){this._showGrid=e,R()}setShowGrid(e){this._showGrid=e}get decimalPlaces(){return this._decimalPlaces}set decimalPlaces(e){this._decimalPlaces=e,R()}setDecimalPlaces(e){this._decimalPlaces=e}get smartHomeColors(){return this._smartHomeColors}set smartHomeColors(e){this._smartHomeColors=e,Pt(e),R()}setSmartHomeColors(e){this._smartHomeColors=e,Pt(e)}get showQuickAccess(){return this._showQuickAccess}set showQuickAccess(e){this._showQuickAccess=e,R()}setShowQuickAccess(e){this._showQuickAccess=e}get simpleCpList(){return this._simpleCpList}set simpleCpList(e){this._simpleCpList=e,R()}setSimpleCpList(e){this._simpleCpList=e}get shortCpList(){return this._shortCpList}set shortCpList(e){this._shortCpList=e,R()}setShortCpList(e){this._shortCpList=e}get showAnimations(){return this._showAnimations}set showAnimations(e){this._showAnimations=e,R()}setShowAnimations(e){this._showAnimations=e}get preferWideBoxes(){return this._preferWideBoxes}set preferWideBoxes(e){this._preferWideBoxes=e,R()}setPreferWideBoxes(e){this._preferWideBoxes=e}get maxPower(){return this._maxPower}set maxPower(e){this._maxPower=e,R()}setMaxPower(e){this._maxPower=e}get fluidDisplay(){return this._fluidDisplay}set fluidDisplay(e){this._fluidDisplay=e,R()}setFluidDisplay(e){this._fluidDisplay=e}get showClock(){return this._showClock}set showClock(e){this._showClock=e,R()}setShowClock(e){this._showClock=e}get debug(){return this._debug}set debug(e){this._debug=e,R()}setDebug(e){this._debug=e}get showButtonBar(){return this._showButtonBar}set showButtonBar(e){this._showButtonBar=e,R()}setShowButtonBar(e){this._showButtonBar=e}get showCounters(){return this._showCounters}set showCounters(e){this._showCounters=e,R()}setShowCounters(e){this._showCounters=e}get showVehicles(){return this._showVehicles}set showVehicles(e){this._showVehicles=e,R()}setShowVehicles(e){this._showVehicles=e}get showPrices(){return this._showPrices}set showPrices(e){this._showPrices=e,R()}setShowPrices(e){this._showPrices=e}}const m=F(new Ea),Wa=992,pt=F({x:document.documentElement.clientWidth,y:document.documentElement.clientHeight});function Na(){pt.x=document.documentElement.clientWidth,pt.y=document.documentElement.clientHeight}const ja=p(()=>pt.x>=Wa),Te={stop:{mode:de.stop,name:"Stop",color:"var(--color-fg)",icon:"fa-power-off"},standby:{mode:de.standby,name:"Standby",color:"var(--color-axis",icon:"fa-pause"},pv_charging:{mode:de.pv_charging,name:"PV",color:"var(--color-pv",icon:"fa-solar-panel"},scheduled_charging:{mode:de.scheduled_charging,name:"Zielladen",color:"var(--color-battery)",icon:"fa-bullseye"},instant_charging:{mode:de.instant_charging,name:"Sofort",color:"var(--color-charging)",icon:"fa-bolt"}};function R(){Ua()}function za(t){const e=me("html");e.classed("theme-dark",t=="dark"),e.classed("theme-light",t=="light"),e.classed("theme-blue",t=="blue"),R()}function Pt(t){const e=me("html");e.classed("shcolors-normal",t=="normal"),e.classed("shcolors-standard",t=="standard"),e.classed("shcolors-advanced",t=="advanced")}function Ua(){const t={};t.hideSH=Object.values(L).filter(e=>!e.showInGraph).map(e=>e.id),t.showLG=m.graphPreference=="live",t.displayM=m.displayMode,t.stackO=m.usageStackOrder,t.showGr=m.showGrid,t.decimalP=m.decimalPlaces,t.smartHomeC=m.smartHomeColors,t.relPM=m.showRelativeArcs,t.maxPow=m.maxPower,t.showQA=m.showQuickAccess,t.simpleCP=m.simpleCpList,t.shortCP=m.shortCpList,t.animation=m.showAnimations,t.wideB=m.preferWideBoxes,t.fluidD=m.fluidDisplay,t.clock=m.showClock,t.showButtonBar=m.showButtonBar,t.showCounters=m.showCounters,t.showVehicles=m.showVehicles,t.showPrices=m.showPrices,t.debug=m.debug,document.cookie="openWBColorTheme="+JSON.stringify(t)+";max-age=16000000;samesite=strict"}const We=t=>(ke("data-v-126005ae"),t=t(),Me(),t),Fa={class:"navigation"},Ja={class:"graphbuttons"},Ra={class:"timedisplay"},Ha={class:"cpbuttons"},Ya=We(()=>u("span",{class:"fas fa-arrow-left px-2"},null,-1)),Qa=We(()=>u("span",{class:"fas fa-charging-station pe-2"},null,-1)),qa=We(()=>u("span",{class:"fas fa-lock px-4"},null,-1)),Xa=We(()=>u("span",{class:"fas fa-charging-station px-2"},null,-1)),Za=We(()=>u("span",{class:"fas fa-arrow-right pe-2"},null,-1)),Ka=A({__name:"NavigationBar",setup(t){let e;function a(){let d=Object.values(b).length;m.cpToShow=(m.cpToShow+1)%d}function r(){let d=Object.values(b).length;m.cpToShow=((m.cpToShow-1)%d+d)%d}function o(){m.graphToShow="powermeter"}function l(){m.graphToShow="powergraph"}function c(){m.graphToShow="energymeter"}return Ke(()=>{e=setInterval(()=>{xt.value=new Date},1e3)}),la(()=>{clearInterval(e)}),(d,h)=>(g(),y("div",Fa,[u("span",Ja,[u("span",Ra,B(n(va)(n(xt))),1),k(xe,{icon:"fa-chart-pie",onClick:o},{default:P(()=>[z("Leistung")]),_:1}),k(xe,{icon:"fa-chart-line",onClick:l},{default:P(()=>[z("Verlauf")]),_:1}),k(xe,{icon:"fa-chart-column",onClick:c},{default:P(()=>[z("Energie")]),_:1})]),k(xe,{icon:"fa-rectangle-list","data-bs-toggle":"modal","data-bs-target":"#statuspage"},{default:P(()=>[z("Status")]),_:1}),u("span",Ha,[k(xe,{color:"var(--color-cp0)",onClick:r},{default:P(()=>[Ya,Qa]),_:1}),k(xe,{bgcolor:n(ee).locked?"var(--color-evu)":"var(--color-pv)",onClick:n(ht)},{default:P(()=>[qa]),_:1},8,["bgcolor","onClick"]),k(xe,{color:"var(--color-cp0)",onClick:a},{default:P(()=>[Xa,Za]),_:1})])]))}}),er=Z(Ka,[["__scopeId","data-v-126005ae"]]),tr=["origin"],ar=A({__name:"PMSourceArc",props:{radius:{},cornerRadius:{},circleGapSize:{},emptyPower:{}},setup(t){const e=t,a=p(()=>{let r={name:"",power:e.emptyPower,energy:0,energyPv:0,energyBat:0,pvPercentage:0,color:"var(--color-bg)",icon:""},o=V;o["zz-empty"]=r;const l=Object.values(V).length-1,c=Lt().value(f=>f.power).startAngle(-Math.PI/2+e.circleGapSize).endAngle(Math.PI/2-e.circleGapSize).sort(null),d=Dt().innerRadius(e.radius/6*5).outerRadius(e.radius).cornerRadius(e.cornerRadius).padAngle(0),h=me("g#pmSourceArc");return h.selectAll("*").remove(),h.selectAll("sources").data(c(Object.values(o))).enter().append("path").attr("d",d).attr("fill",f=>f.data.color).attr("stroke",(f,v)=>v==l?f.data.power>0?"var(--color-scale)":"null":f.data.color),"pmSourceArc.vue"});return ua(()=>{let r=V.pv.power+V.evuIn.power+V.batOut.power;r>m.maxPower&&(m.maxPower=r)}),(r,o)=>(g(),y("g",{id:"pmSourceArc",origin:a.value},null,8,tr))}}),rr=["origin"],or=A({__name:"PMUsageArc",props:{radius:{},cornerRadius:{},circleGapSize:{},emptyPower:{}},setup(t){const e=t,a=p(()=>{let r={name:"",power:e.emptyPower,energy:0,energyPv:0,energyBat:0,pvPercentage:0,color:"var(--color-bg)",icon:""};const o=[$.evuOut,$.charging].concat(Object.values(L).filter(f=>f.configured&&!f.countAsHouse).sort((f,v)=>v.power-f.power)).concat([$.batIn,$.house]).concat(r),l=o.length-1,c=Lt().value(f=>f.power).startAngle(Math.PI*1.5-e.circleGapSize).endAngle(Math.PI/2+e.circleGapSize).sort(null),d=Dt().innerRadius(e.radius/6*5).outerRadius(e.radius).cornerRadius(e.cornerRadius),h=me("g#pmUsageArc");return h.selectAll("*").remove(),h.selectAll("consumers").data(c(o)).enter().append("path").attr("d",d).attr("fill",f=>f.data.color).attr("stroke",(f,v)=>v==l?f.data.power>0?"var(--color-scale)":"null":f.data.color),"pmUsageArc.vue"});return(r,o)=>(g(),y("g",{id:"pmUsageArc",origin:a.value},null,8,rr))}}),Ft=A({__name:"FormatWatt",props:{watt:{}},setup(t){const e=t,a=p(()=>Je(e.watt,m.decimalPlaces));return(r,o)=>B(a.value)}}),nr={key:0,id:"pmLabel"},sr=["x","y","fill","text-anchor"],ir=22,he=A({__name:"PMLabel",props:{x:{},y:{},data:{},props:{},anchor:{},labeltext:{},labelicon:{},labelcolor:{}},setup(t){const e=t,a=p(()=>e.labeltext?e.labeltext:e.props?e.props.icon+" ":e.labelicon?e.labelicon+" ":""),r=p(()=>e.labelcolor?e.labelcolor:e.props?e.props.color:""),o=p(()=>!e.data||e.data.power>0),l=p(()=>e.labeltext?"":"fas");return(c,d)=>o.value?(g(),y("g",nr,[u("text",{x:c.x,y:c.y,fill:r.value,"text-anchor":c.anchor,"font-size":ir,class:"pmLabel"},[u("tspan",{class:q(l.value)},B(a.value),3),u("tspan",null,[c.data!==void 0?(g(),E(Ft,{key:0,watt:c.data.power},null,8,["watt"])):I("",!0)])],8,sr)])):I("",!0)}}),cr={class:"wb-widget p-0 m-0 shadow"},lr={class:"d-flex justify-content-between"},ur={class:"m-4 me-0 mb-0"},dr=u("div",{class:"p-0"},"(title goes here)",-1),hr={class:"p-4 pb-0 ps-0 m-0",style:{"text-align":"right"}},pr={class:"px-4 pt-4 pb-2 wb-subwidget"},gr={class:"row"},mr={class:"col m-0 p-0"},fr={class:"container-fluid m-0 p-0"},vr={key:0},_r=u("hr",null,null,-1),yr={class:"px-4 py-2 wb-subwidget"},br={class:"row"},wr={class:"col"},Sr={class:"container-fluid m-0 p-0"},et=A({__name:"WBWidget",props:{variableWidth:{type:Boolean},fullWidth:{type:Boolean}},setup(t){const e=t,a=p(()=>e.fullWidth?"col-12":e.variableWidth&&m.preferWideBoxes?"col-lg-6":"col-lg-4");return(r,o)=>(g(),y("div",{class:q(["p-2 m-0 d-flex",a.value])},[u("div",cr,[u("div",lr,[u("h3",ur,[ue(r.$slots,"title",{},()=>[dr]),ue(r.$slots,"subtitle")]),u("div",hr,[ue(r.$slots,"buttons")])]),u("div",pr,[u("div",gr,[u("div",mr,[u("div",fr,[ue(r.$slots,"default")])])])]),r.$slots.footer!=null?(g(),y("div",vr,[_r,u("div",yr,[u("div",br,[u("div",wr,[u("div",Sr,[ue(r.$slots,"footer")])])])])])):I("",!0)])],2))}});class kr{constructor(){s(this,"active",!1);s(this,"etPriceList",new Map);s(this,"etProvider","");s(this,"etMaxPrice",0)}get etCurrentPriceString(){const[e]=ae.etPriceList.values();return(Math.round(e*10)/10).toFixed(1)+" ct"}}const ae=F(new kr),Mr={id:"powermeter",class:"p-0 m-0"},xr=["viewBox"],Pr=["transform"],Ir={transform:"scale(0.9294,1)"},$r=["x"],ve=500,_e=20,It=1,Cr=A({__name:"PowerMeter",setup(t){const e=ve,a=Math.PI/40,r=[[4],[4,6],[1,4,6],[0,2,4,6],[0,2,3,5,6]],o=[{x:-85,y:e/2*1/5},{x:0,y:e/2*1/5},{x:85,y:e/2*1/5},{x:-85,y:e/2*2/5},{x:0,y:e/2*2/5},{x:85,y:e/2*2/5},{x:0,y:e/2*3/5}],l=p(()=>ve/2-_e),c=p(()=>{let S="",j=Object.values(V).filter(W=>W.power>0);return j.length==1&&j[0].name=="PV"?S="Aktueller Verbrauch: ":S="Bezug/Verbrauch: ",S+Je($.house.power+$.charging.power+$.devices.power+$.batIn.power,m.decimalPlaces)}),d=p(()=>{let S=V.pv.power+V.evuIn.power+V.batOut.power;return m.maxPower>S?Je(m.maxPower,m.decimalPlaces):Je(S,m.decimalPlaces)}),h=p(()=>Object.values(b)),f=p(()=>{let S=0;return m.showRelativeArcs&&(S=m.maxPower-(V.pv.power+V.evuIn.power+V.batOut.power)),S<0?0:S}),v=p(()=>[$.evuOut,$.charging,$.devices,$.batIn,$.house].filter(S=>S.power>0)),O=p(()=>r[v.value.length-1]);function M(S){return o[O.value[S]]}function H(S){return Math.round(h.value[S].soc)}function se(S){return S.length>12?S.slice(0,11)+".":S}const fe=p(()=>{const[S]=ae.etPriceList.values();return Math.round(S*10)/10});return(S,j)=>(g(),E(et,{"full-width":!0},{title:P(()=>[z(" Aktuelle Leistung ")]),default:P(()=>[u("figure",Mr,[(g(),y("svg",{viewBox:"0 0 "+ve+" "+n(e)},[u("g",{transform:"translate("+ve/2+","+n(e)/2+")"},[u("g",Ir,[k(ar,{radius:l.value,"corner-radius":It,"circle-gap-size":a,"empty-power":f.value},null,8,["radius","empty-power"]),k(or,{"sh-device":n(L),radius:l.value,"corner-radius":It,"circle-gap-size":a,"empty-power":f.value},null,8,["sh-device","radius","empty-power"]),k(he,{x:0,y:-n(e)/10*2,data:n(V).pv,props:n(K).pv,anchor:"middle",config:n(m)},null,8,["y","data","props","config"]),k(he,{x:0,y:-n(e)/10*3,data:n(V).evuIn,props:n(K).evuIn,anchor:"middle",config:n(m)},null,8,["y","data","props","config"]),k(he,{x:0,y:-n(e)/10,data:n(V).batOut,props:n(K).batOut,anchor:"middle",config:n(m)},null,8,["y","data","props","config"]),n(ae).active?(g(),E(he,{key:0,x:0,y:-n(e)/10,data:n(V).batOut,props:n(K).batOut,anchor:"middle",config:n(m)},null,8,["y","data","props","config"])):I("",!0),(g(!0),y(Ie,null,Be(v.value,(W,C)=>(g(),E(he,{key:C,x:M(C).x,y:M(C).y,data:W,labelicon:W.icon,labelcolor:W.color,anchor:"middle",config:n(m)},null,8,["x","y","data","labelicon","labelcolor","config"]))),128)),h.value.length>0&&n(N)[h.value[0].connectedVehicle]?(g(),E(he,{key:1,x:-ve/2-_e/4+10,y:-n(e)/2+_e+5,labeltext:se(n(N)[h.value[0].connectedVehicle].name)+": "+H(0)+"%",labelcolor:h.value[0].color,anchor:"start",config:n(m)},null,8,["x","y","labeltext","labelcolor","config"])):I("",!0),h.value.length>1&&n(N)[h.value[1].connectedVehicle]?(g(),E(he,{key:2,x:ve/2+_e/4-10,y:-n(e)/2+_e+5,labeltext:se(n(N)[h.value[1].connectedVehicle].name)+": "+H(1)+"%",labelcolor:h.value[1].color,anchor:"end",config:n(m)},null,8,["x","y","labeltext","labelcolor","config"])):I("",!0),n(U).batterySoc>0?(g(),E(he,{key:3,x:-ve/2-_e/4+10,y:n(e)/2-_e+15,labeltext:"Speicher: "+n(U).batterySoc+"%",labelcolor:n($).batIn.color,anchor:"start",config:n(m)},null,8,["x","y","labeltext","labelcolor","config"])):I("",!0),n(ae).active?(g(),E(he,{key:4,x:ve/2+_e/4-10,y:n(e)/2-_e+15,value:fe.value,labeltext:n(ae).etCurrentPriceString,labelcolor:"var(--color-charging)",anchor:"end",config:n(m)},null,8,["x","y","value","labeltext","config"])):I("",!0),k(he,{x:0,y:0,labeltext:c.value,labelcolor:"var(--color-fg)",anchor:"middle",config:n(m)},null,8,["labeltext","config"]),n(m).showRelativeArcs?(g(),y("text",{key:5,x:ve/2-44,y:"2","text-anchor":"middle",fill:"var(--color-axis)","font-size":"12"}," Peak: "+B(d.value),9,$r)):I("",!0)])],8,Pr)],8,xr))])]),_:1}))}}),pe=500,ye=500,T={top:10,right:20,bottom:10,left:25},_t=["charging","house","batIn","devices"];class Or{constructor(){s(this,"data",[]);s(this,"_graphMode","")}get graphMode(){return this._graphMode}set graphMode(e){this._graphMode=e}}const i=F(new Or);let Xe=!0,Ve=!0;function $t(){Xe=!1}function Ct(){Ve=!1}function Br(t){Ve=t}function Ne(t){i.data=t}const Q=F({refreshTopicPrefix:"openWB/graph/alllivevaluesJson",updateTopic:"openWB/graph/lastlivevaluesJson",configTopic:"openWB/graph/config/#",initialized:!1,initCounter:0,graphRefreshCounter:0,rawDataPacks:[],duration:0,activate(){i.data=[],this.unsubscribeUpdates(),this.subscribeRefresh(),$e(this.configTopic),this.initialized=!1,this.initCounter=0,this.graphRefreshCounter=0,this.rawDataPacks=[],Gr(),qe.value=!0},deactivate(){this.unsubscribeRefresh(),this.unsubscribeUpdates(),Oe(this.configTopic)},subscribeRefresh(){for(let t=1;t<17;t++)$e(this.refreshTopicPrefix+t)},unsubscribeRefresh(){for(let t=1;t<17;t++)Oe(this.refreshTopicPrefix+t)},subscribeUpdates(){$e(this.updateTopic)},unsubscribeUpdates(){Oe(this.updateTopic)}}),J=F({topic:"openWB/log/daily/#",date:new Date,activate(){if(i.graphMode=="day"||i.graphMode=="today"){i.graphMode=="today"&&(this.date=new Date);const t=this.date.getFullYear().toString()+(this.date.getMonth()+1).toString().padStart(2,"0")+this.date.getDate().toString().padStart(2,"0");$e(this.topic),ft({command:"getDailyLog",data:{day:t}})}},deactivate(){Oe(this.topic)},back(){this.date=new Date(this.date.setTime(this.date.getTime()-864e5))},forward(){this.date=new Date(this.date.setTime(this.date.getTime()+864e5))},setDate(t){this.date=t},getDate(){return this.date}}),we=F({topic:"openWB/log/monthly/#",month:new Date().getMonth()+1,year:new Date().getFullYear(),activate(){const t=this.year.toString()+this.month.toString().padStart(2,"0");i.data=[],$e(this.topic),ft({command:"getMonthlyLog",data:{month:t}})},deactivate(){Oe(this.topic)},back(){this.month-=1,this.month<1&&(this.month=12,this.year-=1),this.activate()},forward(){const t=new Date;t.getFullYear()==this.year?this.month-112&&(this.month=1,this.year+=1)),this.activate()},getDate(){return new Date(this.year,this.month)}}),Pe=F({topic:"openWB/log/yearly/#",month:new Date().getMonth()+1,year:new Date().getFullYear(),activate(){const t=this.year.toString();i.data=[],$e(this.topic),ft({command:"getYearlyLog",data:{year:t}})},deactivate(){Oe(this.topic)},back(){this.year-=1,this.activate()},forward(){this.year0&&(w.items[t].energyPv+=1e3/12*(e[t]*(e.pv-e.evuOut))/(e.pv-e.evuOut+e.evuIn+e.batOut),w.items[t].energyBat+=1e3/12*(e[t]*e.batOut)/(e.pv-e.evuOut+e.evuIn+e.batOut))}function Lr(t,e){e[t]>0&&(w.items[t].energyPv+=1e3*(e[t]*(e.pv-e.evuOut))/(e.pv-e.evuOut+e.evuIn+e.batOut),w.items[t].energyBat+=1e3*(e[t]*e.batOut)/(e.pv-e.evuOut+e.evuIn+e.batOut))}const Dr=["evuIn","pv","batIn","evuOut"],De=Se(!1);function yt(t,e){Object.entries(t).length>0?(De.value=!1,Object.entries(t.counter).forEach(([a,r])=>{(e.length==0||e.includes(a))&&(w.items.evuIn.energy+=r.energy_imported,w.items.evuOut.energy+=r.energy_exported)}),w.items.pv.energy=t.pv.all.energy_exported,t.bat.all&&(w.items.batIn.energy=t.bat.all.energy_imported,w.items.batOut.energy=t.bat.all.energy_exported),Object.entries(t.cp).forEach(([a,r])=>{a=="all"?w.setEnergy("charging",r.energy_imported):w.setEnergy(a,r.energy_imported)}),w.setEnergy("devices",0),Object.entries(t.sh).forEach(([a,r])=>{w.setEnergy(a,r.energy_imported);const o=a.substring(2);L[+o].countAsHouse||(w.items.devices.energy+=r.energy_imported)}),t.hc&&t.hc.all?w.setEnergy("house",t.hc.all.energy_imported):w.calculateHouseEnergy(),w.keys().map(a=>{Dr.includes(a)||(w.setPvPercentage(a,Math.round((w.items[a].energyPv+w.items[a].energyBat)/w.items[a].energy*100)),_t.includes(a)&&($[a].energy=w.items[a].energy,$[a].energyPv=w.items[a].energyPv,$[a].energyBat=w.items[a].energyBat,$[a].pvPercentage=w.items[a].pvPercentage))}),i.graphMode=="today"&&(Object.values(b).map(a=>{const r=w.items["cp"+a.id];r&&(a.energyPv=r.energyPv,a.energyBat=r.energyBat,a.pvPercentage=r.pvPercentage)}),Object.values(L).map(a=>{const r=w.items["sh"+a.id];r&&(a.energy=r.energy,a.energyPv=r.energyPv,a.energyBat=r.energyBat,a.pvPercentage=r.pvPercentage)}))):De.value=!0,qe.value=!0}function Gr(){w.keys().map(t=>{_t.includes(t)&&($[t].energy=w.items[t].energy,$[t].energyPv=0,$[t].energyBat=0,$[t].pvPercentage=0)}),Object.values(b).map(t=>{t.energyPv=0,t.energyBat=0,t.pvPercentage=0}),Object.values(L).map(t=>{t.energyPv=0,t.energyBat=0,t.pvPercentage=0})}const ge=p(()=>{const t=Ee(i.data,e=>e.date);return t[1]?ut().domain(Array.from({length:t[1]},(e,a)=>a+1)).paddingInner(.4).range([0,pe-T.left-2]):ut().range([0,0])});function bt(){switch(i.graphMode){case"live":i.graphMode="today",m.showRightButton=!0,X();break;case"today":i.graphMode="day",J.date=new Date,J.back(),X();break;case"day":J.back(),X();break;case"month":we.back();break;case"year":Pe.back();break}}function Jt(){const t=new Date;switch(i.graphMode){case"live":break;case"today":i.graphMode="live",m.showRightButton=!1,X();break;case"day":J.forward(),J.date.getDate()==t.getDate()&&J.date.getMonth()==t.getMonth()&&J.date.getFullYear()==t.getFullYear()&&(i.graphMode="today"),X();break;case"month":we.forward();break;case"year":Pe.forward();break}}function Rt(){switch(i.graphMode){case"live":bt();break;case"day":case"today":i.graphMode="month",X();break;case"month":i.graphMode="year",X();break}}function Ht(){switch(i.graphMode){case"year":i.graphMode="month",X();break;case"month":i.graphMode="today",X();break;case"today":case"day":i.graphMode="live",X();break}}function Vr(t){if(i.graphMode=="day"||i.graphMode=="today"){J.setDate(t);const e=new Date;J.date.getDate()==e.getDate()&&J.date.getMonth()==e.getMonth()&&J.date.getFullYear()==e.getFullYear()?i.graphMode="today":i.graphMode="day",X()}}const Er=["origin","transform"],Wr=A({__name:"PGSourceGraph",props:{width:{},height:{},margin:{}},setup(t){const e=t,a={house:"var(--color-house)",batIn:"var(--color-battery)",inverter:"var(--color-pv)",batOut:"var(--color-battery)",selfUsage:"var(--color-pv)",evuOut:"var(--color-export)",evuIn:"var(--color-evu)"};var r,o;const l=m.showAnimations?m.animationDuration:0,c=m.showAnimations?m.animationDelay:0,d=p(()=>{const _=me("g#pgSourceGraph");i.graphMode=="month"||i.graphMode=="year"?C(_):W(_),_.selectAll(".axis").remove();const x=_.append("g").attr("class","axis");return x.call(fe.value),x.selectAll(".tick").attr("font-size",12),x.selectAll(".tick line").attr("stroke",j.value).attr("stroke-width",S.value),x.select(".domain").attr("stroke","var(--color-bg)"),"pgSourceGraph.vue"}),h=p(()=>i.graphMode=="month"||i.graphMode=="year"?["evuIn","batOut","selfUsage","evuOut"]:["selfUsage","evuOut","batOut","evuIn"]),f=p(()=>Ce().domain([0,i.data.length-1]).range([0,e.width])),v=p(()=>Gt().keys(h.value)),O=p(()=>v.value(i.data)),M=p(()=>Ce().range([e.height-10,0]).domain(i.graphMode=="year"?[0,Math.ceil(H.value[1]*10)/10]:[0,Math.ceil(H.value[1])])),H=p(()=>{let _=Ee(i.data,x=>Math.max(x.pv+x.evuIn+x.batOut,x.selfUsage+x.evuOut));return _[0]!=null&&_[1]!=null?(i.graphMode=="year"&&(_[0]=_[0]/1e3,_[1]=_[1]/1e3),_):[0,0]}),se=p(()=>i.graphMode=="month"||i.graphMode=="year"?-e.width-e.margin.right-22:-e.width),fe=p(()=>gt(M.value).tickSizeInner(se.value).ticks(4).tickFormat(_=>(_==0?"":Math.round(_*10)/10).toLocaleString(void 0))),S=p(()=>m.showGrid?"0.5":"1"),j=p(()=>m.showGrid?"var(--color-grid)":"var(--color-bg)");function W(_){const x=Re().x((G,le)=>f.value(le)).y(M.value(0)),D=Re().x((G,le)=>f.value(le)).y0(G=>M.value(i.graphMode=="year"?G[0]/1e3:G[0])).y1(G=>M.value(i.graphMode=="year"?G[1]/1e3:G[1]));Xe?(_.selectAll("*").remove(),r=_.selectAll(".sourceareas").data(O.value).enter().append("path").attr("fill",(G,le)=>a[h.value[le]]).attr("d",G=>x(G)),r.transition().duration(l).delay(c).ease(Le).attr("d",G=>D(G)),$t()):r.data(O.value).transition().duration(0).ease(Le).attr("d",G=>D(G))}function C(_){Xe?(_.selectAll("*").remove(),o=_.selectAll(".sourcebar").data(O.value).enter().append("g").attr("fill",(x,D)=>a[h.value[D]]).selectAll("rect").data(x=>x).enter().append("rect").attr("x",(x,D)=>ge.value(i.data[D].date)??0).attr("y",()=>M.value(0)).attr("height",0).attr("width",ge.value.bandwidth()),o.transition().duration(l).delay(c).ease(Le).attr("height",x=>i.graphMode=="year"?M.value(x[0]/1e3)-M.value(x[1]/1e3):M.value(x[0])-M.value(x[1])).attr("y",x=>i.graphMode=="year"?M.value(x[1]/1e3):M.value(x[1])),$t()):(_.selectAll("*").remove(),o=_.selectAll(".sourcebar").data(O.value).enter().append("g").attr("fill",(x,D)=>a[h.value[D]]).selectAll("rect").data(x=>x).enter().append("rect").attr("x",(x,D)=>ge.value(i.data[D].date)??0).attr("y",x=>i.graphMode=="year"?M.value(x[1]/1e3):M.value(x[1])).attr("width",ge.value.bandwidth()).attr("height",x=>i.graphMode=="year"?M.value(x[0]/1e3)-M.value(x[1]/1e3):M.value(x[0])-M.value(x[1])))}return(_,x)=>(g(),y("g",{id:"pgSourceGraph",origin:d.value,transform:"translate("+_.margin.left+","+_.margin.top+")"},null,8,Er))}}),Nr=["origin","transform"],jr=A({__name:"PGUsageGraph",props:{width:{},height:{},margin:{},stackOrder:{}},setup(t){const e=t,a=[["house","charging","devices","batIn"],["charging","devices","house","batIn"],["devices","charging","house","batIn"]],r={house:"var(--color-house)",charging:"var(--color-charging)",batIn:"var(--color-battery)",batOut:"var(--color-battery)",selfUsage:"var(--color-pv)",evuOut:"var(--color-export)",evuIn:"var(--color-evu)",cp0:"var(--color-cp0)",cp1:"var(--color-cp1)",cp2:"var(--color-cp2)",cp3:"var(--color-cp3)",sh1:"var(--color-sh1)",sh2:"var(--color-sh2)",sh3:"var(--color-sh3)",sh4:"var(--color-sh4)",devices:"var(--color-devices)"};var o,l;const c=m.showAnimations?m.animationDuration:0,d=m.showAnimations?m.animationDelay:0,h=p(()=>{const C=me("g#pgUsageGraph");i.graphMode=="month"||i.graphMode=="year"?W(C):j(C),C.selectAll(".axis").remove();const _=C.append("g").attr("class","axis");return _.call(S.value),_.selectAll(".tick").attr("font-size",12).attr("color","var(--color-axis)"),m.showGrid?_.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"):_.selectAll(".tick line").attr("stroke","var(--color-bg)"),_.select(".domain").attr("stroke","var(--color-bg)"),"pgUsageGraph.vue"}),f=p(()=>Gt().keys(H.value)),v=p(()=>f.value(i.data)),O=p(()=>Ce().domain([0,i.data.length-1]).range([0,e.width])),M=p(()=>Ce().range([e.height+10,2*e.height]).domain(i.graphMode=="year"?[0,Math.ceil(se.value[1]*10)/10]:[0,Math.ceil(se.value[1])])),H=p(()=>{if(i.graphMode!="today"&&i.graphMode!="day")return a[e.stackOrder];{const C=a[e.stackOrder].slice(),_=C.indexOf("charging");C.splice(_,1);const x=/cp\d+/;let D=[];return i.data.length>0&&(D=Object.keys(i.data[0]).reduce((G,le)=>(le.match(x)&&G.push(le),G),[])),D.map((G,le)=>{C.splice(_+le,0,G),r[G]="var(--color-cp"+le+")"}),C}}),se=p(()=>{let C=Ee(i.data,_=>_.house+_.charging+_.batIn+_.devices);return C[0]!=null&&C[1]!=null?(i.graphMode=="year"&&(C[0]=C[0]/1e3,C[1]=C[1]/1e3),C):[0,0]}),fe=p(()=>i.graphMode=="month"||i.graphMode=="year"?-e.width-e.margin.right-22:-e.width),S=p(()=>gt(M.value).tickSizeInner(fe.value).ticks(4).tickFormat(C=>(C==0?"":Math.round(C*10)/10).toLocaleString(void 0)));function j(C){const _=Re().x((D,G)=>O.value(G)).y(M.value(0)),x=Re().x((D,G)=>O.value(G)).y0(D=>M.value(D[0])).y1(D=>M.value(D[1]));m.showAnimations?Ve?(C.selectAll("*").remove(),o=C.selectAll(".usageareas").data(v.value).enter().append("path").attr("d",D=>_(D)).attr("fill",(D,G)=>r[H.value[G]]),o.transition().duration(300).delay(100).ease(Le).attr("d",D=>x(D)),Ct()):(C.selectAll("*").remove(),C.selectAll(".usageareas").data(v.value).enter().append("path").attr("d",D=>x(D)).attr("fill",(D,G)=>r[H.value[G]])):(C.selectAll("*").remove(),C.selectAll(".usageareas").data(v.value).enter().append("path").attr("d",D=>x(D)).attr("fill",(D,G)=>r[H.value[G]]))}function W(C){Ve?(C.selectAll("*").remove(),l=C.selectAll(".usagebar").data(v.value).enter().append("g").attr("fill",(_,x)=>r[a[e.stackOrder][x]]).selectAll("rect").data(_=>_).enter().append("rect").attr("x",(_,x)=>ge.value(i.data[x].date)??0).attr("y",()=>M.value(0)).attr("height",0).attr("width",ge.value.bandwidth()),l.transition().duration(c).delay(d).ease(Le).attr("y",_=>i.graphMode=="year"?M.value(_[0]/1e3):M.value(_[0])).attr("height",_=>i.graphMode=="year"?M.value(_[1]/1e3)-M.value(_[0]/1e3):M.value(_[1])-M.value(_[0])),Ct()):(C.selectAll("*").remove(),l=C.selectAll(".usagebar").data(v.value).enter().append("g").attr("fill",(_,x)=>r[a[e.stackOrder][x]]).selectAll("rect").data(_=>_).enter().append("rect").attr("x",(_,x)=>ge.value(i.data[x].date)??0).attr("y",_=>i.graphMode=="year"?M.value(_[0]/1e3):M.value(_[0])).attr("height",_=>i.graphMode=="year"?M.value(_[1]/1e3)-M.value(_[0]/1e3):M.value(_[1])-M.value(_[0])).attr("width",ge.value.bandwidth()))}return(C,_)=>(g(),y("g",{id:"pgUsageGraph",origin:h.value,transform:"translate("+C.margin.left+","+C.margin.top+")"},null,8,Nr))}}),zr=["transform"],Ur=["origin","transform"],Fr=["origin","transform"],Jr={key:0},Rr=["width","height"],Hr={key:1},Yr=["y","width","height"],nt=12,Qr=A({__name:"PGXAxis",props:{width:{},height:{},margin:{}},setup(t){const e=t,a=p(()=>tt(d.value).ticks(4).tickSizeInner(c.value).tickFormat(kt("%H:%M"))),r=p(()=>da(d.value).ticks(4).tickSizeInner(c.value+3).tickFormat(kt(""))),o=p(()=>tt(ge.value).ticks(4).tickSizeInner(c.value).tickFormat(v=>v.toString())),l=p(()=>tt(ge.value).ticks(4).tickSizeInner(c.value).tickFormat(()=>"")),c=p(()=>i.graphMode!=="month"&&i.graphMode!=="year"?m.showGrid?-(e.height/2-7):-10:0),d=p(()=>{let v=Ee(i.data,O=>O.date);return v[0]&&v[1]?He().domain(v).range([0,e.width]):He().range([0,0])}),h=p(()=>{let v=me("g#PGXAxis");return v.selectAll("*").remove(),i.graphMode=="month"||i.graphMode=="year"?v.call(o.value):v.call(a.value),v.selectAll(".tick > text").attr("fill",(O,M)=>M>0||i.graphMode=="month"||i.graphMode=="year"?"var(--color-axis)":"var(--color-bg)").attr("font-size",nt),m.showGrid?v.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"):v.selectAll(".tick line").attr("stroke","var(--color-bg)"),v.select(".domain").attr("stroke","var(--color-bg)"),v.append("text").attr("x",-e.margin.left).attr("y",12).attr("fill","var(--color-axis)").attr("font-size",nt).text(i.graphMode=="year"?"MW":"kW").attr("text-anchor","start"),"PGXAxis.vue"}),f=p(()=>{let v=me("g#PGXAxis2");return v.selectAll("*").remove(),i.graphMode=="month"||i.graphMode=="year"?v.call(l.value):v.call(r.value),v.selectAll(".tick > text").attr("fill",(O,M)=>M>0||i.graphMode=="month"||i.graphMode=="year"?"var(--color-axis)":"var(--color-bg)").attr("font-size",nt),m.showGrid?(v.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"),v.select(".domain").attr("stroke","var(--color-bg)")):v.selectAll(".tick line").attr("stroke","var(--color-bg)"),v.select(".domain").attr("stroke","var(--color-bg)"),"PGXAxis2.vue"});return(v,O)=>(g(),y("g",{transform:"translate("+v.margin.left+","+v.margin.top+")"},[u("g",{id:"PGXAxis",class:"axis",origin:h.value,transform:"translate(0,"+(v.height/2-6)+")"},null,8,Ur),u("g",{id:"PGXAxis2",class:"axis",origin:f.value,transform:"translate(0,"+(v.height/2+10)+")"},null,8,Fr),n(m).showGrid?(g(),y("g",Jr,[u("rect",{x:"0",y:"0",width:v.width,height:v.height/2-10,fill:"none",stroke:"var(--color-grid)","stroke-width":"0.5"},null,8,Rr)])):I("",!0),n(m).showGrid?(g(),y("g",Hr,[u("rect",{x:"0",y:v.height/2+10,width:v.width,height:v.height/2-10,fill:"none",stroke:"var(--color-grid)","stroke-width":"0.5"},null,8,Yr)])):I("",!0)],8,zr))}}),qr=["d"],Xr=["d","stroke"],Zr=["x","y","text-anchor"],st=A({__name:"PgSoc",props:{width:{},height:{},margin:{},order:{}},setup(t){const e=t,a=p(()=>{let O=Ee(i.data,M=>M.date);return O[0]&&O[1]?He().domain(O).range([0,e.width]):He().range([0,0])}),r=p(()=>Ce().range([e.height-10,0]).domain([0,100])),o=p(()=>{let M=ha().x(H=>a.value(H.date)).y(H=>r.value(e.order==2?H.batSoc:H["soc"+h.value.connectedVehicle])??r.value(0))(i.data);return M||""}),l=p(()=>e.order==2?"Speicher":h.value.vehicleName),c=p(()=>{switch(e.order){case 0:return"var(--color-cp1)";case 1:return"var(--color-cp2)";case 2:return"var(--color-battery)";default:return"red"}}),d=p(()=>{switch(e.order){case 0:return e.width-3;case 1:return 3;case 2:return e.width/2;default:return 0}}),h=p(()=>{const O=e.order==2?0:e.order;return Object.values(b)[O]}),f=p(()=>{if(i.data.length>0){let O;switch(e.order){case 0:return O=i.data.length-1,r.value(i.data[O]["soc"+h.value.connectedVehicle]+2);case 1:return O=0,r.value(i.data[O]["soc"+h.value.connectedVehicle]+2);case 2:return O=Math.round(i.data.length/2),r.value(i.data[O].batSoc+2);default:return 0}}else return 0}),v=p(()=>{switch(e.order){case 0:return"end";case 1:return"start";case 2:return"middle";default:return"middle"}});return(O,M)=>(g(),y(Ie,null,[u("path",{class:"soc-baseline",d:o.value,stroke:"var(--color-bg)","stroke-width":"1",fill:"none"},null,8,qr),u("path",{class:"soc-dashes",d:o.value,stroke:c.value,"stroke-width":"1",style:{strokeDasharray:"3,3"},fill:"none"},null,8,Xr),u("text",{class:"cpname",x:d.value,y:f.value,style:te({fill:c.value,fontSize:10}),"text-anchor":v.value},B(l.value),13,Zr)],64))}}),Kr=["transform"],eo=A({__name:"PgSocAxis",props:{width:{},height:{},margin:{}},setup(t){const e=t,a=p(()=>Ce().range([e.height-10,0]).domain([0,100])),r=p(()=>pa(a.value).ticks(5).tickFormat(l=>l.toString()+"%"));function o(){let l=me("g#PGSocAxis");l.call(r.value),l.selectAll(".tick").attr("font-size",12),l.selectAll(".tick line").attr("stroke","var(--color-bg)"),l.select(".domain").attr("stroke","var(--color-bg)")}return Ke(()=>{o()}),(l,c)=>(g(),y("g",{id:"PGSocAxis",class:"axis",transform:"translate("+(l.width-20)+",0)"},null,8,Kr))}}),to={class:"btn-group m-0",role:"group","aria-label":"radiobar"},ao=["id","value"],ro=A({__name:"RadioBarInput",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=e,o=p({get(){return a.modelValue},set(d){r("update:modelValue",d)}});function l(d){let h=a.options[d].color?a.options[d].color:"var(--color-fg)";return a.options[d].active?{color:"var(--color-bg)",background:h}:{color:h}}function c(d){let h=d.target;for(;h&&!h.value&&h.parentElement;)h=h.parentElement;h.value&&(o.value=h.value)}return(d,h)=>(g(),y("div",null,[u("div",to,[(g(!0),y(Ie,null,Be(d.options,(f,v)=>(g(),y("button",{id:"radio-"+f.value,key:v,class:q(["btn btn-outline-secondary btn-sm radiobutton mx-0 mb-0 px-2",f.value==o.value?"active":""]),value:f.value,style:te(l(v)),onClick:c},[u("span",{style:te(l(v)),class:"scaled"},[f.icon?(g(),y("i",{key:0,class:q(["fa-solid",f.icon])},null,2)):I("",!0),z(" "+B(f.text),1)],4)],14,ao))),128))])]))}}),Yt=Z(ro,[["__scopeId","data-v-60f5d4c2"]]),wt=t=>(ke("data-v-7fd067cd"),t=t(),Me(),t),oo=wt(()=>u("i",{class:"fa-solid fa-xl fa-chevron-circle-up"},null,-1)),no=[oo],so=wt(()=>u("span",{class:"fa-solid fa-xl fa-chevron-circle-left arrowButton"},null,-1)),io=[so],co={key:0,class:"fa-solid fa-xl fa-chevron-circle-down p-1",style:{color:"var(--color-bg)"}},lo=wt(()=>u("span",{class:"fa-solid fa-xl fa-circle-check"},null,-1)),uo=[lo],ho=A({__name:"PgSelector",props:{widgetid:{},showLeftButton:{type:Boolean},showRightButton:{type:Boolean},ignoreLive:{type:Boolean}},emits:["shiftLeft","shiftRight","shiftUp","shiftDown"],setup(t){const e=t,a=Se(0),r=p(()=>{switch(i.graphMode){case"live":return e.ignoreLive?"heute":`${Q.duration} min`;case"today":return"heute";case"day":return J.date.getDate()+"."+(J.date.getMonth()+1)+".";case"month":return _a(we.month-1,we.year);case"year":return Pe.year.toString();default:return"???"}}),o=["live","today","day","month","year"],l=["Live","Heute","Tag","Monat","Jahr"],c=p({get(){return i.graphMode},set(S){switch(S){case"day":f();break;case"today":v();break;case"live":h();break;case"month":O();break;case"year":M()}}});function d(){a.value+=1,a.value>1&&(a.value=0)}function h(){i.graphMode!="live"&&(i.graphMode="live",X())}function f(){i.graphMode!="day"&&i.graphMode!="today"&&(i.graphMode="day",X())}function v(){i.graphMode!="today"&&(i.graphMode="today",Vr(new Date),X())}function O(){i.graphMode!="month"&&(i.graphMode="month",X())}function M(){i.graphMode!="year"&&(i.graphMode="year",X())}const H=p(()=>a.value>0?{border:"1px solid var(--color-frame)"}:""),se=p(()=>a.value==1?"justify-content-between":"justify-content-end"),fe=p(()=>a.value==1?"justify-content-between":"justify-content-center");return(S,j)=>(g(),y("div",{class:"d-flex flex-column justify-content-center pgselector rounded",style:te(H.value)},[a.value==2?(g(),E(Yt,{key:0,id:"pgm2",modelValue:c.value,"onUpdate:modelValue":j[0]||(j[0]=W=>c.value=W),class:"m-2",options:o.map((W,C)=>({text:l[C],value:W,color:"var(--color-menu)",active:W==n(i).graphMode}))},null,8,["modelValue","options"])):I("",!0),a.value==1?(g(),y("span",{key:1,type:"button",class:q(["arrowButton d-flex align-self-center mb-3 mt-3",{disabled:!e.showLeftButton}]),onClick:j[1]||(j[1]=W=>S.$emit("shiftUp"))},no,2)):I("",!0),u("div",{class:q(["d-flex align-items-center",fe.value])},[a.value==1?(g(),y("span",{key:0,type:"button",class:q(["p-1",{disabled:!e.showLeftButton}]),onClick:j[2]||(j[2]=W=>S.$emit("shiftLeft"))},io,2)):I("",!0),a.value<2?(g(),y("span",{key:1,type:"button",class:"btn-outline-secondary p-2 px-3 badge rounded-pill datebadge",onClick:d},B(r.value),1)):I("",!0),a.value==1?(g(),y("span",{key:2,id:"graphRightButton",type:"button",class:q(["arrowButton fa-solid fa-xl fa-chevron-circle-right p-1",{disabled:!e.showRightButton}]),onClick:j[3]||(j[3]=W=>S.$emit("shiftRight"))},null,2)):I("",!0)],2),u("div",{class:q(["d-flex align-items-center",se.value])},[a.value==1?(g(),y("span",co)):I("",!0),a.value==1?(g(),y("span",{key:1,id:"graphLeftButton",type:"button",class:q(["arrowButton fa-solid fa-xl fa-chevron-circle-down p-1",{disabled:!e.showLeftButton}]),onClick:j[4]||(j[4]=W=>S.$emit("shiftDown"))},null,2)):I("",!0),a.value>0?(g(),y("span",{key:2,type:"button",class:"p-1",onClick:j[5]||(j[5]=W=>a.value=0)},uo)):I("",!0)],2)],4))}}),Qt=Z(ho,[["__scopeId","data-v-7fd067cd"]]),qt=t=>(ke("data-v-bb5945e3"),t=t(),Me(),t),po={class:"d-flex justify-content-end"},go=qt(()=>u("span",{class:"fa-solid fa-lg ps-1 fa-magnifying-glass"},null,-1)),mo=[go],fo=["viewBox"],vo=["transform"],_o={id:"button"},yo=["x","y"],bo=qt(()=>u("tspan",{fill:"var(--color-menu)",class:"fas fa-lg"},B(""),-1)),wo=[bo],So=2,ko="Leistung / Ladestand ",Mo=A({__name:"PowerGraph",setup(t){function e(){let r=m.usageStackOrder+1;r>So&&(r=0),m.usageStackOrder=r,Br(!0)}function a(){m.zoomGraph=!m.zoomGraph}return(r,o)=>(g(),E(et,{"full-width":!0},{title:P(()=>[z(B(ko))]),buttons:P(()=>[u("div",po,[k(Qt,{widgetid:"graphsettings","show-left-button":!0,"show-right-button":!0,"ignore-live":!1,onShiftLeft:n(bt),onShiftRight:n(Jt),onShiftUp:n(Rt),onShiftDown:n(Ht)},null,8,["onShiftLeft","onShiftRight","onShiftUp","onShiftDown"]),n(ja)?(g(),y("span",{key:0,type:"button",class:"ms-1 p-0 pt-1",onClick:a},mo)):I("",!0)])]),default:P(()=>[u("figure",{id:"powergraph",class:"p-0 m-0",onClick:e},[(g(),y("svg",{viewBox:"0 0 "+n(pe)+" "+n(ye)},[k(Wr,{width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T)},null,8,["width","height","margin"]),k(jr,{width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),"stack-order":n(m).usageStackOrder},null,8,["width","height","margin","stack-order"]),k(Qr,{width:n(pe)-n(T).left-2*n(T).right,height:n(ye)-n(T).top-n(T).bottom,margin:n(T),"graph-data":n(i)},null,8,["width","height","margin","graph-data"]),u("g",{transform:"translate("+n(T).left+","+n(T).top+")"},[(n(i).graphMode=="day"||n(i).graphMode=="today"||n(i).graphMode=="live")&&Object.values(n(b)).length>0?(g(),E(st,{key:0,width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),order:0},null,8,["width","height","margin"])):I("",!0),(n(i).graphMode=="day"||n(i).graphMode=="today"||n(i).graphMode=="live")&&Object.values(n(b)).length>1?(g(),E(st,{key:1,width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),order:1},null,8,["width","height","margin"])):I("",!0),(n(i).graphMode=="day"||n(i).graphMode=="today")&&n(U).isBatteryConfigured?(g(),E(st,{key:2,width:n(pe)-n(T).left-2*n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T),order:2},null,8,["width","height","margin"])):I("",!0),n(i).graphMode=="day"||n(i).graphMode=="today"?(g(),E(eo,{key:3,width:n(pe)-n(T).left-n(T).right,height:(n(ye)-n(T).top-n(T).bottom)/2,margin:n(T)},null,8,["width","height","margin"])):I("",!0)],8,vo),u("g",_o,[u("text",{x:n(pe),y:n(ye)-10,color:"var(--color-menu)","text-anchor":"end"},wo,8,yo)])],8,fo))])]),_:1}))}}),xo=Z(Mo,[["__scopeId","data-v-bb5945e3"]]),Po=["id"],Io=["x","width","height","fill"],$o=["x","width","height"],Co=["x","y","width","height"],Oo=A({__name:"EmBar",props:{item:{},xScale:{},yScale:{},margin:{},height:{},barcount:{},autarchy:{},autText:{}},setup(t){const e=t,a=p(()=>e.height-e.yScale(e.item.energy)-e.margin.top-e.margin.bottom),r=p(()=>e.item.energyPv>0?e.height-e.yScale(e.item.energyPv)-e.margin.top-e.margin.bottom:0),o=p(()=>e.item.energyPv>0?e.height-e.yScale(e.item.energyBat)-e.margin.top-e.margin.bottom:0);return(l,c)=>(g(),y("g",{id:"bar-"+e.item.name,transform:"scale(1,-1) translate (0,-445)"},[u("rect",{class:"bar",x:e.xScale(l.item.name),y:"0",width:e.xScale.bandwidth(),height:a.value,fill:l.item.color},null,8,Io),u("rect",{class:"bar",x:e.xScale(l.item.name)+e.xScale.bandwidth()/6,y:"0",width:e.xScale.bandwidth()*2/3,height:r.value,fill:"var(--color-pv)","fill-opacity":"66%"},null,8,$o),u("rect",{class:"bar",x:e.xScale(l.item.name)+e.xScale.bandwidth()/6,y:r.value,width:e.xScale.bandwidth()*2/3,height:o.value,fill:"var(--color-battery)","fill-opacity":"66%"},null,8,Co)],8,Po))}}),Bo={id:"emBargraph"},To=u("animateTransform",{"attribute-name":"transform",type:"scale",from:"1 0",to:"1 1",begin:"0s",dur:"2s"},null,-1),Ao=A({__name:"EMBarGraph",props:{plotdata:{},xScale:{},yScale:{},margin:{},height:{}},setup(t){const e=t;function a(o){if(o.name=="PV"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,d=(i.graphMode=="live"||i.graphMode=="day"?$:w.items).evuOut.energy,h=l.pv.energy;return Math.round((h-d)/h*100)}else if(o.name=="Netz"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,c=i.graphMode=="live"||i.graphMode=="day"?$:w.items,d=c.evuOut.energy,h=l.evuIn.energy,f=l.pv.energy,v=l.batOut.energy,O=c.batIn.energy;return Math.round((f+v-d-O)/(f+v+h-d-O)*100)}else return o.pvPercentage}function r(o){return o.name=="PV"?"Eigen":"Aut"}return(o,l)=>(g(),y("g",Bo,[(g(!0),y(Ie,null,Be(e.plotdata,(c,d)=>(g(),y("g",{key:d},[k(Oo,{item:c,"x-scale":e.xScale,"y-scale":e.yScale,margin:e.margin,height:e.height,barcount:e.plotdata.length,"aut-text":r(c),autarchy:a(c)},null,8,["item","x-scale","y-scale","margin","height","barcount","aut-text","autarchy"])]))),128)),To]))}}),Lo=["origin"],Do=A({__name:"EMYAxis",props:{yScale:{type:[Function,Object]},width:{},fontsize:{}},setup(t){const e=t,a=p(()=>gt(e.yScale).tickFormat(o=>o>0?(o/1e3).toString():"").ticks(6).tickSizeInner(-e.width)),r=p(()=>{const o=me("g#emYAxis");return o.attr("class","axis").call(a.value),o.append("text").attr("y",6).attr("dy","0.71em").attr("text-anchor","end").text("energy"),o.selectAll(".tick").attr("font-size",e.fontsize),m.showGrid?o.selectAll(".tick line").attr("stroke","var(--color-grid)").attr("stroke-width","0.5"):o.selectAll(".tick line").attr("stroke","var(--color-bg)"),o.select(".domain").attr("stroke","var(--color-bg)"),"emYAxis.vue"});return(o,l)=>(g(),y("g",{id:"emYAxis",class:"axis",origin:r.value},null,8,Lo))}}),Go=["id"],Vo=["x","y","font-size"],Eo=["x","y","font-size","fill"],Wo=["x","y","font-size","fill"],No=A({__name:"EmLabel",props:{item:{},xScale:{},yScale:{},margin:{},height:{},barcount:{},autarchy:{},autText:{}},setup(t){const e=t,a=p(()=>e.autarchy?e.yScale(e.item.energy)-25:e.yScale(e.item.energy)-10),r=p(()=>{let h=16,f=e.barcount;return f<=5?h=16:f==6?h=14:f>6&&f<=8?h=13:f==9?h=11:f==10?h=10:h=9,h}),o=p(()=>{let h=12,f=e.barcount;return f<=5?h=12:f==6?h=11:f>6&&f<=8||f==9?h=8:f==10?h=7:h=6,h});function l(h,f){return f.length>o.value?f.substring(0,o.value)+".":f}function c(){return e.autarchy?e.autText+": "+e.autarchy.toLocaleString(void 0)+" %":""}function d(){return"var(--color-pv)"}return(h,f)=>(g(),y("g",{id:"barlabel-"+e.item.name},[u("text",{x:e.xScale(h.item.name)+e.xScale.bandwidth()/2,y:a.value,"font-size":r.value,"text-anchor":"middle",fill:"var(--color-menu)"},B(n(Vt)(h.item.energy,n(m).decimalPlaces,!1)),9,Vo),u("text",{x:e.xScale(h.item.name)+e.xScale.bandwidth()/2,y:e.yScale(h.item.energy)-10,"font-size":r.value-2,"text-anchor":"middle",fill:d()},B(c()),9,Eo),u("text",{x:e.xScale(h.item.name)+e.xScale.bandwidth()/2,y:e.height-e.margin.bottom-5,"font-size":r.value,"text-anchor":"middle",fill:h.item.color,class:q(h.item.icon.length<=2?"fas":"")},B(l(h.item.name,h.item.icon)),11,Wo)],8,Go))}}),jo={id:"emBarLabels"},zo=A({__name:"EMLabels",props:{plotdata:{},xScale:{},yScale:{},height:{},margin:{}},setup(t){const e=t;function a(o){if(o.name=="PV"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,d=(i.graphMode=="live"||i.graphMode=="day"?$:w.items).evuOut.energy,h=l.pv.energy;return Math.round((h-d)/h*100)}else if(o.name=="Netz"){const l=i.graphMode=="live"||i.graphMode=="day"?V:w.items,c=i.graphMode=="live"||i.graphMode=="day"?$:w.items,d=c.evuOut.energy,h=l.evuIn.energy,f=l.pv.energy,v=l.batOut.energy,O=c.batIn.energy;return f+v-d-O>0?Math.round((f+v-d-O)/(f+v+h-d-O)*100):0}else return o.pvPercentage}function r(o){return o.name=="PV"?"Eigen":"Aut"}return(o,l)=>(g(),y("g",jo,[(g(!0),y(Ie,null,Be(e.plotdata,(c,d)=>(g(),y("g",{key:d},[k(No,{item:c,"x-scale":e.xScale,"y-scale":e.yScale,margin:e.margin,height:e.height,barcount:e.plotdata.length,"aut-text":r(c),autarchy:a(c)},null,8,["item","x-scale","y-scale","margin","height","barcount","aut-text","autarchy"])]))),128))]))}}),Uo={id:"energymeter",class:"p-0 m-0"},Fo={viewBox:"0 0 500 500"},Jo=["transform"],Ro=["x"],Ho={key:0},Ot=500,it=500,Bt=12,Yo="Energie",Qo=A({__name:"EnergyMeter",setup(t){const e={top:25,bottom:30,left:25,right:0},a=p(()=>{let c=Object.values(V),d=l.value,h=w.values(),f=[];switch(m.debug&&(console.debug("----------------------- source summary -----------------"),console.debug(V),console.debug("----------------------- usage details ------------------"),console.debug(l.value),console.debug("----------------------- historic summary ---------------"),console.debug(w),console.debug("--------------------------------------------------------")),qe.value==!0&&(qe.value=!1),i.graphMode){default:case"live":case"today":f=c.concat(d).filter(v=>v.energy>0);break;case"day":case"month":case"year":h.length==0?De.value=!0:(De.value=!1,f=h.filter(v=>v.energy>0))}return f}),r=p(()=>ut().range([0,Ot-e.left-e.right]).domain(a.value.map(c=>c.name)).padding(.4)),o=p(()=>Ce().range([it-e.bottom-e.top,15]).domain([0,ga(a.value,c=>c.energy)])),l=p(()=>{const c=Object.values(b).length,d=Object.values(L).filter(h=>h.configured).length;return[$.evuOut,$.devices,$.charging].concat(c>1?Object.values(b).map(h=>h.toPowerItem()):[]).concat(d>1?Object.values(L).filter(h=>h.configured&&h.showInGraph):[]).concat([$.batIn,$.house])});return(c,d)=>(g(),E(et,{"full-width":!0},{title:P(()=>[z(B(Yo))]),buttons:P(()=>[k(Qt,{widgetid:"graphsettings","show-left-button":!0,"show-right-button":!0,"ignore-live":!0,onShiftLeft:n(bt),onShiftRight:n(Jt),onShiftUp:n(Rt),onShiftDown:n(Ht)},null,8,["onShiftLeft","onShiftRight","onShiftUp","onShiftDown"])]),default:P(()=>[u("figure",Uo,[(g(),y("svg",Fo,[u("g",{transform:"translate("+e.left+","+e.top+")"},[k(Ao,{plotdata:a.value,"x-scale":r.value,"y-scale":o.value,height:it,margin:e},null,8,["plotdata","x-scale","y-scale"]),k(Do,{"y-scale":o.value,width:Ot,fontsize:Bt,config:n(m)},null,8,["y-scale","config"]),u("text",{x:-e.left,y:"-15",fill:"var(--color-axis)","font-size":Bt},B(n(i).graphMode=="year"?"MWh":"kWh"),9,Ro),k(zo,{plotdata:a.value,"x-scale":r.value,"y-scale":o.value,height:it,margin:e,config:n(m)},null,8,["plotdata","x-scale","y-scale","config"])],8,Jo)]))]),n(De)?(g(),y("p",Ho,"No data")):I("",!0)]),_:1}))}}),Xt=t=>(ke("data-v-07e94a61"),t=t(),Me(),t),qo=["id"],Xo={class:"modal-dialog modal-lg modal-fullscreen-sm-down"},Zo={class:"modal-content"},Ko={class:"modal-header"},en={class:"modal-title scaled"},tn=Xt(()=>u("button",{type:"button",class:"btn-close buttonTextSize d-flex justify-content-center pt-3 pb-0","data-bs-dismiss":"modal"},[u("i",{class:"fa-solid fa-lg fa-circle-check m-0 p-0"})],-1)),an={class:"modal-body",style:{"background-color":"var(--color-fg)"}},rn=Xt(()=>u("div",{class:"modal-footer"},null,-1)),on=A({__name:"ModalComponent",props:{modalId:{}},setup(t){const e=t;return Ke(()=>{}),(a,r)=>(g(),y("div",{id:e.modalId,class:"modal fade"},[u("div",Xo,[u("div",Zo,[u("div",Ko,[u("h3",en,[ue(a.$slots,"title",{},void 0,!0)]),tn]),u("div",an,[ue(a.$slots,"default",{},void 0,!0)]),rn])])],8,qo))}}),ct=Z(on,[["__scopeId","data-v-07e94a61"]]),nn={class:"digit scaled",type:"button"},sn=A({__name:"PadButton",props:{modelValue:{},color:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=Se(!1);function o(){r.value=!0,c("update:modelValue",a.modelValue),setTimeout(()=>{r.value=!1},300)}const l=p(()=>r.value?{"background-color":"white",color:"black"}:{"background-color":a.color??"var(--color-axis)"}),c=e;return(d,h)=>(g(),y("div",{class:"padbutton",style:te(l.value),onClick:o},[u("span",nn,[ue(d.$slots,"default",{},void 0,!0)])],4))}}),ze=Z(sn,[["__scopeId","data-v-29589225"]]),Zt=t=>(ke("data-v-47b8fdb7"),t=t(),Me(),t),cn={class:"numberpad"},ln={class:"codedisplay scaled"},un={class:"numberentry"},dn=Zt(()=>u("span",{class:"fas fa-delete-left"},null,-1)),hn=Zt(()=>u("span",{class:"fas fa-circle-check"},null,-1)),pn=A({__name:"NumberPad",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const r=Se(t.modelValue),o=e,l=p(()=>r.value.length==0?"Bitte geben Sie die PIN ein":"*".repeat(r.value.length));function c(d){d==-1?r.value=r.value.slice(0,-1):d==-2?(o("update:modelValue",r.value),r.value=""):r.value=r.value+d.toString()}return(d,h)=>(g(),y("div",cn,[u("p",ln,B(l.value),1),u("div",un,[(g(),y(Ie,null,Be(9,f=>k(ze,{key:f,"model-value":f,"onUpdate:modelValue":c},{default:P(()=>[z(B(f),1)]),_:2},1032,["model-value"])),64)),k(ze,{"model-value":0,"onUpdate:modelValue":c},{default:P(()=>[z("0")]),_:1}),k(ze,{"model-value":-1,color:"var(--color-devices)","onUpdate:modelValue":c},{default:P(()=>[dn]),_:1}),k(ze,{"model-value":-2,color:"var(--color-devices)","data-bs-dismiss":"modal","onUpdate:modelValue":c},{default:P(()=>[hn]),_:1})])]))}}),gn=Z(pn,[["__scopeId","data-v-47b8fdb7"]]),je=t=>(ke("data-v-ecac4e45"),t=t(),Me(),t),mn={class:"statustable"},fn=je(()=>u("span",{class:"header"},"IP-Adresse:",-1)),vn=je(()=>u("span",{class:"header"},"Systemzeit:",-1)),_n=je(()=>u("span",{class:"header"},"Version:",-1)),yn=je(()=>u("span",{class:"header"},"Version (Details):",-1)),bn=je(()=>u("span",{class:"header"},"Entwicklungszweig:",-1)),wn=A({__name:"StatusPage",setup(t){return(e,a)=>(g(),y("div",mn,[fn,u("span",null,B(n(U).ipAddress),1),vn,u("span",null,B(new Date(n(U).systemTime*1e3).toLocaleString(void 0)),1),_n,u("span",null,B(n(U).version),1),yn,u("span",null,B(n(U).versionDetails),1),bn,u("span",null,B(n(U).devBranch),1)]))}}),Sn=Z(wn,[["__scopeId","data-v-ecac4e45"]]),kn={class:"configitem subgrid"},Mn={class:"d-flex align-items-baseline m-0 p-0 grid-col-6 scaled"},xn={class:"ms-1 mb-2 p-0 pt-2 d-flex justify-content-stretch align-items-center grid-col-6"},Pn={class:"justify-content-stretch d-flex"},In=A({__name:"ConfigItem",props:{title:{},infotext:{},icon:{},iconcolor:{},fullwidth:{type:Boolean}},setup(t){const e=t;return(a,r)=>(g(),y("div",kn,[u("span",Mn,[e.icon?(g(),y("i",{key:0,class:q(["fa-solid fa-sm m-0 p-0 me-2 item-icon",e.icon]),style:te({color:e.iconcolor?e.iconcolor:"var(--color-charging)"})},null,6)):I("",!0),z(" "+B(a.title),1)]),u("div",xn,[u("span",Pn,[ue(a.$slots,"default",{},void 0,!0)])])]))}}),Ae=Z(In,[["__scopeId","data-v-73b192d9"]]),$n=["id","value"],Cn=A({__name:"RadioInput",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=e,o=p({get(){return a.modelValue},set(d){r("update:modelValue",d)}});function l(d){return a.options[d][2]?{color:a.options[d][2]}:{color:"var(--color-charging)"}}function c(d){let h=d.target;for(;h&&!h.value&&h.parentElement;)h=h.parentElement;h.value&&(o.value=h.value)}return(d,h)=>(g(),y("div",null,[(g(!0),y(Ie,null,Be(d.options,(f,v)=>(g(),y("button",{id:"radio-"+f[1],key:v,class:q(["btn btn-outline-secondary radiobutton me-2 mb-0 px-2",f[1]==o.value?"active":""]),value:f[1],style:te(l(v)),onClick:c},[u("span",{style:te(l(v)),class:"scaled"},[f[3]?(g(),y("i",{key:0,class:q(["fa-solid",f[3]])},null,2)):I("",!0),z(" "+B(f[0]),1)],4)],14,$n))),128))]))}}),lt=Z(Cn,[["__scopeId","data-v-18eb8489"]]),On={class:"form-check form-switch"},Tt=A({__name:"SwitchInput",props:{modelValue:{type:Boolean},onColor:{},offColor:{}},emits:["update:modelValue"],setup(t,{emit:e}){const a=t,r=e,o=p({get(){return a.modelValue},set(c){r("update:modelValue",c)}}),l=p(()=>o.value?{"background-color":"green","font-size":"20px"}:{"background-color":"white","font-size":"20px"});return(c,d)=>(g(),y("div",On,[Fe(u("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>o.value=h),class:"form-check-input",type:"checkbox",role:"switch",style:te(l.value)},null,4),[[ma,o.value]])]))}}),Kt=t=>(ke("data-v-52884c1a"),t=t(),Me(),t),Bn={class:"settingslist"},Tn=Kt(()=>u("hr",{class:"grid-col-12"},null,-1)),An=Kt(()=>u("hr",{class:"grid-col-12"},null,-1)),Ln=A({__name:"SettingsPage",props:{chargepoint:{}},setup(t){const e=t,a=p({get:()=>e.chargepoint.etActive,set:l=>{b[e.chargepoint.id].etActive=l}}),r=p({get:()=>e.chargepoint.timedCharging,set:l=>{b[e.chargepoint.id].timedCharging=l}}),o=p({get:()=>e.chargepoint.connectedVehicle,set:l=>{b[e.chargepoint.id].connectedVehicle=l}});return(l,c)=>(g(),y("div",Bn,[n(U).isBatteryConfigured?(g(),E(Ae,{key:0,title:"PV-Priorität (global)",icon:"fa-car-battery",iconcolor:"var(--color-battery)",infotext:"Priority during PV production",fullwidth:!0},{default:P(()=>[k(lt,{modelValue:n(U).pvBatteryPriority,"onUpdate:modelValue":c[0]||(c[0]=d=>n(U).pvBatteryPriority=d),options:n(Ta)},null,8,["modelValue","options"])]),_:1})):I("",!0),Tn,k(Ae,{title:"Fahrzeug wechseln",icon:"fa-car",fullwidth:!0},{default:P(()=>[k(lt,{modelValue:o.value,"onUpdate:modelValue":c[1]||(c[1]=d=>o.value=d),modelModifiers:{number:!0},options:Object.values(n(N)).map(d=>[d.name,d.id])},null,8,["modelValue","options"])]),_:1}),An,k(Ae,{title:"Strompreisbasiert laden",icon:"fa-coins",iconcolor:"var(--color-battery)",infotext:"Settings"},{default:P(()=>[k(Tt,{modelValue:a.value,"onUpdate:modelValue":c[2]||(c[2]=d=>a.value=d)},null,8,["modelValue"])]),_:1}),k(Ae,{title:"Zeitplan aktivieren",icon:"fa-clock",iconcolor:"var(--color-battery)"},{default:P(()=>[k(Tt,{modelValue:r.value,"onUpdate:modelValue":c[3]||(c[3]=d=>r.value=d)},null,8,["modelValue"])]),_:1}),k(Ae,{title:"Ladeprofil",icon:"fa-sliders",iconcolor:"var(--color-pv)"},{default:P(()=>[n(N)[o.value]?(g(),E(lt,{key:0,modelValue:n(N)[o.value].chargeTemplateId,"onUpdate:modelValue":c[4]||(c[4]=d=>n(N)[o.value].chargeTemplateId=d),modelModifiers:{number:!0},options:Object.keys(n(ce)).map(d=>[n(ce)[+d].name,d])},null,8,["modelValue","options"])):I("",!0)]),_:1})]))}}),Dn=Z(Ln,[["__scopeId","data-v-52884c1a"]]);function Gn(t,e){t=="openWB/graph/boolDisplayLiveGraph"?U.displayLiveGraph=+e==1:t.match(/^openwb\/graph\/alllivevaluesJson[1-9][0-9]*$/i)?Vn(t,e):t=="openWB/graph/lastlivevaluesJson"?En(t,e):t=="openWB/graph/config/duration"&&(Q.duration=JSON.parse(e))}function Vn(t,e){if(!Q.initialized){let a=[];const r=e.toString().split(` +`);r.length>1?a=r.map(c=>JSON.parse(c)):a=[];const o=t.match(/(\d+)$/g),l=o?o[0]:"";l!=""&&typeof Q.rawDataPacks[+l-1]>"u"&&(Q.rawDataPacks[+l-1]=a,Q.initCounter++)}if(Q.initCounter==16){const a=[];Q.unsubscribeRefresh(),Q.initialized=!0,Q.rawDataPacks.map(r=>{r.map(o=>{const l=ea(o);a.push(l)})}),Ne(a),Q.subscribeUpdates()}}function En(t,e){const a=JSON.parse(e),r=ea(a);Q.graphRefreshCounter++,Ne(i.data.concat(r)),Q.graphRefreshCounter>60&&Q.activate()}function ea(t){const e={};e.date=Wn(t.time).valueOf(),+t.grid>0?(e.evuIn=+t.grid,e.evuOut=0):+t.grid<=0?(e.evuIn=0,e.evuOut=-t.grid):(e.evuIn=0,e.evuOut=0),+t["pv-all"]>=0?(e.pv=+t["pv-all"],e.inverter=0):(e.pv=0,e.inverter=-t["pv-all"]),e.house=+t["house-power"],+t["bat-all-power"]>0?(e.batOut=0,e.batIn=+t["bat-all-power"]):+t["bat-all-power"]<0?(e.batOut=-t["bat-all-power"],e.batIn=0):(e.batOut=0,e.batIn=0),t["bat-all-soc"]?e.batterySoc=+t["bat-all-soc"]:e.batterySoc=0,t["ev0-soc"]&&(e.soc0=+t["ev0-soc"]),t["ev1-soc"]&&(e.soc1=+t["ev1-soc"]),e.charging=+t["charging-all"];for(let a=0;a<10;a++){const r="cp"+a;e[r]=+(t[r+"-power"]??0)}return e.selfUsage=e.pv-e.evuOut,e.selfUsage<0&&(e.selfUsage=0),e.devices=0,e}function Wn(t){const e=new Date(Date.now()),a=864e5;let r=new Date;const o=Ye("%H:%M:%S")(t);return o&&(r=o,r.setDate(e.getDate()),r.setMonth(e.getMonth()),r.setFullYear(e.getFullYear()),r.getHours()>e.getHours()&&(r=new Date(r.getTime()-a))),r}const Nn=["evuIn","pv","batIn","evuOut"];let Ze=[];function jn(t,e){const a=JSON.parse(e).entries,r=JSON.parse(e).totals;vt(),Ze=[],_t.map(l=>{w.setEnergyPv(l,0),w.setEnergyBat(l,0)});const o=zn(a);Ne(o),yt(r,Ze),m.debug&&(console.debug("---------------------------------------- Graph Data ---------------------------"),console.debug("--- Incoming graph data:"),console.debug(a),console.debug("data to be displayed:"),console.debug(o),console.debug("-------------------------------------------------------------------------------")),i.graphMode=="today"&&setTimeout(()=>J.activate(),3e5)}function zn(t){const e=[];let a={};return t.map(r=>{a=Un(r);const o=a;e.push(o)}),e}function Un(t){const e={};if(i.graphMode=="day"||i.graphMode=="today")if(typeof t.date=="number")e.date=new Date(+t.date*1e3).getTime();else{const r=Ye("%H:%M")(t.date);r&&(r.setMonth(J.date.getMonth()),r.setDate(J.date.getDate()),r.setFullYear(J.date.getFullYear()),e.date=r.getTime())}else if(typeof t.date=="string"){const r=Ye("%Y%m%d")(t.date);r&&(e.date=r.getDate())}return e.evuOut=0,e.evuIn=0,Object.entries(t.counter).forEach(([r,o])=>{o.grid&&(e.evuOut+=o.power_exported,e.evuIn+=o.power_imported,Ze.includes(r)||Ze.push(r))}),e.evuOut==0&&e.evuIn==0&&Object.entries(t.counter).forEach(r=>{e.evuOut+=r[1].power_exported,e.evuIn+=r[1].power_imported}),e.pv=t.pv.all.power_exported,Object.entries(t.bat).length>0?(e.batIn=t.bat.all.power_imported,e.batOut=t.bat.all.power_exported,e.batSoc=t.bat.all.soc??0):(e.batIn=0,e.batOut=0,e.batSoc=0),Object.entries(t.cp).forEach(([r,o])=>{r!="all"?(e[r]=o.power_imported,w.keys().includes(r)||w.addItem(r)):e.charging=o.power_imported}),Object.entries(t.ev).forEach(([r,o])=>{r!="all"&&(e["soc"+r.substring(2)]=o.soc)}),e.devices=0,Object.entries(t.sh).forEach(([r,o])=>{r!="all"&&(e[r]=o.power_imported??0,e.devices+=o.power_imported??0,w.keys().includes(r)||w.addItem(r))}),e.selfUsage=e.pv-e.evuOut,t.hc&&t.hc.all?e.house=t.hc.all.power_imported:e.house=e.evuIn+e.batOut+e.pv-e.evuOut-e.charging-e.devices-e.batOut,e.evuIn+e.batOut+e.pv>0?w.keys().filter(r=>!Nn.includes(r)).map(r=>{Ar(r,e)}):Object.keys(e).map(r=>{e[r+"Pv"]=0,e[r+"Bat"]=0}),e}let Ue={};const St=["charging","house","batIn","devices"],Fn=["evuIn","pv","batIn","evuOut"];let Ge=[];function Jn(t,e){const a=JSON.parse(e).entries,r=JSON.parse(e).totals;vt(),Ge=[],St.map(o=>{w.items[o].energyPv=0,w.items[o].energyBat=0}),a.length>0&&Ne(ta(a)),yt(r,[])}function Rn(t,e){const a=JSON.parse(e).entries,r=JSON.parse(e).totals;vt(),Ge=[],St.forEach(o=>{w.items[o].energyPv=0,w.items[o].energyBat=0}),Ne(ta(a)),yt(r,[])}function ta(t){const e=[];let a={};return Ue={},t.map(r=>{a=Hn(r),e.push(a),Object.keys(a).forEach(o=>{o!="date"&&(a[o]<0&&(console.warn(`Negative energy value for ${o} in row ${a.date}. Ignoring the value.`),a[o]=0),Ue[o]?Ue[o]+=a[o]:Ue[o]=a[o])})}),e}function Hn(t){const e={},a=Ye("%Y%m%d")(t.date);a&&(e.date=i.graphMode=="month"?a.getDate():a.getMonth()+1),e.evuOut=0,e.evuIn=0;let r=0,o=0;return Object.entries(t.counter).forEach(([c,d])=>{r+=d.energy_exported,o+=d.energy_imported,d.grid&&(e.evuOut+=d.energy_exported,e.evuIn+=d.energy_imported,Ge.includes(c)||Ge.push(c))}),Ge.length==0&&(e.evuOut=r,e.evuIn=o),e.pv=t.pv.all.energy_exported,Object.entries(t.bat).length>0?(t.bat.all.energy_imported>=0?e.batIn=t.bat.all.energy_imported:(console.warn("ignoring negative value for batIn on day "+e.date),e.batIn=0),t.bat.all.energy_exported>=0?e.batOut=t.bat.all.energy_exported:(console.warn("ignoring negative value for batOut on day "+e.date),e.batOut=0)):(e.batIn=0,e.batOut=0),Object.entries(t.cp).forEach(([c,d])=>{c!="all"?(w.keys().includes(c)||w.addItem(c),e[c]=d.energy_imported):e.charging=d.energy_imported}),Object.entries(t.ev).forEach(([c,d])=>{c!="all"&&(e["soc-"+c]=d.soc)}),e.devices=Object.entries(t.sh).reduce((c,d)=>(w.keys().includes(d[0])||w.addItem(d[0]),d[1].energy_imported>=0?c+=d[1].energy_imported:console.warn(`Negative energy value for device ${d[0]} in row ${e.date}. Ignoring this value`),c),0),e.house=e.pv+e.evuIn+e.batOut-e.evuOut-e.batIn-e.charging,e.selfUsage=e.pv-e.evuOut,e.evuIn+e.batOut+e.pv>0?w.keys().filter(c=>!Fn.includes(c)).map(c=>{Lr(c,e)}):St.map(c=>{e[c+"Pv"]=0,e[c+"Bat"]=0}),e}class Yn{constructor(e){s(this,"id");s(this,"dailyYieldExport",0);s(this,"dailyYieldImport",0);s(this,"exported",0);s(this,"faultState",0);s(this,"faultStr","");s(this,"imported",0);s(this,"power",0);s(this,"soc",0);this.id=e}}class Qn{constructor(){s(this,"dailyExport",0);s(this,"dailyImport",0);s(this,"exported",0);s(this,"imported",0);s(this,"power",0);s(this,"soc",0)}}const oe=F({});F(new Qn);function qn(t){t in oe?console.info("Duplicate battery message: "+t):oe[t]=new Yn(t)}function Xn(){Object.keys(oe).forEach(t=>{delete oe[parseInt(t)]})}function Zn(t,e){const a=Kn(t);if(a&&!(a in oe)){console.warn("Invalid battery index received: "+a);return}t=="openWB/bat/config/configured"?U.isBatteryConfigured=e=="true":t=="openWB/bat/get/power"?+e>0?($.batIn.power=+e,V.batOut.power=0):($.batIn.power=0,V.batOut.power=-e):t=="openWB/bat/get/soc"?U.batterySoc=+e:t=="openWB/bat/get/daily_exported"?V.batOut.energy=+e:t=="openWB/bat/get/daily_imported"?$.batIn.energy=+e:a&&(t.match(/^openwb\/bat\/[0-9]+\/get\/daily_yield_export$/i)?oe[a].dailyYieldExport=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/daily_yield_import$/i)?oe[a].dailyYieldImport=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/exported$/i)?oe[a].exported=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/fault_state$/i)?oe[a].faultState=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/fault_str$/i)?oe[a].faultStr=e:t.match(/^openwb\/bat\/[0-9]+\/get\/imported$/i)?oe[a].imported=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/power$/i)?oe[a].power=+e:t.match(/^openwb\/bat\/[0-9]+\/get\/soc$/i)&&(oe[a].soc=+e))}function Kn(t){let e=0;try{const a=t.match(/(?:\/)([0-9]+)(?=\/)/g);return a?(e=+a[0].replace(/[^0-9]+/g,""),e):void 0}catch{console.warn("Parser error in getIndex for topic "+t)}}function es(t,e){if(t=="openWB/optional/et/provider")JSON.parse(e).type==null?ae.active=!1:(ae.active=!0,ae.etProvider=JSON.parse(e).name);else if(t=="openWB/optional/et/get/prices"){const a=JSON.parse(e);ae.etPriceList=new Map,Object.keys(a).map(r=>{ae.etPriceList.set(new Date(+r*1e3),a[r]*1e5)})}}function ts(t,e){const a=aa(t);if(a&&!(a in b)){console.warn("Invalid chargepoint id received: "+a);return}if(t=="openWB/chargepoint/get/power"?$.charging.power=+e:t=="openWB/chargepoint/get/daily_imported"&&($.charging.energy=+e),t=="openWB/chargepoint/get/daily_exported")U.cpDailyExported=+e;else if(a){if(t.match(/^openwb\/chargepoint\/[0-9]+\/config$/i))if(b[a]){const r=JSON.parse(e);b[a].name=r.name,b[a].icon=r.name,K["cp"+a]?(K["cp"+a].name=r.name,K["cp"+a].icon=r.name):K["cp"+a]={name:r.name,icon:r.name,color:"var(--color-charging)"}}else console.warn("invalid chargepoint index: "+a);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/state_str$/i))b[a].stateStr=JSON.parse(e);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/fault_str$/i))b[a].faultStr=JSON.parse(e);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/fault_state$/i))b[a].faultState=+e;else if(t.match(/^openWB\/chargepoint\/[0-9]+\/get\/power$/i))b[a].power=+e;else if(t.match(/^openWB\/chargepoint\/[0-9]+\/get\/daily_imported$/i))b[a].dailyYield=+e;else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/plug_state$/i))b[a].isPluggedIn=e=="true";else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/charge_state$/i))b[a].isCharging=e=="true";else if(t.match(/^openwb\/chargepoint\/[0-9]+\/set\/manual_lock$/i))b[a].updateIsLocked(e=="true");else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/enabled$/i))b[a].isEnabled=e=="1";else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/phases_in_use/i))b[a].phasesInUse=+e;else if(t.match(/^openwb\/chargepoint\/[0-9]+\/set\/current/i))b[a].current=+e;else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/currents/i))b[a].currents=JSON.parse(e);else if(t.match(/^openwb\/chargepoint\/[0-9]+\/set\/log/i)){const r=JSON.parse(e);b[a].chargedSincePlugged=r.imported_since_plugged}else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/connected_vehicle\/soc$/i)){const r=JSON.parse(e);b[a].soc=r.soc,b[a].waitingForSoc=!1,b[a].rangeCharged=r.range_charged,b[a].rangeUnit=r.range_unit}else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/connected_vehicle\/info$/i)){const r=JSON.parse(e);b[a].vehicleName=String(r.name),b[a].updateConnectedVehicle(+r.id)}else if(t.match(/^openwb\/chargepoint\/[0-9]+\/get\/connected_vehicle\/config$/i)){const r=JSON.parse(e);switch(r.chargemode){case"instant_charging":b[a].updateChargeMode(de.instant_charging);break;case"pv_charging":b[a].updateChargeMode(de.pv_charging);break;case"scheduled_charging":b[a].updateChargeMode(de.scheduled_charging);break;case"standby":b[a].updateChargeMode(de.standby);break;case"stop":b[a].updateChargeMode(de.stop);break}b[a].chargeTemplate=r.charge_template,b[a].averageConsumption=r.average_consumption}}}function as(t,e){const a=aa(t);if(a!=null){if(!(a in N)){const r=new Pa(a);N[a]=r}if(t.match(/^openwb\/vehicle\/[0-9]+\/name$/i))Object.values(b).forEach(r=>{r.connectedVehicle==a&&(r.vehicleName=JSON.parse(e))}),N[a].name=JSON.parse(e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/get\/soc$/i))N[a].soc=JSON.parse(e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/get\/range$/i))N[a].range=+e;else if(t.match(/^openwb\/vehicle\/[0-9]+\/charge_template$/i))N[a].updateChargeTemplateId(+e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/ev_template$/i))N[a].updateEvTemplateId(+e);else if(t.match(/^openwb\/vehicle\/[0-9]+\/soc_module\/config$/i)){const r=JSON.parse(e);Object.values(b).forEach(o=>{o.connectedVehicle==a&&(o.isSocConfigured=r.type!==null,o.isSocManual=r.type=="manual")})}}}function rs(t,e){if(t.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+$/i)){const a=t.match(/[0-9]+$/i);if(a){const r=+a[0],o=JSON.parse(e);ce[r]=o,os(r,o)}}else if(t.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+\/time_charging\/plans\/[0-9]+$/i)){const a=t.match(/(?:\/)([0-9]+)(?:\/)/g),r=t.match(/[0-9]+$/i);if(a&&r){const o=+a[0].replace(/[^0-9]+/g,""),l=+r[0],c=JSON.parse(e);o in ot||(ot[o]=[]),ot[o][l]=c}}else if(t.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+\/chargemode\/scheduled_charging\/plans\/[0-9]+$/i)){const a=t.match(/(?:\/)([0-9]+)(?:\/)/g),r=t.match(/[0-9]+$/i);if(a&&r){const o=+a[0].replace(/[^0-9]+/g,""),l=+r[0],c=JSON.parse(e);o in rt||(rt[o]=[]),rt[o][l]=c}}else if(t.match(/^openwb\/vehicle\/template\/ev_template\/[0-9]+$/i)){const a=t.match(/[0-9]+$/i);if(a){const r=+a[0],o=JSON.parse(e);Ia[r]=o}}}function os(t,e){Object.values(b).forEach(a=>{a.chargeTemplate==t&&(a.updateCpPriority(e.prio),a.updateInstantChargeLimitMode(e.chargemode.instant_charging.limit.selected),a.updateInstantTargetCurrent(e.chargemode.instant_charging.current),a.updateInstantTargetSoc(e.chargemode.instant_charging.limit.soc),a.updateInstantMaxEnergy(e.chargemode.instant_charging.limit.amount),a.updatePvFeedInLimit(e.chargemode.pv_charging.feed_in_limit),a.updatePvMinCurrent(e.chargemode.pv_charging.min_current),a.updatePvMaxSoc(e.chargemode.pv_charging.max_soc),a.updatePvMinSoc(e.chargemode.pv_charging.min_soc),a.updatePvMinSocCurrent(e.chargemode.pv_charging.min_soc_current))})}function aa(t){let e=0;try{const a=t.match(/(?:\/)([0-9]+)(?=\/)/g);return a?(e=+a[0].replace(/[^0-9]+/g,""),e):void 0}catch{console.warn("Parser error in getIndex for topic "+t)}}function ns(t,e){t.match(/^openWB\/LegacySmarthome\/config\//i)?ss(t,e):t.match(/^openWB\/LegacySmarthome\/Devices\//i)&&is(t,e)}function ss(t,e){const a=ra(t);a!=null&&(a in L||Ut(a),t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_configured$/i)?L[a].configured=e!="0":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_name$/i)?(L[a].name=e.toString(),L[a].icon=e.toString(),K["sh"+a].name=e.toString(),K["sh"+a].icon=e.toString()):t.match(/^openWB\/LegacySmarthome\/config\/set\/Devices\/[0-9]+\/mode$/i)?L[a].isAutomatic=e=="0":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_canSwitch$/i)?L[a].canSwitch=e=="1":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_homeConsumtion$/i)?L[a].countAsHouse=e=="1":t.match(/^openWB\/LegacySmarthome\/config\/get\/Devices\/[0-9]+\/device_temperatur_configured$/i)&&(L[a].tempConfigured=+e))}function is(t,e){const a=ra(t);if(a==null){console.warn("Smarthome: Missing index in "+t);return}if(a in L||Ut(a),t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/Watt$/i))L[a].power=+e,cs("power");else if(!t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/Wh$/i)){if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/RunningTimeToday$/i))L[a].runningTime=+e;else if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/TemperatureSensor0$/i))L[a].temp[0]=+e;else if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/TemperatureSensor1$/i))L[a].temp[1]=+e;else if(t.match(/^openWB\/LegacySmarthome\/Devices\/[0-9]+\/TemperatureSensor2$/i))L[a].temp[2]=+e;else if(t.match(/^openWB\/LegacySmartHome\/Devices\/[0-9]+\/Status$/i))switch(+e){case 10:L[a].status="off";break;case 11:L[a].status="on";break;case 20:L[a].status="detection";break;case 30:L[a].status="timeout";break;default:L[a].status="off"}}}function cs(t){switch(t){case"power":$.devices.power=Object.values(L).filter(e=>e.configured&&!e.countAsHouse).reduce((e,a)=>e+a.power,0);break;case"energy":$.devices.energy=Object.values(L).filter(e=>e.configured&&!e.countAsHouse).reduce((e,a)=>e+a.energy,0);break;default:console.error("Unknown category")}}function ra(t){let e=0;try{const a=t.match(/(?:\/)([0-9]+)(?=\/)/g);return a?(e=+a[0].replace(/[^0-9]+/g,""),e):void 0}catch{console.warn("Parser error in getIndex for topic "+t)}}class ls{constructor(e){s(this,"id");s(this,"name","Zähler");s(this,"power",0);s(this,"energy_imported",0);s(this,"energy_exported",0);s(this,"grid",!1);s(this,"type","counter");s(this,"color","var(--color-evu)");s(this,"energyPv",0);s(this,"energyBat",0);s(this,"pvPercentage",0);s(this,"icon","");this.id=e}}const ie=F({});function us(t,e){if(t in ie)console.info("Duplicate counter message: "+t);else switch(ie[t]=new ls(t),ie[t].type=e,e){case"counter":ie[t].color="var(--color-evu)";break;case"inverter":ie[t].color="var(--color-pv)";break;case"cp":ie[t].color="var(--color-charging)";break;case"bat":ie[t].color="var(--color-bat)";break}}const ds=["openWB/counter/#","openWB/bat/#","openWB/pv/get/#","openWB/chargepoint/#","openWB/vehicle/#","openWB/general/chargemode_config/pv_charging/#","openWB/optional/et/#","openWB/system/#","openWB/LegacySmartHome/#","openWB/command/"+mt()+"/#","openWB/optional/int_display/#"];function hs(){Ma(ps),ds.forEach(t=>{$e(t)}),X()}function ps(t,e){const a=e.toString();t.match(/^openwb\/counter\/[0-9]+\//i)?gs(t,a):t.match(/^openwb\/counter\//i)?ms(t,a):t.match(/^openwb\/bat\//i)?Zn(t,a):t.match(/^openwb\/pv\//i)?fs(t,a):t.match(/^openwb\/chargepoint\//i)?ts(t,a):t.match(/^openwb\/vehicle\/template\//i)?rs(t,a):t.match(/^openwb\/vehicle\//i)?as(t,a):t.match(/^openwb\/general\/chargemode_config\/pv_charging\//i)?vs(t,a):t.match(/^openwb\/graph\//i)?Gn(t,a):t.match(/^openwb\/log\/daily\//i)?jn(t,a):t.match(/^openwb\/log\/monthly\//i)?Jn(t,a):t.match(/^openwb\/log\/yearly\//i)?Rn(t,a):t.match(/^openwb\/optional\/et\//i)?es(t,a):t.match(/^openwb\/system\//i)?ys(t,a):t.match(/^openwb\/LegacySmartHome\//i)?ns(t,a):t.match(/^openwb\/command\//i)?bs(t,a):t.match(/^openwb\/optional\//i)&&ws(t,a)}function gs(t,e){const a=t.split("/"),r=+a[2];if(r==U.evuId?_s(t,e):a[3]=="config",a[3]=="get"&&r in ie)switch(a[4]){case"power":ie[r].power=+e;break;case"config":break;case"fault_str":break;case"fault_state":break;case"power_factors":break;case"imported":break;case"exported":break;case"frequency":break;case"daily_imported":ie[r].energy_imported=+e;break;case"daily_exported":ie[r].energy_exported=+e;break}}function ms(t,e){if(t.match(/^openwb\/counter\/get\/hierarchy$/i)){const a=JSON.parse(e);if(a.length){Ca(),Xn();for(const r of a)r.type=="counter"&&(U.evuId=r.id);oa(a[0])}}else t.match(/^openwb\/counter\/set\/home_consumption$/i)?($.house.power=+e,La()):t.match(/^openwb\/counter\/set\/daily_yield_home_consumption$/i)&&($.house.energy=+e)}function oa(t){switch(t.type){case"counter":us(t.id,t.type);break;case"cp":$a(t.id);break;case"bat":qn(t.id);break}t.children.forEach(e=>oa(e))}function fs(t,e){switch(t){case"openWB/pv/get/power":V.pv.power=-e;break;case"openWB/pv/get/daily_exported":V.pv.energy=+e;break}}function vs(t,e){const a=t.split("/");if(a.length>0)switch(a[4]){case"bat_mode":U.updatePvBatteryPriority(JSON.parse(e));break}}function _s(t,e){switch(t.split("/")[4]){case"power":+e>0?(V.evuIn.power=+e,$.evuOut.power=0):(V.evuIn.power=0,$.evuOut.power=-e);break;case"daily_imported":V.evuIn.energy=+e;break;case"daily_exported":$.evuOut.energy=+e;break}}function ys(t,e){if(t.match(/^openWB\/system\/device\/[0-9]+\/component\/[0-9]+\/config$/i)){const a=JSON.parse(e);a.type=="counter"&&(ie[a.id].name=a.name)}else t.match(/^openWB\/system\/ip_address$/i)?U.ipAddress=JSON.parse(e):t.match(/^openWB\/system\/time$/i)?U.systemTime=JSON.parse(e):t.match(/^openWB\/system\/version$/i)?U.version=JSON.parse(e):t.match(/^openWB\/system\/current_commit$/i)?U.versionDetails=JSON.parse(e):t.match(/^openWB\/system\/current_branch$/i)&&(U.devBranch=JSON.parse(e))}function bs(t,e){const a=t.split("/");if(t.match(/^openWB\/command\/[a-z]+\/error$/i)&&a[2]==mt()){const r=JSON.parse(e);console.error(`Error message from openWB: Command: ${r.command} Data: JSON.stringify(err.data) Error: diff --git a/packages/modules/display_themes/colors/web/index.html b/packages/modules/display_themes/colors/web/index.html index 867640df4e..a841394cad 100644 --- a/packages/modules/display_themes/colors/web/index.html +++ b/packages/modules/display_themes/colors/web/index.html @@ -4,7 +4,7 @@ openWB Display - +