iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 1.45 kB
JavaScript
export const __rspack_esm_id=26846;export const __rspack_esm_ids=[26846];export const __webpack_modules__={21869(t,i,s){s.a(t,async function(t,n){try{s.r(i);var a=s(62826),e=s(5124),o=s(22441),r=s(18350),h=s(22675),c=s(99936),_=s(784),g=s(79757),u=s(85979),l=t([r,g,u]);[r,g,u]=l.then?(await l)():l;class p extends e.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}shouldUpdate(t){return(0,_.LX)(this,t)}render(){if(!this._config||!this.hass)return e.s6;const t=this.hass.states[this._config.entity];return t?e.qy` <hui-generic-entity-row .hass="${this.hass}" .config="${this._config}"> <ha-button appearance="plain" size="small" ="${this._pressButton}" .disabled="${t.state===h.Hh}"> ${this.hass.localize("ui.card.button.press")} </ha-button> </hui-generic-entity-row> `:e.qy` <hui-warning .hass="${this.hass}"> ${(0,u.j)(this.hass,this._config.entity)} </hui-warning> `}async _pressButton(t){t.stopPropagation(),this._config?.confirmation&&!await(0,c.f)(this,this.hass,this._config.confirmation,this.hass.localize("ui.card.button.press"))||this.hass.callService("button","press",{entity_id:this._config.entity})}}p.styles=e.AH`ha-button:last-child{margin-right:-.57em;margin-inline-end:-.57em;margin-inline-start:initial}`,(0,a.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,o.wk)()],p.prototype,"_config",void 0),p=(0,a.Cg)([(0,o.EM)("hui-button-entity-row")],p),n()}catch(t){n(t)}})}};