iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
3 lines • 5.9 kB
JavaScript
/*! For license information please see 70186.8b0526f3577b7c26.js.LICENSE.txt */
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["70186"],{66487:function(e,s,t){t.a(e,(async function(e,n){try{t.r(s),t.d(s,{EnergySetupWizard:()=>B});var i=t(61701),r=(t(71695),t(40251),t(47021),t(31622),t(57243)),a=t(50778),h=t(36522),c=t(1118),o=t(76131),l=t(28008),d=t(3409),u=t(98445),f=t(68646),p=t(98237),g=t(76539),y=t(43672),_=e([d,u,f,p,g,y,c]);[d,u,f,p,g,y,c]=_.then?(await _)():_;let k,v,$,m,b,w,x,C,z,D,S,Y,A=e=>e,B=(0,i.Z)([(0,a.Mo)("energy-setup-wizard-card")],(function(e,s){return{F:class extends s{constructor(...s){super(...s),e(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_info",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_step",value(){return 0}},{kind:"field",decorators:[(0,a.SB)()],key:"_preferences",value(){return{energy_sources:[],device_consumption:[]}}},{kind:"method",key:"getCardSize",value:function(){return 10}},{kind:"method",key:"setConfig",value:function(e){e.preferences&&(this._preferences=e.preferences)}},{kind:"method",key:"firstUpdated",value:function(){this.hass.loadFragmentTranslation("config"),this._fetchconfig()}},{kind:"method",key:"render",value:function(){return(0,r.dy)(k||(k=A` <p> ${0} </p> ${0} <div class="buttons"> ${0} ${0} </div> `),this.hass.localize("ui.panel.energy.setup.step",{step:this._step+1,steps:6}),0===this._step?(0,r.dy)(v||(v=A`<ha-energy-grid-settings .hass="${0}" .preferences="${0}" -changed="${0}"></ha-energy-grid-settings>`),this.hass,this._preferences,this._prefsChanged):1===this._step?(0,r.dy)($||($=A`<ha-energy-solar-settings .hass="${0}" .preferences="${0}" .info="${0}" -changed="${0}"></ha-energy-solar-settings>`),this.hass,this._preferences,this._info,this._prefsChanged):2===this._step?(0,r.dy)(m||(m=A`<ha-energy-battery-settings .hass="${0}" .preferences="${0}" -changed="${0}"></ha-energy-battery-settings>`),this.hass,this._preferences,this._prefsChanged):3===this._step?(0,r.dy)(b||(b=A`<ha-energy-gas-settings .hass="${0}" .preferences="${0}" -changed="${0}"></ha-energy-gas-settings>`),this.hass,this._preferences,this._prefsChanged):4===this._step?(0,r.dy)(w||(w=A`<ha-energy-water-settings .hass="${0}" .preferences="${0}" -changed="${0}"></ha-energy-water-settings>`),this.hass,this._preferences,this._prefsChanged):(0,r.dy)(x||(x=A`<ha-energy-device-settings .hass="${0}" .preferences="${0}" -changed="${0}"></ha-energy-device-settings>`),this.hass,this._preferences,this._prefsChanged),this._step>0?(0,r.dy)(C||(C=A`<mwc-button outlined ="${0}">${0}</mwc-button>`),this._back,this.hass.localize("ui.panel.energy.setup.back")):(0,r.dy)(z||(z=A`<div></div>`)),this._step<4?(0,r.dy)(D||(D=A`<mwc-button unelevated ="${0}">${0}</mwc-button>`),this._next,this.hass.localize("ui.panel.energy.setup.next")):(0,r.dy)(S||(S=A`<mwc-button unelevated ="${0}"> ${0} </mwc-button>`),this._setupDone,this.hass.localize("ui.panel.energy.setup.done")))}},{kind:"method",key:"_fetchconfig",value:async function(){this._info=await(0,c.xZ)(this.hass)}},{kind:"method",key:"_prefsChanged",value:function(e){this._preferences=e.detail.value}},{kind:"method",key:"_back",value:function(){0!==this._step&&this._step--}},{kind:"method",key:"_next",value:function(){5!==this._step&&this._step++}},{kind:"method",key:"_setupDone",value:async function(){if(this._preferences)if(0!==this._preferences.device_consumption.length||0!==this._preferences.energy_sources.length){try{this._preferences=await(0,c._Z)(this.hass,this._preferences)}catch(e){(0,o.showAlertDialog)(this,{title:`Failed to save config: ${e.message}`})}(0,h.B)(this,"reload-energy-panel")}else(0,o.showAlertDialog)(this,{title:this.hass.localize("ui.panel.energy.setup.no_statistics_selected_title"),text:this.hass.localize("ui.panel.energy.setup.no_statistics_selected_description")})}},{kind:"get",static:!0,key:"styles",value:function(){return[l.Qx,(0,r.iv)(Y||(Y=A`:host{display:block;padding:16px;max-width:700px;margin:0 auto}mwc-button{margin-top:8px}.buttons{display:flex;justify-content:space-between}`))]}}]}}),r.oi);n()}catch(k){n(k)}}))},91583:function(e,s,t){t.d(s,{r:()=>h});t(52247),t(71695),t(47021);var n=t(2841),i=t(45779),r=t(53232);const a=(e,s,t)=>{const n=new Map;for(let i=s;i<=t;i++)n.set(e[i],i);return n},h=(0,i.XM)(class extends i.Xe{constructor(e){if(super(e),e.type!==i.pX.CHILD)throw Error("repeat() can only be used in text expressions")}ct(e,s,t){let n;void 0===t?t=s:void 0!==s&&(n=s);const i=[],r=[];let a=0;for(const h of e)i[a]=n?n(h,a):a,r[a]=t(h,a),a++;return{values:r,keys:i}}render(e,s,t){return this.ct(e,s,t).values}update(e,[s,t,i]){var h;const c=(0,r.i9)(e),{values:o,keys:l}=this.ct(s,t,i);if(!Array.isArray(c))return this.ut=l,o;const d=null!==(h=this.ut)&&void 0!==h?h:this.ut=[],u=[];let f,p,g=0,y=c.length-1,_=0,k=o.length-1;for(;g<=y&&_<=k;)if(null===c[g])g++;else if(null===c[y])y--;else if(d[g]===l[_])u[_]=(0,r.fk)(c[g],o[_]),g++,_++;else if(d[y]===l[k])u[k]=(0,r.fk)(c[y],o[k]),y--,k--;else if(d[g]===l[k])u[k]=(0,r.fk)(c[g],o[k]),(0,r._Y)(e,u[k+1],c[g]),g++,k--;else if(d[y]===l[_])u[_]=(0,r.fk)(c[y],o[_]),(0,r._Y)(e,c[g],c[y]),y--,_++;else if(void 0===f&&(f=a(l,_,k),p=a(d,g,y)),f.has(d[g]))if(f.has(d[y])){const s=p.get(l[_]),t=void 0!==s?c[s]:null;if(null===t){const s=(0,r._Y)(e,c[g]);(0,r.fk)(s,o[_]),u[_]=s}else u[_]=(0,r.fk)(t,o[_]),(0,r._Y)(e,c[g],t),c[s]=null;_++}else(0,r.ws)(c[y]),y--;else(0,r.ws)(c[g]),g++;for(;_<=k;){const s=(0,r._Y)(e,u[k+1]);(0,r.fk)(s,o[_]),u[_++]=s}for(;g<=y;){const e=c[g++];null!==e&&(0,r.ws)(e)}return this.ut=l,(0,r.hl)(e,u),n.Jb}})}}]);
//# sourceMappingURL=70186.8b0526f3577b7c26.js.map