UNPKG

iobroker.lovelace

Version:

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

1 lines 16.2 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[36332],{86198:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{T:function(){return l}});var s=i(74487),n=i(22786),o=e([s]);s=(o.then?(await o)():o)[0];const l=(e,t)=>{try{var i,a;return null!==(i=null===(a=r(t))||void 0===a?void 0:a.of(e))&&void 0!==i?i:e}catch(s){return e}},r=(0,n.A)(e=>new Intl.DisplayNames(e.language,{type:"language",fallback:"code"}));a()}catch(l){a(l)}})},44643:function(e,t,i){i.a(e,async function(e,t){try{i(44114),i(13609),i(18111),i(20116),i(61701),i(62953);var a=i(40445),s=i(5124),n=i(67576),o=i(1087),l=i(86198),r=i(69150),c=i(606),d=e([c,l]);[c,l]=d.then?(await d)():d;let p,h,u=e=>e;const v="preferred",g="last_used";class _ extends s.WF{get _default(){return this.includeLastUsed?g:v}render(){var e,t;if(!this._pipelines)return s.s6;const i=null!==(e=this.value)&&void 0!==e?e:this._default,a=[{value:v,label:this.hass.localize("ui.components.pipeline-picker.preferred",{preferred:null===(t=this._pipelines.find(e=>e.id===this._preferredPipeline))||void 0===t?void 0:t.name})}];return this.includeLastUsed&&a.unshift({value:g,label:this.hass.localize("ui.components.pipeline-picker.last_used")}),a.push(...this._pipelines.map(e=>({value:e.id,label:`${e.name} (${(0,l.T)(e.language,this.hass.locale)})`}))),(0,s.qy)(p||(p=u` <ha-select .label="${0}" .value="${0}" .required="${0}" .disabled="${0}" @selected="${0}" .options="${0}"> </ha-select> `),this.label||this.hass.localize("ui.components.pipeline-picker.pipeline"),i,this.required,this.disabled,this._changed,a)}firstUpdated(e){super.firstUpdated(e),(0,r.nx)(this.hass).then(e=>{this._pipelines=e.pipelines,this._preferredPipeline=e.preferred_pipeline})}_changed(e){const t=e.detail.value;!this.hass||""===t||t===this.value||void 0===this.value&&t===this._default||(this.value=t===this._default?void 0:t,(0,o.r)(this,"value-changed",{value:this.value}))}constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.includeLastUsed=!1,this._preferredPipeline=null}}_.styles=(0,s.AH)(h||(h=u`ha-select{width:100%}`)),(0,a.Cg)([(0,n.MZ)()],_.prototype,"value",void 0),(0,a.Cg)([(0,n.MZ)()],_.prototype,"label",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],_.prototype,"disabled",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"required",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"includeLastUsed",void 0),(0,a.Cg)([(0,n.wk)()],_.prototype,"_pipelines",void 0),(0,a.Cg)([(0,n.wk)()],_.prototype,"_preferredPipeline",void 0),_=(0,a.Cg)([(0,n.EM)("ha-assist-pipeline-picker")],_),t()}catch(p){t(p)}})},27571:function(e,t,i){i.a(e,async function(e,t){try{i(62953);var a=i(40445),s=i(5124),n=i(67576),o=(i(67094),i(34127)),l=e([o]);o=(l.then?(await l)():l)[0];let r,c,d=e=>e;const p="M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z";class h extends s.WF{render(){return(0,s.qy)(r||(r=d` <ha-svg-icon id="svg-icon" .path="${0}"></ha-svg-icon> <ha-tooltip for="svg-icon" .placement="${0}"> ${0} </ha-tooltip> `),p,this.position,this.label)}constructor(...e){super(...e),this.position="top"}}h.styles=(0,s.AH)(c||(c=d`ha-svg-icon{--mdc-icon-size:var(--ha-help-tooltip-size, 14px);color:var(--ha-help-tooltip-color,var(--disabled-text-color))}`)),(0,a.Cg)([(0,n.MZ)()],h.prototype,"label",void 0),(0,a.Cg)([(0,n.MZ)()],h.prototype,"position",void 0),h=(0,a.Cg)([(0,n.EM)("ha-help-tooltip")],h),t()}catch(r){t(r)}})},606:function(e,t,i){i.a(e,async function(e,t){try{i(74423),i(18111),i(61701),i(62953);var a=i(40445),s=i(5124),n=i(67576),o=i(63672),l=i(22786),r=i(1087),c=i(29823),d=(i(70947),i(3449),i(88285)),p=(i(67094),e([c,d]));[c,d]=p.then?(await p)():p;let h,u,v,g,_,b,f,y,m,$=e=>e;class j extends s.WF{render(){return this.disabled?(0,s.qy)(h||(h=$`${0}${0}`),this._renderField(),this._renderHelper()):(0,s.qy)(u||(u=$` <ha-dropdown placement="bottom" @wa-select="${0}" @wa-show="${0}" @wa-hide="${0}"> ${0} ${0} </ha-dropdown> ${0} `),this._handleSelect,this._handleShow,this._handleHide,this._renderField(),this.options?this.options.map(e=>{var t;const i=["string","number"].includes(typeof e);return(0,s.qy)(v||(v=$` <ha-dropdown-item .value="${0}" .disabled="${0}" .selected="${0}"> ${0} <div class="content"> ${0} ${0} </div> </ha-dropdown-item> `),i?e:e.value,!i&&(null!==(t=e.disabled)&&void 0!==t&&t),this.value===(i?e:e.value),e.iconPath?(0,s.qy)(g||(g=$`<ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon>`),e.iconPath):s.s6,i?e:e.label||e.value,e.secondary?(0,s.qy)(_||(_=$`<div class="secondary">${0}</div>`),e.secondary):s.s6)}):(0,s.qy)(b||(b=$`<slot></slot>`)),this._renderHelper())}_renderField(){const e=this._getValueLabel(this.options,this.value);return(0,s.qy)(f||(f=$` <ha-picker-field slot="trigger" type="button" class="${0}" compact="compact" aria-label="${0}" @clear="${0}" .label="${0}" .value="${0}" .required="${0}" .disabled="${0}" .hideClearIcon="${0}"> </ha-picker-field> `),this._opened?"opened":"",(0,o.J)(this.label),this._clearValue,this.label,e,this.required,this.disabled,!this.clearable||this.required||this.disabled||!String(this.value))}_renderHelper(){return this.helper?(0,s.qy)(y||(y=$`<ha-input-helper-text .disabled="${0}">${0}</ha-input-helper-text>`),this.disabled,this.helper):s.s6}_handleSelect(e){e.stopPropagation();const t=e.detail.item.value;t!==this.value&&(0,r.r)(this,"selected",{value:t})}_clearValue(){!this.disabled&&this.value&&(0,r.r)(this,"selected",{value:void 0})}_handleShow(){this.style.setProperty("--select-menu-width",`${this._triggerField.offsetWidth}px`),this._opened=!0}_handleHide(){this._opened=!1}constructor(...e){super(...e),this.clearable=!1,this.required=!1,this.disabled=!1,this._opened=!1,this._getValueLabel=(0,l.A)((e,t)=>{const i=void 0!==t?String(t):void 0;if(!e||!i)return i;for(const a of e){const e=["string","number"].includes(typeof a);if(e&&a===i||!e&&String(a.value)===i)return e?a:a.label||a.value}return i})}}j.styles=(0,s.AH)(m||(m=$`:host{position:relative}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}ha-dropdown-item .content{display:flex;gap:var(--ha-space-1);flex-direction:column}ha-dropdown-item .secondary{font-size:var(--ha-font-size-s);color:var(--ha-color-text-secondary)}ha-dropdown::part(menu){min-width:var(--select-menu-width)}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}`)),(0,a.Cg)([(0,n.MZ)({type:Boolean})],j.prototype,"clearable",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],j.prototype,"options",void 0),(0,a.Cg)([(0,n.MZ)()],j.prototype,"label",void 0),(0,a.Cg)([(0,n.MZ)()],j.prototype,"helper",void 0),(0,a.Cg)([(0,n.MZ)()],j.prototype,"value",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],j.prototype,"required",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],j.prototype,"disabled",void 0),(0,a.Cg)([(0,n.wk)()],j.prototype,"_opened",void 0),(0,a.Cg)([(0,n.P)("ha-picker-field")],j.prototype,"_triggerField",void 0),j=(0,a.Cg)([(0,n.EM)("ha-select")],j),t()}catch(h){t(h)}})},69150:function(e,t,i){i.d(t,{$$:function(){return g},AH:function(){return s},NH:function(){return h},QC:function(){return a},Uc:function(){return o},Zr:function(){return u},ds:function(){return v},hJ:function(){return l},mp:function(){return c},nx:function(){return r},u6:function(){return d},vU:function(){return n},zn:function(){return p}});i(62953);const a=(e,t,i)=>"run-start"===t.type?e={init_options:i,stage:"ready",run:t.data,events:[t],started:new Date(t.timestamp)}:e?((e="wake_word-start"===t.type?Object.assign(Object.assign({},e),{},{stage:"wake_word",wake_word:Object.assign(Object.assign({},t.data),{},{done:!1})}):"wake_word-end"===t.type?Object.assign(Object.assign({},e),{},{wake_word:Object.assign(Object.assign(Object.assign({},e.wake_word),t.data),{},{done:!0})}):"stt-start"===t.type?Object.assign(Object.assign({},e),{},{stage:"stt",stt:Object.assign(Object.assign({},t.data),{},{done:!1})}):"stt-end"===t.type?Object.assign(Object.assign({},e),{},{stt:Object.assign(Object.assign(Object.assign({},e.stt),t.data),{},{done:!0})}):"intent-start"===t.type?Object.assign(Object.assign({},e),{},{stage:"intent",intent:Object.assign(Object.assign({},t.data),{},{done:!1})}):"intent-end"===t.type?Object.assign(Object.assign({},e),{},{intent:Object.assign(Object.assign(Object.assign({},e.intent),t.data),{},{done:!0})}):"tts-start"===t.type?Object.assign(Object.assign({},e),{},{stage:"tts",tts:Object.assign(Object.assign({},t.data),{},{done:!1})}):"tts-end"===t.type?Object.assign(Object.assign({},e),{},{tts:Object.assign(Object.assign(Object.assign({},e.tts),t.data),{},{done:!0})}):"run-end"===t.type?Object.assign(Object.assign({},e),{},{finished:new Date(t.timestamp),stage:"done"}):"error"===t.type?Object.assign(Object.assign({},e),{},{finished:new Date(t.timestamp),stage:"error",error:t.data}):Object.assign({},e)).events=[...e.events,t],e):void console.warn("Received unexpected event before receiving session",t),s=(e,t,i)=>{let s;const o=n(e,e=>{s=a(s,e,i),"run-end"!==e.type&&"error"!==e.type||o.then(e=>e()),s&&t(s)},i);return o},n=(e,t,i)=>e.connection.subscribeMessage(t,Object.assign(Object.assign({},i),{},{type:"assist_pipeline/run"})),o=(e,t)=>e.callWS({type:"assist_pipeline/pipeline_debug/list",pipeline_id:t}),l=(e,t,i)=>e.callWS({type:"assist_pipeline/pipeline_debug/get",pipeline_id:t,pipeline_run_id:i}),r=e=>e.callWS({type:"assist_pipeline/pipeline/list"}),c=(e,t)=>e.callWS({type:"assist_pipeline/pipeline/get",pipeline_id:t}),d=(e,t)=>e.callWS(Object.assign({type:"assist_pipeline/pipeline/create"},t)),p=(e,t,i)=>e.callWS(Object.assign({type:"assist_pipeline/pipeline/update",pipeline_id:t},i)),h=(e,t)=>e.callWS({type:"assist_pipeline/pipeline/set_preferred",pipeline_id:t}),u=(e,t)=>e.callWS({type:"assist_pipeline/pipeline/delete",pipeline_id:t}),v=e=>e.callWS({type:"assist_pipeline/language/list"}),g=e=>e.callWS({type:"assist_pipeline/device/list"})},999:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{Tq:function(){return C},W0:function(){return M}});i(74423),i(18111),i(61701),i(62953);var s=i(40445),n=i(5124),o=i(67576),l=i(22786),r=i(63533),c=i(1087),d=i(44643),p=i(27571),h=i(30879),u=i(67431),v=i(91485),g=e([d,p,h,u,v]);[d,p,h,u,v]=g.then?(await g)():g;let _,b,f,y,m,$,j,O=e=>e;const C={entity_id:"entity",area_id:"area"},w=["more-info","toggle","navigate","url","perform-action","assist","none"],M=(e,t)=>(0,r.YP)(e,t.toString(),e=>t.includes(e.action)),k=[{type:"grid",name:"",schema:[{name:"pipeline_id",selector:{assist_pipeline:{include_last_used:!0}}},{name:"start_listening",selector:{boolean:{}}}]}];class q extends n.WF{get _navigation_path(){const e=this.config;return(null==e?void 0:e.navigation_path)||""}get _url_path(){const e=this.config;return(null==e?void 0:e.url_path)||""}get _service(){const e=this.config;return(null==e?void 0:e.perform_action)||(null==e?void 0:e.service)||""}render(){var e,t,i,a,s,o,l,r,c;if(!this.hass)return n.s6;const d=null!==(e=this.actions)&&void 0!==e?e:w;let p=(null===(t=this.config)||void 0===t?void 0:t.action)||(this.required?"":"default");"call-service"===p&&(p="perform-action");const h={value:"default",label:`${this.hass.localize("ui.panel.lovelace.editor.action-editor.actions.default_action")} ${this.defaultAction?` (${this.hass.localize(`ui.panel.lovelace.editor.action-editor.actions.${this.defaultAction}`)})`:""}`};return(0,n.qy)(_||(_=O` <div class="dropdown"> <ha-select .label="${0}" .configValue="${0}" @selected="${0}" .value="${0}" .options="${0}"> </ha-select> ${0} </div> ${0} ${0} ${0} ${0} `),this.label,"action",this._actionPicked,p,[...this.required?[]:[h],...d.map(e=>({value:e,label:this.hass.localize(`ui.panel.lovelace.editor.action-editor.actions.${e}`)}))],this.tooltipText?(0,n.qy)(b||(b=O` <ha-help-tooltip .label="${0}"></ha-help-tooltip> `),this.tooltipText):n.s6,"navigate"===(null===(i=this.config)||void 0===i?void 0:i.action)?(0,n.qy)(f||(f=O` <ha-form .hass="${0}" .schema="${0}" .data="${0}" .computeLabel="${0}" @value-changed="${0}"> </ha-form> `),this.hass,this._navigateSchema(null===(a=this.context)||void 0===a?void 0:a.entity_id,null===(s=this.context)||void 0===s?void 0:s.area_id),this.config,this._computeFormLabel,this._formValueChanged):n.s6,"url"===(null===(o=this.config)||void 0===o?void 0:o.action)?(0,n.qy)(y||(y=O` <ha-input .label="${0}" .value="${0}" .configValue="${0}" @input="${0}"></ha-input> `),this.hass.localize("ui.panel.lovelace.editor.action-editor.url_path"),this._url_path,"url_path",this._valueChanged):n.s6,"call-service"===(null===(l=this.config)||void 0===l?void 0:l.action)||"perform-action"===(null===(r=this.config)||void 0===r?void 0:r.action)?(0,n.qy)(m||(m=O` <ha-service-control .hass="${0}" .value="${0}" narrow @value-changed="${0}"></ha-service-control> `),this.hass,this._serviceAction(this.config),this._serviceValueChanged):n.s6,"assist"===(null===(c=this.config)||void 0===c?void 0:c.action)?(0,n.qy)($||($=O` <ha-form .hass="${0}" .schema="${0}" .data="${0}" .computeLabel="${0}" @value-changed="${0}"> </ha-form> `),this.hass,k,this.config,this._computeFormLabel,this._formValueChanged):n.s6)}_actionPicked(e){var t;if(e.stopPropagation(),!this.hass)return;let i=null===(t=this.config)||void 0===t?void 0:t.action;"call-service"===i&&(i="perform-action");const a=e.detail.value;if(i===a)return;if("default"===a||!a)return void(0,c.r)(this,"value-changed",{value:void 0});let s;switch(a){case"url":s={url_path:this._url_path};break;case"perform-action":s={perform_action:this._service};break;case"navigate":s={navigation_path:this._navigation_path}}(0,c.r)(this,"value-changed",{value:Object.assign({action:a},s)})}_valueChanged(e){var t;if(e.stopPropagation(),!this.hass)return;const{configValue:i}=e.target,a=null!==(t=e.target.value)&&void 0!==t?t:"";this[`_${i}`]!==a&&i&&(0,c.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.config),{},{[i]:a})})}_formValueChanged(e){e.stopPropagation();const t=e.detail.value;(0,c.r)(this,"value-changed",{value:t})}_computeFormLabel(e){var t;return null===(t=this.hass)||void 0===t?void 0:t.localize(`ui.panel.lovelace.editor.action-editor.${e.name}`)}_serviceValueChanged(e){e.stopPropagation();const t=Object.assign(Object.assign({},this.config),{},{action:"perform-action",perform_action:e.detail.value.action||"",data:e.detail.value.data,target:e.detail.value.target||{}});e.detail.value.data||delete t.data,"service_data"in t&&delete t.service_data,"service"in t&&delete t.service,(0,c.r)(this,"value-changed",{value:t})}constructor(...e){super(...e),this._serviceAction=(0,l.A)(e=>{var t;return Object.assign(Object.assign({action:this._service},e.data||e.service_data?{data:null!==(t=e.data)&&void 0!==t?t:e.service_data}:null),{},{target:e.target})}),this._navigateSchema=(0,l.A)((e,t)=>[{name:"navigation_path",selector:{navigation:Object.assign(Object.assign({},e?{entity_id:e}:{}),t?{area_id:t}:{})}}])}}q.styles=(0,n.AH)(j||(j=O`.dropdown{position:relative}ha-help-tooltip{position:absolute;right:40px;top:16px;inset-inline-start:initial;inset-inline-end:40px;direction:var(--direction)}ha-input,ha-select{width:100%}ha-form,ha-navigation-picker,ha-service-control{display:block}ha-form,ha-input,ha-navigation-picker,ha-service-control{margin-top:8px}ha-service-control{--service-control-padding:0}`)),(0,s.Cg)([(0,o.MZ)({attribute:!1})],q.prototype,"config",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],q.prototype,"label",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],q.prototype,"actions",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],q.prototype,"defaultAction",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],q.prototype,"tooltipText",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],q.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean})],q.prototype,"required",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],q.prototype,"context",void 0),q=(0,s.Cg)([(0,o.EM)("hui-action-editor")],q),a()}catch(_){a(_)}})}}]);