iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 3.56 kB
JavaScript
export const __rspack_esm_id=61242;export const __rspack_esm_ids=[61242];export const __webpack_modules__={45217(e,t,a){a.a(e,async function(e,i){try{a.r(t),a.d(t,{HuiThermostatCardEditor:()=>b});var s=a(62826),n=a(5124),o=a(22441),r=a(22786),c=a(63533),h=a(1087),l=a(71727),d=(a(11382),a(52763)),_=(a(67094),a(84698)),m=a(44155),u=a(7382),f=a(16161),g=e([d,f]);[d,f]=g.then?(await g)():g;const p="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M7 7H9V9H7V7M7 11H9V13H7V11M7 15H9V17H7V15M17 17H11V15H17V17M17 13H11V11H17V13M17 9H11V7H17V9Z",y={climate:["climate-hvac-modes","climate-preset-modes","climate-fan-modes","climate-swing-modes","climate-swing-horizontal-modes"],water_heater:["water-heater-operation-modes"]},v=(0,c.kp)(_.H,(0,c.Ik)({entity:(0,c.lq)((0,c.Yj)()),name:(0,c.lq)(m.q),theme:(0,c.lq)((0,c.Yj)()),show_current_as_primary:(0,c.lq)((0,c.zM)()),features:(0,c.lq)((0,c.YO)((0,c.bz)()))}));class b extends n.WF{setConfig(e){(0,c.vA)(e,v),this._config=e}render(){if(!this.hass||!this._config)return n.s6;const e=this._config.entity,t=(0,l.m)(e),a=this._featureContext(e);return n.qy` <ha-form .hass="${this.hass}" .data="${this._config}" .schema="${this._schema(t)}" .computeLabel="${this._computeLabelCallback}" -changed="${this._valueChanged}"></ha-form> <ha-expansion-panel outlined> <ha-svg-icon slot="leading-icon" .path="${p}"></ha-svg-icon> <h3 slot="header"> ${this.hass.localize("ui.panel.lovelace.editor.card.generic.features")} </h3> <div class="content"> <hui-card-features-editor .hass="${this.hass}" .context="${a}" .featuresTypes="${y[t]}" .features="${this._config.features??[]}" -changed="${this._featuresChanged}" -detail-element="${this._editDetailElement}"></hui-card-features-editor> </div> </ha-expansion-panel> `}_valueChanged(e){(0,h.r)(this,"config-changed",{config:e.detail.value})}_featuresChanged(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=e.detail.features,a={...this._config,features:t};0===t.length&&delete a.features,(0,h.r)(this,"config-changed",{config:a})}_editDetailElement(e){const t=e.detail.subElementConfig.index,a=this._config.features[t];(0,h.r)(this,"edit-sub-element",{config:a,saveConfig:e=>this._updateFeature(t,e),context:{entity_id:this._config.entity},type:"feature"})}_updateFeature(e,t){const a=this._config.features.concat();a[e]=t;const i={...this._config,features:a};(0,h.r)(this,"config-changed",{config:i})}static get styles(){return[u.U,n.AH`ha-form{display:block;margin-bottom:24px}`]}constructor(...e){super(...e),this._featureContext=(0,r.A)(e=>({entity_id:e})),this._schema=(0,r.A)(e=>[{name:"entity",selector:{entity:{domain:["climate","water_heater"]}}},{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{type:"grid",name:"",schema:[{name:"theme",selector:{theme:{}}}]},..."climate"===e?[{name:"show_current_as_primary",selector:{boolean:{}}}]:[]]),this._computeLabelCallback=e=>"show_current_as_primary"===e.name?this.hass.localize("ui.panel.lovelace.editor.card.thermostat.show_current_as_primary"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,s.Cg)([(0,o.wk)()],b.prototype,"_config",void 0),b=(0,s.Cg)([(0,o.EM)("hui-thermostat-card-editor")],b),i()}catch(e){i(e)}})},84698(e,t,a){a.d(t,{H:()=>s});var i=a(63533);const s=(0,i.Ik)({type:(0,i.Yj)(),view_layout:(0,i.bz)(),layout_options:(0,i.bz)(),grid_options:(0,i.bz)(),visibility:(0,i.bz)(),disabled:(0,i.lq)((0,i.zM)())})}};