UNPKG

iobroker.lovelace

Version:

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

1 lines 4.84 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[73618],{54706:function(e,s,t){t.d(s,{E:function(){return a}});t(74423),t(18111),t(13579),t(3362),t(62953);var i=t(40445),r=t(67576);const a=e=>{class s extends e{connectedCallback(){super.connectedCallback(),this._checkSubscribed()}disconnectedCallback(){if(super.disconnectedCallback(),this.__unsubs){for(;this.__unsubs.length;){const e=this.__unsubs.pop();e instanceof Promise?e.then(e=>e()):e()}this.__unsubs=void 0}}updated(e){if(super.updated(e),e.has("hass"))this._checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const s of e.keys())if(this.hassSubscribeRequiredHostProps.includes(s))return void this._checkSubscribed()}hassSubscribe(){return[]}_checkSubscribed(){var e;void 0!==this.__unsubs||!this.isConnected||void 0===this.hass||null!==(e=this.hassSubscribeRequiredHostProps)&&void 0!==e&&e.some(e=>void 0===this[e])||(this.__unsubs=this.hassSubscribe())}}return(0,i.Cg)([(0,r.MZ)({attribute:!1})],s.prototype,"hass",void 0),s}},62284:function(e,s,t){t.a(e,async function(e,i){try{t.r(s),t.d(s,{HuiEnergyCompareCard:function(){return q}});t(3362),t(62953);var r=t(40445),a=t(6946),o=t(73983),n=t(5124),h=t(67576),c=t(72487),d=t(38114),p=t(54706),l=t(784),u=t(38962),_=t(1087),b=t(14503),y=e([u,c,d]);[u,c,d]=y.then?(await y)():y;let g,m,C,f,v,k,w=e=>e;class q extends((0,p.E)(n.WF)){static async getConfigElement(){return await t.e(79062).then(t.bind(t,54197)),document.createElement("hui-energy-graph-card-editor")}static getStubConfig(e,s,t){return{type:"energy-compare"}}getCardSize(){return 1}setConfig(e){e.collection_key&&(0,d.s8)(e.collection_key),this._config=e}hassSubscribe(){return[(0,d.tb)(this.hass,{key:this._config.collection_key}).subscribe(e=>this._update(e))]}shouldUpdate(e){return(0,l.xP)(this,e)||e.has("preview")||e.size>1||!e.has("hass")}update(e){super.update(e),e.has("preview")&&this._checkVisibility()}render(){if(this.preview)return(0,n.qy)(g||(g=w` <ha-alert> ${0} </ha-alert> `),this.hass.localize("ui.panel.lovelace.cards.energy.energy_compare.info",{start:(0,n.qy)(m||(m=w`<b>${0}</b>`),(0,c.Yq)(new Date,this.hass.locale,this.hass.config)),end:(0,n.qy)(C||(C=w`<b>${0}</b> <span>(${0})</span>`),(0,c.Yq)(new Date,this.hass.locale,this.hass.config),this.hass.localize("ui.panel.lovelace.cards.energy.energy_compare.compare_preview"))}));if(!this._startCompare||!this._endCompare)return n.s6;const e=(0,a.c)(this._endCompare,this._startCompare);return(0,n.qy)(f||(f=w` <ha-alert dismissable @alert-dismissed-clicked="${0}"> ${0} </ha-alert> `),this._stopCompare,this.hass.localize("ui.panel.lovelace.cards.energy.energy_compare.info",{start:(0,n.qy)(v||(v=w`<b>${0}${0}</b>`),(0,c.Yq)(this._start,this.hass.locale,this.hass.config),e>0?` -\n ${(0,c.Yq)(this._end||(0,o.D)(new Date),this.hass.locale,this.hass.config)}`:""),end:(0,n.qy)(k||(k=w`<b>${0}${0}</b> <button class="link" @click="${0}"> (${0}) </button>`),(0,c.Yq)(this._startCompare,this.hass.locale,this.hass.config),e>0?` -\n ${(0,c.Yq)(this._endCompare,this.hass.locale,this.hass.config)}`:"",this._changeCompareMode,this._compareMode===d.lh.PREVIOUS?this.hass.localize("ui.panel.lovelace.cards.energy.energy_compare.compare_previous_year"):this.hass.localize("ui.panel.lovelace.cards.energy.energy_compare.compare_previous_period"))}))}_changeCompareMode(){const e=(0,d.tb)(this.hass,{key:this._config.collection_key});e.setCompare(this._compareMode===d.lh.PREVIOUS?d.lh.YOY:d.lh.PREVIOUS),e.refresh()}_update(e){this._start=e.start,this._end=e.end,this._startCompare=e.startCompare,this._endCompare=e.endCompare,this._compareMode=e.compareMode,this._checkVisibility()}_checkVisibility(){const e=this.hidden;this.hidden=!this._startCompare&&!this.preview,e!==this.hidden&&(0,_.r)(this,"card-visibility-changed")}_stopCompare(){const e=(0,d.tb)(this.hass,{key:this._config.collection_key});e.setCompare(d.lh.NONE),e.refresh()}constructor(...e){super(...e),this.hidden=!0,this.preview=!1,this.connectedWhileHidden=!0,this.hassSubscribeRequiredHostProps=["_config"]}}q.styles=[b.og],(0,r.Cg)([(0,h.MZ)({attribute:!1})],q.prototype,"hass",void 0),(0,r.Cg)([(0,h.wk)()],q.prototype,"_config",void 0),(0,r.Cg)([(0,h.wk)()],q.prototype,"_start",void 0),(0,r.Cg)([(0,h.wk)()],q.prototype,"_end",void 0),(0,r.Cg)([(0,h.wk)()],q.prototype,"_startCompare",void 0),(0,r.Cg)([(0,h.wk)()],q.prototype,"_endCompare",void 0),(0,r.Cg)([(0,h.wk)()],q.prototype,"_compareMode",void 0),(0,r.Cg)([(0,h.MZ)({type:Boolean,reflect:!0})],q.prototype,"hidden",void 0),(0,r.Cg)([(0,h.MZ)({attribute:!1})],q.prototype,"preview",void 0),q=(0,r.Cg)([(0,h.EM)("hui-energy-compare-card")],q),i()}catch(g){i(g)}})},56434:function(e,s,t){t.d(s,{e:function(){return r}});var i=t(81977);function r(e,s,t){return(0,i.P)(e,12*s,t)}}}]);