iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 5.12 kB
JavaScript
export const __webpack_ids__=["96212"];export const __webpack_modules__={32137:function(e,t,a){a.a(e,(async function(e,i){try{a.r(t),a.d(t,{HuiGaugeCardEditor:()=>g});var n=a(44249),o=(a(9359),a(70104),a(57243)),s=a(15093),l=a(27486),r=a(62900),c=a(36522),d=(a(29073),a(10188)),u=a(30571),h=a(18200),m=e([d]);d=(m.then?(await m)():m)[0];const _="M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5Z",y=["more-info","navigate","url","perform-action","assist","none"],v=(0,r.Ry)({from:(0,r.Rx)(),color:(0,r.Z_)(),label:(0,r.jt)((0,r.Z_)())}),p=(0,r.f0)(h.I,(0,r.Ry)({name:(0,r.jt)((0,r.Z_)()),entity:(0,r.jt)((0,r.Z_)()),unit:(0,r.jt)((0,r.Z_)()),min:(0,r.jt)((0,r.Rx)()),max:(0,r.jt)((0,r.Rx)()),severity:(0,r.jt)((0,r.Ry)()),theme:(0,r.jt)((0,r.Z_)()),needle:(0,r.jt)((0,r.O7)()),segments:(0,r.jt)((0,r.IX)(v)),tap_action:(0,r.jt)((0,r.lF)(u.fJ,y.toString(),(e=>y.includes(e.action)))),hold_action:(0,r.jt)(u.fJ),double_tap_action:(0,r.jt)(u.fJ)}));let g=(0,n.Z)([(0,s.Mo)("hui-gauge-card-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(e){(0,r.hu)(e,p),this._config=e}},{kind:"field",key:"_schema",value:()=>(0,l.Z)((e=>[{name:"entity",selector:{entity:{domain:["counter","input_number","number","sensor"]}}},{name:"",type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"unit",selector:{text:{}}}]},{name:"theme",selector:{theme:{}}},{name:"",type:"grid",schema:[{name:"min",default:d.DEFAULT_MIN,selector:{number:{mode:"box",step:"any"}}},{name:"max",default:d.DEFAULT_MAX,selector:{number:{mode:"box",step:"any"}}}]},{name:"",type:"grid",schema:[{name:"needle",selector:{boolean:{}}},{name:"show_severity",selector:{boolean:{}}}]},...e?[{name:"severity",type:"grid",schema:[{name:"green",selector:{number:{mode:"box",step:"any"}}},{name:"yellow",selector:{number:{mode:"box",step:"any"}}},{name:"red",selector:{number:{mode:"box",step:"any"}}}]}]:[],{name:"interactions",type:"expandable",flatten:!0,iconPath:_,schema:[{name:"tap_action",selector:{ui_action:{actions:y,default_action:"more-info"}}},{name:"",type:"optional_actions",flatten:!0,schema:["hold_action","double_tap_action"].map((e=>({name:e,selector:{ui_action:{actions:y,default_action:"none"}}})))}]}]))},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return o.Ld;const e=this._schema(void 0!==this._config.severity),t={show_severity:void 0!==this._config.severity,...this._config};return o.dy` <ha-form .hass="${this.hass}" .data="${t}" .schema="${e}" .computeLabel="${this._computeLabelCallback}" -changed="${this._valueChanged}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){let t=e.detail.value;t.show_severity?t={...t,severity:{green:t.green||t.severity?.green||0,yellow:t.yellow||t.severity?.yellow||0,red:t.red||t.severity?.red||0}}:!t.show_severity&&t.severity&&delete t.severity,delete t.show_severity,delete t.green,delete t.yellow,delete t.red,(0,c.B)(this,"config-changed",{config:t})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"name":return this.hass.localize("ui.panel.lovelace.editor.card.generic.name");case"entity":return`${this.hass.localize("ui.panel.lovelace.editor.card.generic.entity")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.required")})`;case"max":return this.hass.localize("ui.panel.lovelace.editor.card.generic.maximum");case"min":return this.hass.localize("ui.panel.lovelace.editor.card.generic.minimum");case"show_severity":return this.hass.localize("ui.panel.lovelace.editor.card.gauge.severity.define");case"needle":return this.hass.localize("ui.panel.lovelace.editor.card.gauge.needle_gauge");case"theme":return`${this.hass.localize("ui.panel.lovelace.editor.card.generic.theme")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`;case"unit":return this.hass.localize("ui.panel.lovelace.editor.card.generic.unit");case"interactions":return this.hass.localize("ui.panel.lovelace.editor.card.generic.interactions");case"tap_action":case"hold_action":case"double_tap_action":return`${this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`;default:return this.hass.localize(`ui.panel.lovelace.editor.card.gauge.severity.${e.name}`)}}}}]}}),o.oi);i()}catch(e){i(e)}}))},18200:function(e,t,a){a.d(t,{I:()=>n});var i=a(62900);const n=(0,i.Ry)({type:(0,i.Z_)(),view_layout:(0,i.Yj)(),layout_options:(0,i.Yj)(),grid_options:(0,i.Yj)(),visibility:(0,i.Yj)()})}};
//# sourceMappingURL=96212.4017d201303db51a.js.map