UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

3 lines 5.54 kB
/*! For license information please see 70186.3f90338ec048711d.js.LICENSE.txt */ export const __webpack_ids__=["70186"];export const __webpack_modules__={66487:function(e,s,t){t.a(e,(async function(e,n){try{t.r(s),t.d(s,{EnergySetupWizard:()=>v});var i=t(44249),a=(t(31622),t(57243)),r=t(15093),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),_=t(43672),y=e([d,u,f,p,g,_,c]);[d,u,f,p,g,_,c]=y.then?(await y)():y;let v=(0,i.Z)([(0,r.Mo)("energy-setup-wizard-card")],(function(e,s){return{F:class extends s{constructor(...s){super(...s),e(this)}},d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_info",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_step",value:()=>0},{kind:"field",decorators:[(0,r.SB)()],key:"_preferences",value:()=>({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 a.dy` <p> ${this.hass.localize("ui.panel.energy.setup.step",{step:this._step+1,steps:6})} </p> ${0===this._step?a.dy`<ha-energy-grid-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-grid-settings>`:1===this._step?a.dy`<ha-energy-solar-settings .hass="${this.hass}" .preferences="${this._preferences}" .info="${this._info}" @value-changed="${this._prefsChanged}"></ha-energy-solar-settings>`:2===this._step?a.dy`<ha-energy-battery-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-battery-settings>`:3===this._step?a.dy`<ha-energy-gas-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-gas-settings>`:4===this._step?a.dy`<ha-energy-water-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-water-settings>`:a.dy`<ha-energy-device-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-device-settings>`} <div class="buttons"> ${this._step>0?a.dy`<mwc-button outlined @click="${this._back}">${this.hass.localize("ui.panel.energy.setup.back")}</mwc-button>`:a.dy`<div></div>`} ${this._step<4?a.dy`<mwc-button unelevated @click="${this._next}">${this.hass.localize("ui.panel.energy.setup.next")}</mwc-button>`:a.dy`<mwc-button unelevated @click="${this._setupDone}"> ${this.hass.localize("ui.panel.energy.setup.done")} </mwc-button>`} </div> `}},{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,a.iv`:host{display:block;padding:16px;max-width:700px;margin:0 auto}mwc-button{margin-top:8px}.buttons{display:flex;justify-content:space-between}`]}}]}}),a.oi);n()}catch(e){n(e)}}))},91583:function(e,s,t){t.d(s,{r:()=>h});var n=t(2841),i=t(45779),a=t(53232);const r=(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=[],a=[];let r=0;for(const s of e)i[r]=n?n(s,r):r,a[r]=t(s,r),r++;return{values:a,keys:i}}render(e,s,t){return this.ct(e,s,t).values}update(e,[s,t,i]){var h;const c=(0,a.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,_=c.length-1,y=0,v=o.length-1;for(;g<=_&&y<=v;)if(null===c[g])g++;else if(null===c[_])_--;else if(d[g]===l[y])u[y]=(0,a.fk)(c[g],o[y]),g++,y++;else if(d[_]===l[v])u[v]=(0,a.fk)(c[_],o[v]),_--,v--;else if(d[g]===l[v])u[v]=(0,a.fk)(c[g],o[v]),(0,a._Y)(e,u[v+1],c[g]),g++,v--;else if(d[_]===l[y])u[y]=(0,a.fk)(c[_],o[y]),(0,a._Y)(e,c[g],c[_]),_--,y++;else if(void 0===f&&(f=r(l,y,v),p=r(d,g,_)),f.has(d[g]))if(f.has(d[_])){const s=p.get(l[y]),t=void 0!==s?c[s]:null;if(null===t){const s=(0,a._Y)(e,c[g]);(0,a.fk)(s,o[y]),u[y]=s}else u[y]=(0,a.fk)(t,o[y]),(0,a._Y)(e,c[g],t),c[s]=null;y++}else(0,a.ws)(c[_]),_--;else(0,a.ws)(c[g]),g++;for(;y<=v;){const s=(0,a._Y)(e,u[v+1]);(0,a.fk)(s,o[y]),u[y++]=s}for(;g<=_;){const e=c[g++];null!==e&&(0,a.ws)(e)}return this.ut=l,(0,a.hl)(e,u),n.Jb}})}}; //# sourceMappingURL=70186.3f90338ec048711d.js.map