iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 8.6 kB
JavaScript
export const __webpack_ids__=["95267"];export const __webpack_modules__={5839:function(e,t,a){a.d(t,{v:()=>n});var r=a(96194),o=a(73850);function n(e,t){const a=(0,o.M)(e.entity_id),n=void 0!==t?t:e?.state;if(["button","event","input_button","scene"].includes(a))return n!==r.nZ;if((0,r.rk)(n))return!1;if(n===r.PX&&"alert"!==a)return!1;switch(a){case"alarm_control_panel":return"disarmed"!==n;case"alert":return"idle"!==n;case"cover":case"valve":return"closed"!==n;case"device_tracker":case"person":return"not_home"!==n;case"lawn_mower":return["mowing","error"].includes(n);case"lock":return"locked"!==n;case"media_player":return"standby"!==n;case"vacuum":return!["idle","docked","paused"].includes(n);case"plant":return"problem"===n;case"group":return["on","home","open","locked","problem"].includes(n);case"timer":return"active"===n;case"camera":return"streaming"===n}return!0}},29073:function(e,t,a){a.d(t,{u:()=>u});var r=a(44249),o=a(72621),n=(a(9359),a(31526),a(70104),a(57243)),i=a(15093),s=a(29567),l=a(36522);a(99426),a(66671);const d={boolean:()=>Promise.all([a.e("29570"),a.e("79350")]).then(a.bind(a,8353)),constant:()=>a.e("69654").then(a.bind(a,5606)),float:()=>Promise.all([a.e("46379"),a.e("66031"),a.e("62022")]).then(a.bind(a,53203)),grid:()=>a.e("45036").then(a.bind(a,20018)),expandable:()=>a.e("42653").then(a.bind(a,91624)),integer:()=>Promise.all([a.e("46379"),a.e("66031"),a.e("42950"),a.e("29570"),a.e("65505"),a.e("92139"),a.e("94320"),a.e("42849")]).then(a.bind(a,96116)),multi_select:()=>Promise.all([a.e("46379"),a.e("66031"),a.e("91552"),a.e("78456"),a.e("56898"),a.e("42950"),a.e("29570"),a.e("65505"),a.e("5080"),a.e("50408"),a.e("13204"),a.e("99562")]).then(a.bind(a,84545)),positive_time_period_dict:()=>Promise.all([a.e("46379"),a.e("66031"),a.e("91552"),a.e("78456"),a.e("41258"),a.e("56898"),a.e("35671"),a.e("71139"),a.e("31352")]).then(a.bind(a,15063)),select:()=>Promise.all([a.e("46379"),a.e("66031"),a.e("91552"),a.e("78456"),a.e("24199"),a.e("41258"),a.e("56898"),a.e("27506"),a.e("35671"),a.e("42950"),a.e("29570"),a.e("65505"),a.e("7010"),a.e("62524"),a.e("5409"),a.e("47818"),a.e("69638")]).then(a.bind(a,62706)),string:()=>Promise.all([a.e("46379"),a.e("66031"),a.e("36620")]).then(a.bind(a,8327)),optional_actions:()=>a.e("85230").then(a.bind(a,26709))},c=(e,t)=>e?!t.name||t.flatten?e:e[t.name]:null;let u=(0,r.Z)([(0,i.Mo)("ha-form")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"error",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"warning",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"computeError",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"computeWarning",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"computeLabel",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"computeHelper",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"localizeValue",value:void 0},{kind:"method",key:"getFormProperties",value:function(){return{}}},{kind:"method",key:"focus",value:async function(){await this.updateComplete;const e=this.renderRoot.querySelector(".root");if(e)for(const t of e.children)if("HA-ALERT"!==t.tagName){t instanceof n.fl&&await t.updateComplete,t.focus();break}}},{kind:"method",key:"willUpdate",value:function(e){e.has("schema")&&this.schema&&this.schema.forEach((e=>{"selector"in e||d[e.type]?.()}))}},{kind:"method",key:"render",value:function(){return n.dy` <div class="root" part="root"> ${this.error&&this.error.base?n.dy` <ha-alert alert-type="error"> ${this._computeError(this.error.base,this.schema)} </ha-alert> `:""} ${this.schema.map((e=>{const t=((e,t)=>e&&t.name?e[t.name]:null)(this.error,e),a=((e,t)=>e&&t.name?e[t.name]:null)(this.warning,e);return n.dy` ${t?n.dy` <ha-alert own-margin alert-type="error"> ${this._computeError(t,e)} </ha-alert> `:a?n.dy` <ha-alert own-margin alert-type="warning"> ${this._computeWarning(a,e)} </ha-alert> `:""} ${"selector"in e?n.dy`<ha-selector .schema="${e}" .hass="${this.hass}" .name="${e.name}" .selector="${e.selector}" .value="${c(this.data,e)}" .label="${this._computeLabel(e,this.data)}" .disabled="${e.disabled||this.disabled||!1}" .placeholder="${e.required?"":e.default}" .helper="${this._computeHelper(e)}" .localizeValue="${this.localizeValue}" .required="${e.required||!1}" .context="${this._generateContext(e)}"></ha-selector>`:(0,s.h)(this.fieldElementName(e.type),{schema:e,data:c(this.data,e),label:this._computeLabel(e,this.data),helper:this._computeHelper(e),disabled:this.disabled||e.disabled||!1,hass:this.hass,localize:this.hass?.localize,computeLabel:this.computeLabel,computeHelper:this.computeHelper,localizeValue:this.localizeValue,context:this._generateContext(e),...this.getFormProperties()})} `}))} </div> `}},{kind:"method",key:"fieldElementName",value:function(e){return`ha-form-${e}`}},{kind:"method",key:"_generateContext",value:function(e){if(!e.context)return;const t={};for(const[a,r]of Object.entries(e.context))t[a]=this.data[r];return t}},{kind:"method",key:"createRenderRoot",value:function(){const e=(0,o.Z)(a,"createRenderRoot",this,3)([]);return this.addValueChangedListener(e),e}},{kind:"method",key:"addValueChangedListener",value:function(e){e.addEventListener("value-changed",(e=>{e.stopPropagation();const t=e.target.schema;if(e.target===this)return;const a=!t.name||"flatten"in t&&t.flatten?e.detail.value:{[t.name]:e.detail.value};this.data={...this.data,...a},(0,l.B)(this,"value-changed",{value:this.data})}))}},{kind:"method",key:"_computeLabel",value:function(e,t){return this.computeLabel?this.computeLabel(e,t):e?e.name:""}},{kind:"method",key:"_computeHelper",value:function(e){return this.computeHelper?this.computeHelper(e):""}},{kind:"method",key:"_computeError",value:function(e,t){return Array.isArray(e)?n.dy`<ul> ${e.map((e=>n.dy`<li> ${this.computeError?this.computeError(e,t):e} </li>`))} </ul>`:this.computeError?this.computeError(e,t):e}},{kind:"method",key:"_computeWarning",value:function(e,t){return this.computeWarning?this.computeWarning(e,t):e}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`.root>*{display:block}.root>:not([own-margin]):not(:last-child){margin-bottom:24px}ha-alert[own-margin]{margin-bottom:4px}`}]}}),n.oi)},43546:function(e,t,a){a.d(t,{Cp:()=>h,GX:()=>d,PC:()=>s,TZ:()=>m,W2:()=>u,WD:()=>i,YY:()=>f,et:()=>l,iI:()=>n,j2:()=>p,lU:()=>c,oT:()=>o,uw:()=>r});a(9359),a(70104);const r=28639==a.j?`${location.protocol}//${location.host}`:null,o=e=>e.map((e=>{if("string"!==e.type)return e;switch(e.name){case"username":return{...e,autocomplete:"username",autofocus:!0};case"password":return{...e,autocomplete:"current-password"};case"code":return{...e,autocomplete:"one-time-code",autofocus:!0};default:return e}})),n=(e,t)=>e.callWS({type:"auth/sign_path",path:t}),i=()=>fetch("/auth/providers",{credentials:"same-origin"}),s=(e,t,a)=>fetch("/auth/login_flow",{method:"POST",credentials:"same-origin",body:JSON.stringify({client_id:e,handler:a,redirect_uri:t})}),l=(e,t)=>fetch(`/auth/login_flow/${e}`,{method:"POST",credentials:"same-origin",body:JSON.stringify(t)}),d=e=>fetch(`/auth/login_flow/${e}`,{method:"DELETE",credentials:"same-origin"}),c=(e,t,a,r)=>{e.includes("?")?e.endsWith("&")||(e+="&"):e+="?",e+=`code=${encodeURIComponent(t)}`,a&&(e+=`&state=${encodeURIComponent(a)}`),r&&(e+="&storeToken=true"),document.location.assign(e)},u=async(e,t,a,r)=>e.callWS({type:"config/auth_provider/homeassistant/create",user_id:t,username:a,password:r}),h=(e,t,a)=>e.callWS({type:"config/auth_provider/homeassistant/change_password",current_password:t,new_password:a}),m=(e,t,a)=>e.callWS({type:"config/auth_provider/homeassistant/admin_change_password",user_id:t,password:a}),p=(e,t,a)=>e.callWS({type:"config/auth_provider/homeassistant/admin_change_username",user_id:t,username:a}),f=(e,t,a)=>e.callWS({type:"auth/delete_all_refresh_tokens",token_type:t,delete_current_token:a})},96194:function(e,t,a){a.d(t,{ON:()=>i,PX:()=>s,V_:()=>l,lz:()=>n,nZ:()=>o,rk:()=>c});var r=a(92636);const o="unavailable",n="unknown",i="on",s="off",l=[o,n],d=[o,n,s],c=(0,r.z)(l);(0,r.z)(d)}};
//# sourceMappingURL=95267.3f4cd4c64eef507c.js.map