iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 7.14 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[79521],{31580:function(e,a,s){s.d(a,{J8:function(){return t},Rr:function(){return r},b9:function(){return i},iV:function(){return o}});s(94490);const i=e=>{let a=e;return"string"==typeof e&&(a=parseInt(e,16)),"0x"+a.toString(16).padStart(4,"0")},t=(e,a)=>{const s=e.user_given_name?e.user_given_name:e.name,i=a.user_given_name?a.user_given_name:a.name;return s.localeCompare(i)},o=(e,a)=>{const s=e.name,i=a.name;return s.localeCompare(i)},r=e=>`${e.name} (Endpoint id: ${e.endpoint_id}, Id: ${i(e.id)}, Type: ${e.type})`},13843:function(e,a,s){s.d(a,{C:function(){return o}});s(3362),s(62953);var i=s(1087);const t=()=>Promise.all([s.e(67159),s.e(56740)]).then(s.bind(s,81199)),o=(e,a)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-zha-add-group-members",dialogImport:t,dialogParams:a})}},80216:function(e,a,s){s.a(e,async function(e,i){try{s.r(a),s.d(a,{ZHAGroupPage:function(){return x}});s(18111),s(61701),s(3362),s(46058),s(62953);var t=s(40445),o=s(5124),r=s(67576),n=s(91926),h=s(18350),c=(s(76776),s(26300)),l=(s(67094),s(84621)),d=s(28794),p=s(81310),m=s(31580),u=s(92834),g=s(13843),v=e([h,c,d,p,u]);[h,c,d,p,u]=v.then?(await v)():v;let b,f,_,y,z,$,w=e=>e;const C="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",R="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class x extends o.WF{connectedCallback(){super.connectedCallback(),this.hass&&this._firstUpdatedCalled&&this._fetchData()}disconnectedCallback(){super.disconnectedCallback(),this._processingRemove=!1,this._selectedDevicesToRemove=[]}firstUpdated(e){super.firstUpdated(e),this.hass&&this._fetchData(),this._firstUpdatedCalled=!0}render(){return this.group?(0,o.qy)(f||(f=w` <hass-subpage .hass="${0}" .narrow="${0}" .header="${0}" back-path="/config/zha/groups"> <ha-icon-button slot="toolbar-icon" .path="${0}" ="${0}" .label="${0}"></ha-icon-button> <div class="container"> <ha-card> <div class="card-header"> ${0} </div> <div class="summary-grid"> <div> <span class="summary-label">${0}</span> <span class="summary-value">${0}</span> </div> <div> <span class="summary-label">${0}</span> <span class="summary-value">${0}</span> </div> <div> <span class="summary-label">${0}</span> <span class="summary-value">${0}</span> </div> </div> </ha-card> <div class="members-section"> <h2>${0}</h2> ${0} <div class="buttons"> ${0} <ha-button ="${0}"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0} </ha-button> </div> </div> </div> </hass-subpage> `),this.hass,this.narrow,this.group.name,C,this._deleteGroup,this.hass.localize("ui.panel.config.zha.groups.delete"),this.hass.localize("ui.panel.config.zha.groups.group_info"),this.hass.localize("ui.common.name"),this.group.name,this.hass.localize("ui.panel.config.zha.groups.group_id"),(0,m.b9)(this.group.group_id),this.hass.localize("ui.panel.config.zha.groups.members"),this.group.members.length,this.hass.localize("ui.panel.config.zha.groups.members"),this.group.members.length?(0,o.qy)(_||(_=w` <zha-device-endpoint-list id="removeMembers" scrollable show-device-link selectable .deviceEndpoints="${0}" .narrow="${0}" .emptyText="${0}" -changed="${0}"></zha-device-endpoint-list> `),this.group.members,this.narrow,this.hass.localize("ui.panel.config.zha.groups.no_members"),this._handleRemoveSelectionChanged):(0,o.qy)(y||(y=w` <ha-card class="empty-card"> ${0} </ha-card> `),this.hass.localize("ui.panel.config.zha.groups.no_members")),this.group.members.length?(0,o.qy)(z||(z=w` <ha-button appearance="plain" variant="danger" .disabled="${0}" ="${0}" .loading="${0}"> ${0} </ha-button> `),!this._selectedDevicesToRemove.length||this._processingRemove,this._removeMembersFromGroup,this._processingRemove,this.hass.localize("ui.panel.config.zha.groups.remove_members")):o.s6,this._showAddMembersDialog,R,this.hass.localize("ui.panel.config.zha.groups.add_members")):(0,o.qy)(b||(b=w` <hass-error-screen .hass="${0}" .error="${0}"></hass-error-screen> `),this.hass,this.hass.localize("ui.panel.config.zha.groups.group_not_found"))}_showAddMembersDialog(){(0,g.C)(this,{groupId:this.groupId,groupName:this.group.name,devicesAddedCallback:e=>{var a;this.group=e,this._selectedDevicesToRemove=[],null===(a=this._zhaRemoveMembersList)||void 0===a||a.clearSelection()}})}async _fetchData(){null!==this.groupId&&void 0!==this.groupId&&(this.group=await(0,l.Ui)(this.hass,this.groupId))}_handleRemoveSelectionChanged(e){this._selectedDevicesToRemove=e.detail.value}async _removeMembersFromGroup(){this._processingRemove=!0;const e=this._selectedDevicesToRemove.map(e=>{const a=e.split("_");return{ieee:a[0],endpoint_id:a[1]}});this.group=await(0,l.tv)(this.hass,this.groupId,e),this._selectedDevicesToRemove=[],this._zhaRemoveMembersList.clearSelection(),this._processingRemove=!1}async _deleteGroup(){await(0,l.rv)(this.hass,[this.groupId]),(0,n.oo)("/config/zha/groups",{replace:!0})}static get styles(){return[(0,o.AH)($||($=w`hass-subpage{--app-header-text-color:var(--sidebar-icon-color)}.container{box-sizing:border-box;max-width:720px;margin:0 auto;padding:var(--ha-space-4) var(--ha-space-4) calc(var(--ha-space-20) + var(--safe-area-inset-bottom,0px))}.card-header{padding:var(--ha-space-4) var(--ha-space-4) 0;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-condensed)}.summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--ha-space-4);padding:var(--ha-space-4)}.summary-label,.summary-value{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.summary-label{color:var(--secondary-text-color);font-size:var(--ha-font-size-s);line-height:var(--ha-line-height-condensed)}.summary-value{margin-top:var(--ha-space-1);font-size:var(--ha-font-size-l);line-height:var(--ha-line-height-condensed)}.members-section{margin-top:var(--ha-space-6)}h2{margin:0 0 var(--ha-space-3);font-size:var(--ha-font-size-2xl);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-condensed)}.buttons{display:flex;gap:var(--ha-space-2);justify-content:flex-end;padding:var(--ha-space-4) 0 0}.empty-card{padding:var(--ha-space-6);color:var(--secondary-text-color);text-align:center} (max-width:600px){.summary-grid{grid-template-columns:1fr;gap:var(--ha-space-2)}}`))]}constructor(...e){super(...e),this.narrow=!1,this.isWide=!1,this._processingRemove=!1,this._selectedDevicesToRemove=[],this._firstUpdatedCalled=!1}}(0,t.Cg)([(0,r.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,t.Cg)([(0,r.MZ)({type:Object})],x.prototype,"group",void 0),(0,t.Cg)([(0,r.MZ)({attribute:!1})],x.prototype,"groupId",void 0),(0,t.Cg)([(0,r.MZ)({type:Boolean})],x.prototype,"narrow",void 0),(0,t.Cg)([(0,r.MZ)({attribute:"is-wide",type:Boolean})],x.prototype,"isWide",void 0),(0,t.Cg)([(0,r.wk)()],x.prototype,"_processingRemove",void 0),(0,t.Cg)([(0,r.wk)()],x.prototype,"_selectedDevicesToRemove",void 0),(0,t.Cg)([(0,r.P)("#removeMembers")],x.prototype,"_zhaRemoveMembersList",void 0),x=(0,t.Cg)([(0,r.EM)("zha-group-page")],x),i()}catch(b){i(b)}})}}]);