UNPKG

iobroker.lovelace

Version:

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

1 lines 10 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[59671],{81816:function(t,e,i){i.d(e,{aH:function(){return o},cx:function(){return r},es:function(){return d}});var s=i(37981),a=i(28978),n=i(79461);const o=(t,e,i)=>{const s=e[t.entity_id];return s?r(s,i):(0,a.u)(t)},r=(t,e,i)=>{const o=t.name||("original_name"in t&&null!=t.original_name?String(t.original_name):void 0),r=t.device_id?e[t.device_id]:void 0;if(!r)return o||(i?(0,a.u)(i):void 0);const d=(0,s.xn)(r);return d!==o?d&&o&&(0,n.p)(o,d)||o:void 0},d=(t,e,i)=>!o(t,e,i)},74705:function(t,e,i){i.d(e,{Bj:function(){return u},Cf:function(){return p},uU:function(){return c}});i(18111),i(81148),i(22489),i(61701),i(13579),i(62953);if(66649!=i.j)var s=i(44537);var a=i(15638),n=i(65522),o=i(37981),r=i(81816),d=i(55931),l=i(28978),h=i(28455);const c=(t,e,i,a,n,o,d)=>{var h;if("string"==typeof e)return e;if(!e)return(0,l.u)(t);let c=(0,s.e)(e);const u=null!==(h=null==d?void 0:d.separator)&&void 0!==h?h:" ";if(c.every(t=>"text"===t.type))return c.map(t=>t.text).join(u);if((0,r.es)(t,i,a)){c.some(t=>"device"===t.type)||(c=c.map(t=>"entity"===t.type?{type:"device"}:t))}const y=p(t,c,i,a,n,o);return 1===y.length?y[0]||"":y.filter(t=>t).join(u)},p=(t,e,i,s,a,l)=>{const{device:c,area:p,floor:u}=(0,h.ln)(t,i,s,a,l);return e.map(e=>{switch(e.type){case"entity":return(0,r.aH)(t,i,s);case"device":return c?(0,o.xn)(c):void 0;case"area":return p?(0,n.A)(p):void 0;case"floor":return u?(0,d.X)(u):void 0;case"text":return e.text;default:return""}})},u=(t,e)=>{const[i,s,n]=p(e,[{type:"entity"},{type:"device"},{type:"area"}],t.entities,t.devices,t.areas,t.floors),o=(0,a.qC)(t.language,t.translationMetadata.translations);return{primary:i||s||e.entity_id,secondary:[n,i?s:void 0].filter(Boolean).join(o?" ◂ ":" ▸ ")||void 0}}},93725:function(t,e,i){i.a(t,async function(t,s){try{i.r(e);i(74423),i(44114),i(18111),i(22489),i(61701),i(3362),i(62953);var a=i(40445),n=i(5124),o=i(67576),r=i(1087),d=i(71727),l=i(82286),h=i(47351),c=i(53072),p=i(14503),u=i(38962),y=i(18350),g=(i(93444),i(76538),i(72554)),_=i(36192),m=t([u,y,g,_]);[u,y,g,_]=m.then?(await m)():m;let v,C,f,b,$=t=>t;const M="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";class k extends n.WF{showDialog(t){var e;this._entityId=t.entityId,this._open=!0;const i=this.hass.states[t.entityId];this._groupMembers=(null==i||null===(e=i.attributes.group_members)||void 0===e?void 0:e.filter(e=>e!==t.entityId))||[],this._selectedEntities=this._groupMembers}closeDialog(){this._open=!1}_dialogClosed(){this._open=!1,this._entityId=void 0,this._selectedEntities=[],this._groupMembers=[],this._submitting=!1,this._error=void 0,(0,r.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._entityId)return n.s6;const t=this._entityId;return(0,n.qy)(v||(v=$` <ha-dialog .open="${0}" flexcontent @closed="${0}"> <ha-dialog-header show-border slot="header"> <ha-icon-button .label="${0}" .path="${0}" data-dialog="close" slot="navigationIcon"></ha-icon-button> <span slot="title">${0}</span> <ha-button appearance="plain" slot="actionItems" @click="${0}"> ${0} </ha-button> </ha-dialog-header> ${0} <div class="content"> <ha-media-player-toggle .hass="${0}" .entityId="${0}" checked="checked" disabled="disabled"></ha-media-player-toggle> ${0} </div> <ha-dialog-footer slot="footer"> <ha-button appearance="plain" slot="secondaryAction" @click="${0}"> ${0} </ha-button> <ha-button .disabled="${0}" slot="primaryAction" @click="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this._dialogClosed,this.hass.localize("ui.common.close"),M,this.hass.localize("ui.card.media_player.media_players"),this._selectAll,this.hass.localize("ui.card.media_player.select_all"),this._error?(0,n.qy)(C||(C=$`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):n.s6,this.hass,t,this._mediaPlayerEntities(this.hass.entities).map(t=>(0,n.qy)(f||(f=$`<ha-media-player-toggle .hass="${0}" .entityId="${0}" .checked="${0}" @change="${0}"></ha-media-player-toggle>`),this.hass,t.entity_id,this._selectedEntities.includes(t.entity_id),this._handleSelectedChange)),this.closeDialog,this.hass.localize("ui.common.cancel"),!!this._submitting,this._submit,this.hass.localize("ui.common.apply"))}_selectAll(){this._selectedEntities=this._mediaPlayerEntities(this.hass.entities).map(t=>t.entity_id)}_handleSelectedChange(t){const e=this._selectedEntities.filter(e=>e!==t.target.entityId);t.target.checked&&e.push(t.target.entityId),this._selectedEntities=e}async _submit(){if(this._entityId){this._error=void 0,this._submitting=!0;try{await(0,c.Im)(this.hass,this._entityId,this._selectedEntities),await Promise.all(this._groupMembers.filter(t=>!this._selectedEntities.includes(t)).map(t=>(0,c.fh)(this.hass,t))),this.closeDialog()}catch(t){this._error=(0,h.VR)(t)}this._submitting=!1}}static get styles(){return[p.nA,(0,n.AH)(b||(b=$`.content{display:flex;flex-direction:column;padding-top:var(--ha-space-6);row-gap:var(--ha-space-4)}ha-dialog-header ha-button{margin:6px;display:block}`))]}constructor(...t){super(...t),this._open=!1,this._mediaPlayerEntities=t=>{var e;if(!this._entityId)return[];const i=null===(e=this.hass.entities[this._entityId])||void 0===e?void 0:e.platform;return i?Object.values(t).filter(t=>{var e;return t.entity_id!==this._entityId&&("media_player"===(0,d.m)(t.entity_id)&&((null===(e=this.hass.entities[t.entity_id])||void 0===e?void 0:e.platform)===i&&!(!this.hass.states[t.entity_id]||!(0,l.$)(this.hass.states[t.entity_id],c.vj.GROUPING))))}):[]}}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],k.prototype,"hass",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_entityId",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_groupMembers",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_selectedEntities",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_submitting",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_error",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_open",void 0),k=(0,a.Cg)([(0,o.EM)("dialog-join-media-players")],k),s()}catch(v){s(v)}})},36192:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var s=i(40445),a=i(5124),n=i(67576),o=i(22786),r=i(74705),d=i(15638),l=i(1087),h=i(59646),c=(i(67094),t([h]));h=(c.then?(await c)():c)[0];let p,u,y=t=>t;const g="M12,12A3,3 0 0,0 9,15A3,3 0 0,0 12,18A3,3 0 0,0 15,15A3,3 0 0,0 12,12M12,20A5,5 0 0,1 7,15A5,5 0 0,1 12,10A5,5 0 0,1 17,15A5,5 0 0,1 12,20M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8C10.89,8 10,7.1 10,6C10,4.89 10.89,4 12,4M17,2H7C5.89,2 5,2.89 5,4V20A2,2 0 0,0 7,22H17A2,2 0 0,0 19,20V4C19,2.89 18.1,2 17,2Z",_="M12.28 19.81C11.87 19.92 11.45 20 11 20C8.24 20 6 17.76 6 15S8.24 10 11 10C12.89 10 14.5 11.06 15.37 12.61C16.16 12.23 17.06 12 18 12V4C18 2.89 17.1 2 16 2H6C4.89 2 4 2.89 4 4V20C4 21.11 4.89 22 6 22H13.54C13 21.37 12.54 20.63 12.28 19.81M11 4C12.11 4 13 4.89 13 6S12.11 8 11 8C9.89 8 9 7.1 9 6C9 4.89 9.89 4 11 4M13.74 13.78C12.7 14.82 12.06 16.24 12 17.81C11.69 17.93 11.36 18 11 18C9.34 18 8 16.66 8 15S9.34 12 11 12C12.22 12 13.27 12.73 13.74 13.78M19 15H21V21H19M15 15H17V21H15V15Z",m="M16 15V21L21 18L16 15M12.28 19.81C11.87 19.92 11.45 20 11 20C8.24 20 6 17.76 6 15S8.24 10 11 10C12.89 10 14.5 11.06 15.37 12.61C16.16 12.23 17.06 12 18 12V4C18 2.89 17.1 2 16 2H6C4.89 2 4 2.89 4 4V20C4 21.11 4.89 22 6 22H13.54C13 21.37 12.54 20.63 12.28 19.81M11 4C12.11 4 13 4.89 13 6S12.11 8 11 8C9.89 8 9 7.1 9 6C9 4.89 9.89 4 11 4M13.74 13.78C12.7 14.82 12.06 16.24 12 17.81C11.69 17.93 11.36 18 11 18C9.34 18 8 16.66 8 15S9.34 12 11 12C12.22 12 13.27 12.73 13.74 13.78Z";class v extends a.WF{render(){const t=this.hass.states[this.entityId];let e=g;"playing"===t.state?e=m:"paused"===t.state&&(e=_);const i=(0,d.qC)(this.hass.language,this.hass.translationMetadata.translations),{primary:s,secondary:n}=this._computeDisplayData(this.entityId,this.hass.entities,this.hass.devices,this.hass.areas,this.hass.floors,i,t);return(0,a.qy)(p||(p=y`<div class="list-item"> <ha-svg-icon .path="${0}"></ha-svg-icon> <div class="info"> <div class="main-text">${0}</div> <div class="secondary-text">${0}</div> </div> <ha-switch .disabled="${0}" .checked="${0}" @change="${0}"></ha-switch> </div>`),e,s,n,this.disabled,this.checked,this._handleChange)}static get styles(){return[(0,a.AH)(u||(u=y`.list-item{display:grid;grid-template-columns:auto 1fr auto;column-gap:var(--ha-space-4);align-items:center;width:100%}.info{min-width:0}.main-text{color:var(--primary-text-color)}.main-text[take-height]{line-height:40px}.secondary-text{color:var(--secondary-text-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`))]}_handleChange(t){t.stopPropagation(),this.checked=t.target.checked,(0,l.r)(this,"change")}constructor(...t){super(...t),this.checked=!1,this.disabled=!1,this._computeDisplayData=(0,o.A)((t,e,i,s,a,n,o)=>{const[d,l,h]=(0,r.Cf)(o,[{type:"entity"},{type:"device"},{type:"area"}],e,i,s,a);return{primary:d||l||t,secondary:[h,d?l:void 0].filter(Boolean).join(n?" ◂ ":" ▸ ")}})}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"entityId",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],v.prototype,"checked",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],v.prototype,"disabled",void 0),v=(0,s.Cg)([(0,n.EM)("ha-media-player-toggle")],v),e()}catch(p){e(p)}})},47351:function(t,e,i){i.d(e,{PS:function(){return s},Tv:function(){return o},VR:function(){return a},lE:function(){return r}});i(74423),i(3362),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);const s=t=>t.data,a=t=>"object"==typeof t?"object"==typeof t.body?t.body.message||"Unknown error, see supervisor logs":t.body||t.message||"Unknown error, see supervisor logs":t,n=new Set([502,503,504]),o=t=>!!(t&&t.status_code&&n.has(t.status_code))||!(!t||!t.message||!t.message.includes("ERR_CONNECTION_CLOSED")&&!t.message.includes("ERR_CONNECTION_RESET")),r=async(t,e)=>t({type:"supervisor/api",endpoint:`/${e}/stats`,method:"get"})}}]);