UNPKG

iobroker.lovelace

Version:

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

1 lines 1.59 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[26846],{21869:function(t,i,s){s.a(t,async function(t,n){try{s.r(i);s(16280),s(3362);var a=s(40445),e=s(5124),h=s(67576),o=s(18350),r=s(22675),c=s(99936),u=s(784),l=s(79757),g=s(85979),f=t([o,l,g]);[o,l,g]=f.then?(await f)():f;let p,d,_,y=t=>t;class m extends e.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}shouldUpdate(t){return(0,u.LX)(this,t)}render(){if(!this._config||!this.hass)return e.s6;const t=this.hass.states[this._config.entity];return t?(0,e.qy)(d||(d=y` <hui-generic-entity-row .hass="${0}" .config="${0}"> <ha-button appearance="plain" size="small" @click="${0}" .disabled="${0}"> ${0} </ha-button> </hui-generic-entity-row> `),this.hass,this._config,this._pressButton,t.state===r.Hh,this.hass.localize("ui.card.button.press")):(0,e.qy)(p||(p=y` <hui-warning .hass="${0}"> ${0} </hui-warning> `),this.hass,(0,g.j)(this.hass,this._config.entity))}async _pressButton(t){var i;t.stopPropagation(),null!==(i=this._config)&&void 0!==i&&i.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})}}m.styles=(0,e.AH)(_||(_=y`ha-button:last-child{margin-right:-.57em;margin-inline-end:-.57em;margin-inline-start:initial}`)),(0,a.Cg)([(0,h.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,h.wk)()],m.prototype,"_config",void 0),m=(0,a.Cg)([(0,h.EM)("hui-button-entity-row")],m),n()}catch(p){n(p)}})}}]);