UNPKG

iobroker.lovelace

Version:

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

1 lines 2.28 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[8086],{12284:function(t,e,i){i.d(e,{BJ:function(){return r},KY:function(){return n},MG:function(){return s},d_:function(){return h},m4:function(){return a}});const n=(t,e,i)=>t.callService(e.split(".",1)[0],"set_value",{value:i,entity_id:e}),s=t=>t.callWS({type:"input_text/list"}),a=(t,e)=>t.callWS(Object.assign({type:"input_text/create"},e)),r=(t,e,i)=>t.callWS(Object.assign({type:"input_text/update",input_text_id:e},i)),h=(t,e)=>t.callWS({type:"input_text/delete",input_text_id:e})},51765:function(t,e,i){i.a(t,async function(t,n){try{i.r(e);i(16280);var s=i(40445),a=i(5124),r=i(67576),h=i(91485),u=i(22675),c=i(12284),o=i(784),l=i(79757),d=i(85979),p=t([h,l,d]);[h,l,d]=p.then?(await p)():p;let f,g,_,y=t=>t;class m extends a.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}shouldUpdate(t){return(0,o.LX)(this,t)}render(){if(!this._config||!this.hass)return a.s6;const t=this.hass.states[this._config.entity];if(!t)return(0,a.qy)(f||(f=y` <hui-warning .hass="${0}"> ${0} </hui-warning> `),this.hass,(0,d.j)(this.hass,this._config.entity));const e=this.hass.formatEntityName(t,this._config.name);return(0,a.qy)(g||(g=y` <hui-generic-entity-row .hass="${0}" .config="${0}" hide-name> <ha-input .label="${0}" .disabled="${0}" .value="${0}" .minlength="${0}" .maxlength="${0}" .autoValidate="${0}" .pattern="${0}" .type="${0}" @change="${0}" .placeholder="${0}"></ha-input> </hui-generic-entity-row> `),this.hass,this._config,e,t.state===u.Hh,t.state,t.attributes.min,t.attributes.max,t.attributes.pattern,t.attributes.pattern,t.attributes.mode,this._selectedValueChanged,this.hass.localize("ui.card.text.empty_value"))}_selectedValueChanged(t){var e;const i=this.hass.states[this._config.entity],n=t.target,s=null!==(e=n.value)&&void 0!==e?e:"";!s||s!==u.Hh&&s!==u.HV?(s!==i.state&&(0,c.KY)(this.hass,i.entity_id,s),n.blur()):n.value=i.state}}m.styles=(0,a.AH)(_||(_=y`hui-generic-entity-row{display:flex;align-items:center}ha-input{width:100%}`)),(0,s.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,s.Cg)([(0,r.wk)()],m.prototype,"_config",void 0),m=(0,s.Cg)([(0,r.EM)("hui-input-text-entity-row")],m),n()}catch(f){n(f)}})}}]);