UNPKG

iobroker.lovelace

Version:

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

2 lines 6.51 kB
/*! For license information please see 60411.f716eb06c2eefe8e.js.LICENSE.txt */ export const __rspack_esm_id=60411;export const __rspack_esm_ids=[60411];export const __webpack_modules__={95350(e,t,s){if(s.d(t,{$h:()=>g,FP:()=>_,Og:()=>a,QC:()=>p,QQ:()=>o,S1:()=>r,Ud:()=>y,fK:()=>c,l7:()=>l,nQ:()=>u,p$:()=>h}),66649!=s.j)var n=s(35518);if(66649!=s.j)var i=s(9899);const a=66649!=s.j?{bluetooth:"config/bluetooth",dhcp:"config/dhcp",matter:"config/matter",mqtt:"config/mqtt",ssdp:"config/ssdp",thread:"config/thread",zeroconf:"config/zeroconf",zha:"config/zha/dashboard",zwave_js:"config/zwave_js/dashboard"}:null;var r=66649!=s.j?function(e){return e[e.CRITICAL=50]="CRITICAL",e[e.ERROR=40]="ERROR",e[e.WARNING=30]="WARNING",e[e.INFO=20]="INFO",e[e.DEBUG=10]="DEBUG",e[e.NOTSET=0]="NOTSET",e}({}):null;const o=(e,t)=>t.issue_tracker||`https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+${e}%22`,h=(e,t,s)=>e(`component.${t}.title`)||s?.name||t,c=(e,t)=>{const s={type:"manifest/list"};return t&&(s.integrations=t),e.callWS(s)},l=async(e,t)=>{const s=await e.sendMessagePromise({type:"manifest/list"}),n={};for(const e of s)n[e.domain]=e;return t(n),()=>{}},p=(e,t)=>e.callWS({type:"manifest/get",integration:t}),g=e=>e.callWS({type:"integration/setup_info"}),f=e=>e.sendMessagePromise({type:"logger/log_info"}),u=(e,t,s,n)=>e.callWS({type:"logger/integration_log_level",integration:t,level:s,persistence:n}),d=(e,t)=>e.subscribeEvents((0,i.s)(()=>f(e).then(e=>t.setState(e,!0)),200,!0),"logging_changed"),_=(e,t)=>(0,n.N)("_integration_log_info",f,d,e,t),y=(e,t)=>e.callWS({type:"integration/wait",domain:t})},97431(e,t,s){s.a(e,async function(e,n){try{s.r(t),s.d(t,{EnergySetupWizard:()=>$});var i=s(62826),a=s(5124),r=s(22441),o=s(1087),h=s(38114),c=s(65063),l=s(14503),p=s(23206),g=s(76135),f=s(28166),u=s(54081),d=s(38726),_=s(70604),y=s(18350),v=e([p,g,f,u,d,_,y,h]);[p,g,f,u,d,_,y,h]=v.then?(await v)():v;class $ extends a.WF{getCardSize(){return 10}setConfig(e){e.preferences&&(this._preferences=e.preferences)}firstUpdated(){this.hass.loadFragmentTranslation("config"),this._fetchconfig()}render(){return a.qy` <p> ${this.hass.localize("ui.panel.energy.setup.step",{step:this._step+1,steps:6})} </p> ${0===this._step?a.qy`<ha-energy-grid-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-grid-settings>`:1===this._step?a.qy`<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.qy`<ha-energy-battery-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-battery-settings>`:3===this._step?a.qy`<ha-energy-gas-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-gas-settings>`:4===this._step?a.qy`<ha-energy-water-settings .hass="${this.hass}" .preferences="${this._preferences}" @value-changed="${this._prefsChanged}"></ha-energy-water-settings>`:a.qy`<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.qy`<ha-button appearance="plain" @click="${this._back}">${this.hass.localize("ui.panel.energy.setup.back")}</ha-button>`:a.qy`<div></div>`} ${this._step<4?a.qy`<ha-button @click="${this._next}">${this.hass.localize("ui.panel.energy.setup.next")}</ha-button>`:a.qy`<ha-button @click="${this._setupDone}"> ${this.hass.localize("ui.panel.energy.setup.done")} </ha-button>`} </div> `}async _fetchconfig(){this._info=await(0,h.BV)(this.hass)}_prefsChanged(e){this._preferences=e.detail.value}_back(){0!==this._step&&this._step--}_next(){5!==this._step&&this._step++}async _setupDone(){if(this._preferences)if(0!==this._preferences.device_consumption.length||0!==this._preferences.energy_sources.length){try{this._preferences=await(0,h.WN)(this.hass,this._preferences)}catch(e){(0,c.showAlertDialog)(this,{title:`Failed to save config: ${e.message}`})}(0,o.r)(this,"reload-energy-panel")}else(0,c.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")})}static get styles(){return[l.RF,a.AH`:host{display:block;padding:16px;max-width:700px;margin:0 auto}ha-button{margin-top:8px}.buttons{display:flex;justify-content:space-between}`]}constructor(...e){super(...e),this._step=0,this._preferences={energy_sources:[],device_consumption:[],device_consumption_water:[]}}}(0,i.Cg)([(0,r.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],$.prototype,"lovelace",void 0),(0,i.Cg)([(0,r.wk)()],$.prototype,"_info",void 0),(0,i.Cg)([(0,r.wk)()],$.prototype,"_step",void 0),(0,i.Cg)([(0,r.wk)()],$.prototype,"_preferences",void 0),$=(0,i.Cg)([(0,r.EM)("energy-setup-wizard-card")],$),n()}catch(e){n(e)}})},75751(e,t,s){s.d(t,{u:()=>o});s(45367),s(92731);var n=s(5055),i=s(42017),a=s(63937);const r=(e,t,s)=>{const n=new Map;for(let i=t;i<=s;i++)n.set(e[i],i);return n},o=(0,i.u$)(class extends i.WL{dt(e,t,s){let n;void 0===s?s=t:void 0!==t&&(n=t);const i=[],a=[];let r=0;for(const t of e)i[r]=n?n(t,r):r,a[r]=s(t,r),r++;return{values:a,keys:i}}render(e,t,s){return this.dt(e,t,s).values}update(e,[t,s,i]){const o=(0,a.cN)(e),{values:h,keys:c}=this.dt(t,s,i);if(!Array.isArray(o))return this.ut=c,h;const l=this.ut??=[],p=[];let g,f,u=0,d=o.length-1,_=0,y=h.length-1;for(;u<=d&&_<=y;)if(null===o[u])u++;else if(null===o[d])d--;else if(l[u]===c[_])p[_]=(0,a.lx)(o[u],h[_]),u++,_++;else if(l[d]===c[y])p[y]=(0,a.lx)(o[d],h[y]),d--,y--;else if(l[u]===c[y])p[y]=(0,a.lx)(o[u],h[y]),(0,a.Dx)(e,p[y+1],o[u]),u++,y--;else if(l[d]===c[_])p[_]=(0,a.lx)(o[d],h[_]),(0,a.Dx)(e,o[u],o[d]),d--,_++;else if(void 0===g&&(g=r(c,_,y),f=r(l,u,d)),g.has(l[u]))if(g.has(l[d])){const t=f.get(c[_]),s=void 0!==t?o[t]:null;if(null===s){const t=(0,a.Dx)(e,o[u]);(0,a.lx)(t,h[_]),p[_]=t}else p[_]=(0,a.lx)(s,h[_]),(0,a.Dx)(e,o[u],s),o[t]=null;_++}else(0,a.KO)(o[d]),d--;else(0,a.KO)(o[u]),u++;for(;_<=y;){const t=(0,a.Dx)(e,p[y+1]);(0,a.lx)(t,h[_]),p[_++]=t}for(;u<=d;){const e=o[u++];null!==e&&(0,a.KO)(e)}return this.ut=c,(0,a.mY)(e,p),n.c0}constructor(e){if(super(e),e.type!==i.OA.CHILD)throw Error("repeat() can only be used in text expressions")}})}};