UNPKG

iobroker.lovelace

Version:

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

1 lines 5.07 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[76999],{98458:function(e,t,a){a.a(e,async function(e,i){try{a.r(t),a.d(t,{HuiPictureEntityCardEditor:function(){return C}});a(62953);var o=a(40445),n=a(5124),c=a(67576),s=a(22786),l=a(63533),r=a(1087),_=a(71727),d=a(52763),h=a(86063),m=a(999),u=a(91408),p=a(84698),g=a(44155),v=a(7382),y=e([d,h,m]);[d,h,m]=y.then?(await y)():y;let f,b=e=>e;const w="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",q=(0,l.kp)(p.H,(0,l.Ik)({entity:(0,l.lq)((0,l.Yj)()),show_entity_picture:(0,l.lq)((0,l.zM)()),image:(0,l.lq)((0,l.KC)([(0,l.Yj)(),(0,l.Ik)()])),name:(0,l.lq)(g.q),camera_image:(0,l.lq)((0,l.Yj)()),camera_view:(0,l.lq)((0,l.vP)(["auto","live"])),aspect_ratio:(0,l.lq)((0,l.Yj)()),tap_action:(0,l.lq)(u.kn),hold_action:(0,l.lq)(u.kn),double_tap_action:(0,l.lq)(u.kn),show_name:(0,l.lq)((0,l.zM)()),show_state:(0,l.lq)((0,l.zM)()),theme:(0,l.lq)((0,l.Yj)()),fit_mode:(0,l.lq)((0,l.vP)(["cover","contain","fill"]))}));class C extends n.WF{setConfig(e){(0,l.vA)(e,q),this._config=e}render(){return this.hass&&this._config?(0,n.qy)(f||(f=b` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" .computeHelper="${0}" @value-changed="${0}"></ha-form> `),this.hass,this._processData(this._config),this._schema(this.hass.localize),this._computeLabelCallback,this._computeHelperCallback,this._valueChanged):n.s6}_valueChanged(e){var t,a,i;const o=e.detail.value;o.entity&&o.entity!==(null===(t=this._config)||void 0===t?void 0:t.entity)&&("image"===(0,_.m)(o.entity)||"person"===(0,_.m)(o.entity)&&null!==(a=this.hass)&&void 0!==a&&null!==(a=a.states[o.entity])&&void 0!==a&&a.attributes.entity_picture||o.show_entity_picture&&null!==(i=this.hass)&&void 0!==i&&null!==(i=i.states[o.entity])&&void 0!==i&&i.attributes.entity_picture)&&o.image===h.STUB_IMAGE&&delete o.image,(0,r.r)(this,"config-changed",{config:o})}constructor(...e){super(...e),this._schema=(0,s.A)(e=>[{name:"entity",required:!0,selector:{entity:{}}},{name:"show_entity_picture",selector:{boolean:{}}},{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{name:"image",selector:{media:{accept:["image/*"],clearable:!0,image_upload:!0,hide_content_type:!0,content_id_helper:e("ui.panel.lovelace.editor.card.picture.content_id_helper")}}},{name:"camera_image",selector:{entity:{domain:"camera"}}},{name:"",type:"grid",schema:[{name:"camera_view",required:!0,selector:{select:{options:["auto","live"].map(t=>({value:t,label:e(`ui.panel.lovelace.editor.card.generic.camera_view_options.${t}`)})),mode:"dropdown"}}},{name:"fit_mode",required:!0,selector:{select:{options:["cover","contain","fill"].map(t=>({value:t,label:e(`ui.panel.lovelace.editor.card.generic.fit_mode_options.${t}`)})),mode:"dropdown"}}},{name:"aspect_ratio",selector:{text:{}}}]},{name:"",type:"grid",schema:[{name:"show_name",selector:{boolean:{}}},{name:"show_state",selector:{boolean:{}}}]},{name:"theme",selector:{theme:{}}},{name:"interactions",type:"expandable",flatten:!0,iconPath:w,schema:[{name:"tap_action",selector:{ui_action:{default_action:"more-info"}},context:m.Tq},{name:"",type:"optional_actions",flatten:!0,schema:["hold_action","double_tap_action"].map(e=>({name:e,selector:{ui_action:{default_action:"none"}},context:m.Tq}))}]}]),this._processData=(0,s.A)(e=>Object.assign(Object.assign({show_state:!0,show_name:!0,camera_view:"auto",fit_mode:"cover"},e),"string"==typeof e.image?{image:{media_content_id:e.image}}:{})),this._computeLabelCallback=e=>{switch(e.name){case"theme":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.generic.${e.name}`)}},this._computeHelperCallback=e=>{var t;switch(e.name){case"show_entity_picture":return this.hass.localize("ui.panel.lovelace.editor.card.generic.show_entity_picture_helper");case"aspect_ratio":return"number"==typeof(null===(t=this._config)||void 0===t||null===(t=t.grid_options)||void 0===t?void 0:t.rows)?this.hass.localize("ui.panel.lovelace.editor.card.generic.aspect_ratio_ignored"):"";default:return""}}}}C.styles=v.U,(0,o.Cg)([(0,c.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,o.Cg)([(0,c.wk)()],C.prototype,"_config",void 0),C=(0,o.Cg)([(0,c.EM)("hui-picture-entity-card-editor")],C),i()}catch(f){i(f)}})},84698:function(e,t,a){a.d(t,{H:function(){return o}});var i=a(63533);const o=(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)())})}}]);