iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 1.91 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[67973],{85657:function(t,e,i){i.d(e,{K:function(){return s}});const s=(t,e,i)=>t.callService("text","set_value",{value:i},{entity_id:e})},58212:function(t,e,i){i.a(t,async function(t,s){try{i.r(e);i(16280);var a=i(40445),n=i(5124),h=i(67576),r=i(91485),o=i(22675),u=i(85657),c=i(784),l=i(79757),g=i(85979),d=t([r,l,g]);[r,l,g]=d.then?(await d)():d;let f,y,p,_=t=>t;class v extends n.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}shouldUpdate(t){return(0,c.LX)(this,t)}render(){if(!this._config||!this.hass)return n.s6;const t=this.hass.states[this._config.entity];if(!t)return(0,n.qy)(f||(f=_` <hui-warning .hass="${0}"> ${0} </hui-warning> `),this.hass,(0,g.j)(this.hass,this._config.entity));const e=this.hass.formatEntityName(t,this._config.name);return(0,n.qy)(y||(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}" ="${0}" .placeholder="${0}"></ha-input> </hui-generic-entity-row> `),this.hass,this._config,e,t.state===o.Hh,t.state,t.attributes.min,t.attributes.max,t.attributes.pattern,t.attributes.pattern,t.attributes.mode,this._valueChanged,this.hass.localize("ui.card.text.empty_value"))}_valueChanged(t){var e;const i=this.hass.states[this._config.entity],s=t.target,a=null!==(e=s.value)&&void 0!==e?e:"";!a||a!==o.Hh&&a!==o.HV?(a!==i.state&&(0,u.K)(this.hass,i.entity_id,a),s.blur()):s.value=i.state}}v.styles=(0,n.AH)(p||(p=_`hui-generic-entity-row{display:flex;align-items:center}ha-input{width:100%}`)),(0,a.Cg)([(0,h.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,h.wk)()],v.prototype,"_config",void 0),v=(0,a.Cg)([(0,h.EM)("hui-text-entity-row")],v),s()}catch(f){s(f)}})}}]);