UNPKG

iobroker.lovelace

Version:

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

1 lines 14 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[81566],{832:function(t,i,e){e.a(t,async function(t,i){try{e(62953);var s=e(40445),a=e(5124),l=e(67576),o=e(1087),n=e(26613),d=t([n]);n=(d.then?(await d)():d)[0];let h,r=t=>t;class u extends a.WF{render(){return this.aliases?(0,a.qy)(h||(h=r` <ha-input-multi .value="${0}" .disabled="${0}" .sortable="${0}" update-on-blur .label="${0}" .removeLabel="${0}" .addLabel="${0}" item-index @value-changed="${0}"> </ha-input-multi> `),this.aliases,this.disabled,this.sortable,this.hass.localize("ui.dialogs.aliases.label"),this.hass.localize("ui.dialogs.aliases.remove"),this.hass.localize("ui.dialogs.aliases.add"),this._aliasesChanged):a.s6}_aliasesChanged(t){t.stopPropagation(),(0,o.r)(this,"value-changed",{value:t.detail.value})}constructor(...t){super(...t),this.disabled=!1,this.sortable=!1}}(0,s.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,l.MZ)({type:Array})],u.prototype,"aliases",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],u.prototype,"sortable",void 0),u=(0,s.Cg)([(0,l.EM)("ha-aliases-editor")],u),i()}catch(h){i(h)}})},26613:function(t,i,e){e.a(t,async function(t,i){try{e(3362),e(62953);var s=e(40445),a=e(35211),l=e(5124),o=e(67576),n=e(75751),d=e(1087),h=e(22792),r=e(14503),u=e(18350),c=e(26300),p=(e(3449),e(85938),e(91485)),g=t([u,c,p]);[u,c,p]=g.then?(await g)():g;let y,v,_,m,b,x,$,f=t=>t;const C="M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19M8,9H16V19H8V9M15.5,4L14.5,3H9.5L8.5,4H5V6H19V4H15.5Z",k="M21 11H3V9H21V11M21 13H3V15H21V13Z",M="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class I extends l.WF{render(){var t,i,e,s;return(0,l.qy)(y||(y=f` <ha-sortable handle-selector=".handle" draggable-selector=".row" .disabled="${0}" @item-moved="${0}"> <div class="items"> ${0} </div> </ha-sortable> <div class="layout horizontal"> <ha-button size="small" appearance="filled" @click="${0}" .disabled="${0}"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0} </ha-button> </div> ${0} `),!this.sortable||this.disabled,this._itemMoved,(0,n.u)(this._items,(t,i)=>`${t}-${i}`,(t,i)=>{var e,s,a;const o=""+(this.itemIndex?` ${i+1}`:"");return(0,l.qy)(v||(v=f` <div class="layout horizontal center-center row"> <ha-input .type="${0}" .autocomplete="${0}" .disabled="${0}" dialogInitialFocus="${0}" .index="${0}" class="flex-auto" .label="${0}" .value="${0}" ?data-last="${0}" @input="${0}" @change="${0}" @keydown="${0}"> ${0} ${0} </ha-input> <ha-icon-button .disabled="${0}" .index="${0}" slot="navigationIcon" .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> ${0} </div> `),this.inputType,this.autocomplete,this.disabled,i,i,""+(this.label?`${this.label}${o}`:""),t,i===this._items.length-1,this._editItem,this._editItem,this._keyDown,this.inputPrefix?(0,l.qy)(_||(_=f`<span slot="start">${0}</span>`),this.inputPrefix):l.s6,this.inputSuffix?(0,l.qy)(m||(m=f`<span slot="end">${0}</span>`),this.inputSuffix):l.s6,this.disabled,i,null!==(e=null!==(s=this.removeLabel)&&void 0!==s?s:null===(a=this._i18n)||void 0===a?void 0:a.localize("ui.common.remove"))&&void 0!==e?e:"Remove",this._removeItem,C,this.sortable?(0,l.qy)(b||(b=f`<ha-svg-icon class="handle" .path="${0}"></ha-svg-icon>`),k):l.s6)}),this._addItem,this.disabled||null!=this.max&&this._items.length>=this.max,M,null!==(t=null!==(i=this.addLabel)&&void 0!==i?i:this.label?null===(e=this._i18n)||void 0===e?void 0:e.localize("ui.components.multi-textfield.add_item",{item:this.label}):null===(s=this._i18n)||void 0===s?void 0:s.localize("ui.common.add"))&&void 0!==t?t:"Add",this.helper?(0,l.qy)(x||(x=f`<ha-input-helper-text .disabled="${0}">${0}</ha-input-helper-text>`),this.disabled,this.helper):l.s6)}get _items(){var t;return null!==(t=this.value)&&void 0!==t?t:[]}async _addItem(){var t;if(null!=this.max&&this._items.length>=this.max)return;const i=[...this._items,""];this._fireChanged(i),await this.updateComplete,null===(t=this._lastInput)||void 0===t||t.focus()}async _editItem(t){if(this.updateOnBlur&&"input"===t.type)return;if(!this.updateOnBlur&&"change"===t.type)return;const i=t.target.index,e=[...this._items];e[i]=t.target.value,this._fireChanged(e)}async _keyDown(t){"Enter"===t.key&&(t.stopPropagation(),this._addItem())}_itemMoved(t){t.stopPropagation();const{oldIndex:i,newIndex:e}=t.detail,s=[...this._items],[a]=s.splice(i,1);s.splice(e,0,a),this._fireChanged(s)}async _removeItem(t){const i=t.target.index,e=[...this._items];e.splice(i,1),this._fireChanged(e)}_fireChanged(t){this.value=t,(0,d.r)(this,"value-changed",{value:t})}static get styles(){return[r.RF,(0,l.AH)($||($=f`.row{margin-bottom:8px;--ha-input-padding-bottom:0}ha-icon-button{display:block}.handle{cursor:grab;padding:8px;margin:-8px}`))]}constructor(...t){super(...t),this.disabled=!1,this.itemIndex=!1,this.sortable=!1,this.updateOnBlur=!1}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],I.prototype,"value",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean})],I.prototype,"disabled",void 0),(0,s.Cg)([(0,o.MZ)()],I.prototype,"label",void 0),(0,s.Cg)([(0,o.MZ)()],I.prototype,"helper",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"input-type"})],I.prototype,"inputType",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"input-suffix"})],I.prototype,"inputSuffix",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"input-prefix"})],I.prototype,"inputPrefix",void 0),(0,s.Cg)([(0,o.MZ)()],I.prototype,"autocomplete",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"add-label"})],I.prototype,"addLabel",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"remove-label"})],I.prototype,"removeLabel",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"item-index",type:Boolean})],I.prototype,"itemIndex",void 0),(0,s.Cg)([(0,o.MZ)({type:Number})],I.prototype,"max",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean})],I.prototype,"sortable",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,attribute:"update-on-blur"})],I.prototype,"updateOnBlur",void 0),(0,s.Cg)([(0,o.wk)(),(0,a.Fg)({context:h.D5,subscribe:!0})],I.prototype,"_i18n",void 0),(0,s.Cg)([(0,o.P)("ha-input[data-last]")],I.prototype,"_lastInput",void 0),I=(0,s.Cg)([(0,o.EM)("ha-input-multi")],I),i()}catch(y){i(y)}})},95341:function(t,i,e){e.a(t,async function(t,i){try{e(74423),e(18111),e(22489),e(61701),e(3362),e(42762),e(62953);var s=e(40445),a=e(5124),l=e(67576),o=e(22786),n=e(36312),d=e(1087),h=e(28978),r=e(84446),u=e(38962),c=e(832),p=(e(9503),e(2846),e(59646)),g=(e(61037),e(53211)),y=e(71117),v=e(59241),_=e(14782),m=e(56982),b=e(54706),x=e(14503),$=e(36918),f=t([u,c,p]);[u,c,p]=f.then?(await f)():f;let C,k,M,I,w,Z,z,H,q,A=t=>t;const V="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";class E extends((0,b.E)(a.WF)){willUpdate(t){(0,n.x)(this.hass.config,"cloud")&&(t.has("entityId")&&this.entityId&&this._fetchEntities(),this.hasUpdated||(0,y.eN)(this.hass).then(t=>{this._cloudStatus=t}))}async _fetchEntities(){try{const t=await(0,m.kz)(this.hass,this.entityId);this._googleEntity=t,this.requestUpdate("_googleEntity")}catch(t){"not_supported"===t.code&&(this._unsupported["cloud.google_assistant"]=!0,this.requestUpdate("_unsupported"))}try{await(0,g.Gk)(this.hass,this.entityId)}catch(t){"not_supported"===t.code&&(this._unsupported["cloud.alexa"]=!0,this.requestUpdate("_unsupported"))}}render(){var t,i,e,s;const l=!0===(null===(t=this._cloudStatus)||void 0===t?void 0:t.logged_in)&&!0===this._cloudStatus.prefs.google_enabled,o=!0===(null===(i=this._cloudStatus)||void 0===i?void 0:i.logged_in)&&!0===this._cloudStatus.prefs.alexa_enabled,n=[...Object.keys(_.aK)],d=[...n],u=o&&!(0,r.z)(this._cloudStatus.alexa_entities),c=l&&!(0,r.z)(this._cloudStatus.google_entities);l?c&&d.splice(d.indexOf("cloud.google_assistant"),1):(n.splice(n.indexOf("cloud.google_assistant"),1),d.splice(n.indexOf("cloud.google_assistant"),1)),o?u&&d.splice(d.indexOf("cloud.alexa"),1):(n.splice(n.indexOf("cloud.alexa"),1),d.splice(d.indexOf("cloud.alexa"),1));const p=d.some(t=>this.exposed[t]);let g;(u||c)&&(g=this._getEntityFilterFuncs(this._cloudStatus.google_entities,this._cloudStatus.alexa_entities));const y=u&&g.alexa(this.entityId),v=c&&g.google(this.entityId),m=p||y||v;return(0,a.qy)(C||(C=A` <ha-md-list-item> <h3 slot="headline"> ${0} </h3> <ha-switch slot="end" @change="${0}" .assistants="${0}" .checked="${0}"></ha-switch> </ha-md-list-item> ${0} <h3 class="header"> ${0} </h3> <p class="description"> ${0} </p> ${0} `),this.hass.localize("ui.dialogs.voice-settings.expose_header"),this._toggleAll,d,m,m?n.map(t=>{var i;const e=!this._unsupported[t],s=u&&"cloud.alexa"===t?y:c&&"cloud.google_assistant"===t?v:this.exposed[t],l=u&&"cloud.alexa"===t||c&&"cloud.google_assistant"===t,o="cloud.google_assistant"===t&&!c&&e&&(null===(i=this._googleEntity)||void 0===i?void 0:i.might_2fa);return(0,a.qy)(k||(k=A` <ha-md-list-item> <voice-assistant-brand-icon slot="start" .voiceAssistantId="${0}" .hass="${0}"> </voice-assistant-brand-icon> <span slot="headline">${0}</span> ${0} ${0} ${0} <ha-switch slot="end" .assistant="${0}" @change="${0}" .disabled="${0}" .checked="${0}"></ha-switch> </ha-md-list-item> `),t,this.hass,_.aK[t].name,e?a.s6:(0,a.qy)(M||(M=A`<div slot="supporting-text" class="unsupported"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </div>`),V,this.hass.localize("ui.dialogs.voice-settings.unsupported")),l?(0,a.qy)(I||(I=A` <div slot="supporting-text"> ${0} </div> `),this.hass.localize("ui.dialogs.voice-settings.manual_config")):a.s6,o?(0,a.qy)(w||(w=A` <ha-checkbox slot="supporting-text" .checked="${0}" @change="${0}"> ${0} </ha-checkbox> `),!this._googleEntity.disable_2fa,this._2faChanged,this.hass.localize("ui.dialogs.voice-settings.ask_pin")):a.s6,t,this._toggleAssistant,l||!s&&!e,s)}):a.s6,this.hass.localize("ui.dialogs.voice-settings.aliases_header"),this.hass.localize("ui.dialogs.voice-settings.aliases_description"),this.entry?(0,a.qy)(H||(H=A` <ha-md-list-item> <span slot="headline"> ${0} </span> <span slot="supporting-text"> ${0} </span> <ha-switch slot="end" .checked="${0}" @change="${0}"></ha-switch> </ha-md-list-item> <ha-aliases-editor .hass="${0}" .aliases="${0}" sortable @value-changed="${0}"></ha-aliases-editor> `),this.hass.states[this.entityId]?(0,h.u)(this.hass.states[this.entityId]):this.entityId,this.hass.localize("ui.dialogs.voice-settings.entity_name_alias_description"),(null!==(e=this._aliases)&&void 0!==e?e:this.entry.aliases).includes(null),this._toggleEntityNameAlias,this.hass,(null!==(s=this._aliases)&&void 0!==s?s:this.entry.aliases).filter(t=>null!==t),this._aliasesChanged):(0,a.qy)(Z||(Z=A`<ha-alert alert-type="warning"> ${0} </ha-alert>`),this.hass.localize("ui.dialogs.voice-settings.aliases_no_unique_id",{faq_link:(0,a.qy)(z||(z=A`<a href="${0}" target="_blank" rel="noreferrer">${0}</a>`),(0,$.o)(this.hass,"/faq/unique_id"),this.hass.localize("ui.dialogs.entity_registry.faq"))})))}async _toggleEntityNameAlias(t){var i,e,s;const a=t.target.checked,l=null!==(i=null!==(e=this._aliases)&&void 0!==e?e:null===(s=this.entry)||void 0===s?void 0:s.aliases)&&void 0!==i?i:[];this._aliases=a?[null,...l.filter(t=>null!==t)]:l.filter(t=>null!==t),await this._saveAliases()}_aliasesChanged(t){var i,e,s;const a=(null!==(i=null!==(e=this._aliases)&&void 0!==e?e:null===(s=this.entry)||void 0===s?void 0:s.aliases)&&void 0!==i?i:[]).includes(null)?[null]:[],l=t.detail.value;this._aliases=[...a,...l],this._saveAliases()}async _2faChanged(t){try{await(0,y.p1)(this.hass,this.entityId,!t.target.checked)}catch(i){t.target.checked=!t.target.checked}}async _saveAliases(){if(!this._aliases)return;const t=this._aliases.includes(null)?[null]:[],i=this._aliases.filter(t=>null!==t).map(t=>t.trim()).filter(t=>t),e=await(0,v.G_)(this.hass,this.entityId,{aliases:[...t,...i]});(0,d.r)(this,"entity-entry-updated",e.entity_entry)}async _toggleAssistant(t){if((0,_.ij)(this.hass,[t.target.assistant],[this.entityId],t.target.checked),this.entry){const t=await(0,v.v)(this.hass,this.entityId);(0,d.r)(this,"entity-entry-updated",t)}(0,d.r)(this,"exposed-entities-changed")}async _toggleAll(t){const i=t.target.checked?t.target.assistants.filter(t=>!this._unsupported[t]):t.target.assistants;if((0,_.ij)(this.hass,i,[this.entityId],t.target.checked),this.entry){const t=await(0,v.v)(this.hass,this.entityId);(0,d.r)(this,"entity-entry-updated",t)}(0,d.r)(this,"exposed-entities-changed")}static get styles(){return[x.RF,(0,a.AH)(q||(q=A`:host{display:block;margin:32px;margin-top:0}ha-md-list-item{--md-list-item-leading-space:0;--md-list-item-trailing-space:0;--md-item-overflow:visible}img{height:32px;width:32px;margin-right:16px;margin-inline-end:16px;margin-inline-start:initial}ha-aliases-editor{display:block}ha-alert{display:block;margin-top:16px}.unsupported{display:flex;align-items:center}.unsupported ha-svg-icon{color:var(--error-color);--mdc-icon-size:16px;margin-right:4px;margin-inline-end:4px;margin-inline-start:initial}.header{margin-top:8px;margin-bottom:4px}.description{color:var(--secondary-text-color);font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-condensed);margin-top:0;margin-bottom:16px}`))]}constructor(...t){super(...t),this._unsupported={},this._getEntityFilterFuncs=(0,o.A)((t,i)=>({google:(0,r.p)(t.include_domains,t.include_entities,t.exclude_domains,t.exclude_entities),alexa:(0,r.p)(i.include_domains,i.include_entities,i.exclude_domains,i.exclude_entities)}))}}(0,s.Cg)([(0,l.MZ)({attribute:!1})],E.prototype,"hass",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],E.prototype,"entityId",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],E.prototype,"exposed",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],E.prototype,"entry",void 0),(0,s.Cg)([(0,l.wk)()],E.prototype,"_cloudStatus",void 0),(0,s.Cg)([(0,l.wk)()],E.prototype,"_aliases",void 0),(0,s.Cg)([(0,l.wk)()],E.prototype,"_googleEntity",void 0),(0,s.Cg)([(0,l.wk)()],E.prototype,"_unsupported",void 0),E=(0,s.Cg)([(0,l.EM)("entity-voice-settings")],E),i()}catch(C){i(C)}})}}]);