iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 14.6 kB
JavaScript
;(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[85808],{90433:function(t,e,o){o.d(e,{Vy:function(){return r},fI:function(){return a},ux:function(){return c}});var i=o(22786),n=o(79468);const s=54;function r(t,e){const o=t%s+1;return e.getPropertyValue(`--color-${o}`)}function a(t,e){const o=e.getPropertyValue(`--graph-color-${t+1}`)||r(t,e);return(0,n.RQ)(o)}const c=(0,i.A)(t=>Array.from({length:s},(e,o)=>a(o,t)),(t,e)=>t[0].getPropertyValue("--graph-color-1")===e[0].getPropertyValue("--graph-color-1")&&t[0].getPropertyValue("--color-1")===e[0].getPropertyValue("--color-1"))},52943:function(t,e,o){o.d(e,{Z:function(){return i}});const i=t=>t.charAt(0).toUpperCase()+t.slice(1)},82e3:function(t,e,o){o.d(e,{D5:function(){return i},Fy:function(){return r},Gk:function(){return u},Hg:function(){return n},Y_:function(){return l},ds:function(){return c},e0:function(){return s},ec:function(){return a}});o(74423),o(18111),o(61701),o(33110),o(3362);const i=14881==o.j?`${location.protocol}//${location.host}`:null,n=t=>t.map(t=>{if("string"!==t.type)return t;switch(t.name){case"username":return Object.assign(Object.assign({},t),{},{autocomplete:"username",autofocus:!0});case"password":return Object.assign(Object.assign({},t),{},{autocomplete:"current-password"});case"code":return Object.assign(Object.assign({},t),{},{autocomplete:"one-time-code",autofocus:!0});default:return t}}),s=(t,e)=>t.callWS({type:"auth/sign_path",path:e}),r=async(t,e,o,i)=>t.callWS({type:"config/auth_provider/homeassistant/create",user_id:e,username:o,password:i}),a=(t,e,o)=>t.callWS({type:"config/auth_provider/homeassistant/change_password",current_password:e,new_password:o}),c=(t,e,o)=>t.callWS({type:"config/auth_provider/homeassistant/admin_change_password",user_id:e,password:o}),u=(t,e,o)=>t.callWS({type:"config/auth_provider/homeassistant/admin_change_username",user_id:e,username:o}),l=(t,e,o)=>t.callWS({type:"auth/delete_all_refresh_tokens",token_type:e,delete_current_token:o})},93758:function(t,e,o){o.d(e,{CO:function(){return l},NS:function(){return u},f$:function(){return s},ok:function(){return r}});o(3362);var i=o(90889),n=o(9899);const s=async t=>(await t.callWS({type:"labs/list"})).features,r=(t,e,o,i,n)=>t.callWS(Object.assign({type:"labs/update",domain:e,preview_feature:o,enabled:i},void 0!==n&&{create_backup:n})),a=t=>t.sendMessagePromise({type:"labs/list"}).then(t=>t.features),c=(t,e)=>t.subscribeEvents((0,n.s)(()=>a(t).then(t=>e.setState(t,!0)),500,!0),"labs_updated"),u=(t,e)=>(0,i.N)("_labFeatures",a,c,t,e),l=(t,e,o,i)=>t.subscribeMessage(i,{type:"labs/subscribe",domain:e,preview_feature:o})},28669:function(t,e,o){o.d(e,{TK:function(){return a},_2:function(){return u},eR:function(){return n},hG:function(){return c},hU:function(){return s},kg:function(){return r},wj:function(){return i},xg:function(){return l}});o(44114),o(18111),o(61701),o(3362),o(42762);const i="system-admin",n="system-users",s=async t=>t.callWS({type:"config/auth/list"}),r=async(t,e,o,i)=>t.callWS({type:"config/auth/create",name:e,group_ids:o,local_only:i}),a=async(t,e,o)=>t.callWS(Object.assign(Object.assign({},o),{},{type:"config/auth/update",user_id:e})),c=async(t,e)=>t.callWS({type:"config/auth/delete",user_id:e}),u=t=>t?t.trim().split(" ").slice(0,3).map(t=>t.substring(0,1)).join(""):"?",l=(t,e,o)=>{const i=[],n=e=>t.localize(`ui.panel.config.users.${e}`);return e.is_owner&&i.push(["M12 2C6.47 2 2 6.5 2 12C2 17.5 6.5 22 12 22S22 17.5 22 12 17.5 2 12 2M12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4S20 7.58 20 12C20 16.42 16.42 20 12 20M8 14L7 8L10 10L12 7L14 10L17 8L16 14H8M8.56 16C8.22 16 8 15.78 8 15.44V15H16V15.44C16 15.78 15.78 16 15.44 16H8.56Z",n("is_owner")]),o&&e.system_generated&&i.push(["M11,7H15V9H11V11H13A2,2 0 0,1 15,13V15A2,2 0 0,1 13,17H9V15H13V13H11A2,2 0 0,1 9,11V9A2,2 0 0,1 11,7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z",n("is_system")]),e.local_only&&i.push(["M12 20C7.6 20 4 16.4 4 12S7.6 4 12 4 20 7.6 20 12 16.4 20 12 20M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M11 14H13V17H16V12H18L12 7L6 12H8V17H11V14",n("is_local")]),e.is_active||i.push(["M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z",n("is_not_active")]),i}},41250:function(t,e,o){o.d(e,{B8:function(){return h},S6:function(){return l},b9:function(){return u},cJ:function(){return d}});o(16280),o(74423),o(18111),o(22489),o(61701),o(3362),o(17642),o(58004),o(33853),o(45876),o(32475),o(15024),o(31698),o(62953);var i=o(71727),n=o(91926),s=o(6030),r=o(34884),a=o(82405);const c=[{translation_key:"automation_trigger",icon:"mdi:robot-outline"},{translation_key:"automation_condition",icon:"mdi:playlist-check"},{translation_key:"automation_action",icon:"mdi:play-circle-outline"},{translation_key:"script_action",icon:"mdi:script-text-outline"}],u=()=>c.map(t=>({type:"default",key:t.translation_key,enabled:!0,nameKey:`ui.dialogs.more_info_control.add_to.action_options.${t.translation_key}`,icon:t.icon})),l=t=>{const e={};for(const o of t)e[o]="";return e},d=(t,e,o)=>{const n=new Set(t);return e.filter(t=>n.has(t.entity_id)).filter(t=>!t.entity_category&&!t.hidden_by&&!r.ac.includes((0,i.m)(t.entity_id))&&o[t.entity_id]).map(t=>t.entity_id)};function h(t,e){const o={};e.entity_id?o[a.jJ]=e.entity_id:e.device_id?o[a.yz]=e.device_id:e.area_id&&(o[a.ve]=e.area_id);const i=t=>`?${(0,s.KH)(Object.assign({[a.Ku]:t},o))}`;switch(t){case"automation_trigger":return(0,n.oo)(`/config/automation/edit/new${i("trigger")}`);case"automation_condition":return(0,n.oo)(`/config/automation/edit/new${i("condition")}`);case"automation_action":return(0,n.oo)(`/config/automation/edit/new${i("action")}`);case"script_action":return(0,n.oo)(`/config/script/edit/new${i("action")}`);default:return Promise.reject(new Error(`Unknown action key ${t}`))}}},34023:function(t,e,o){o.d(e,{E:function(){return n},J:function(){return s}});o(3362),o(62953);var i=o(1087);const n=()=>Promise.all([o.e(32450),o.e(7305),o.e(92769),o.e(3283),o.e(85010),o.e(89100),o.e(33889),o.e(62574),o.e(26092),o.e(39005),o.e(8851),o.e(66201),o.e(52808),o.e(33887),o.e(33790),o.e(61023)]).then(o.bind(o,39803)),s=(t,e)=>{(0,i.r)(t,"show-dialog",{dialogTag:"dialog-area-registry-detail",dialogImport:n,dialogParams:e})}},82405:function(t,e,o){o.d(e,{II:function(){return u},Ku:function(){return s},gZ:function(){return d},jJ:function(){return r},uV:function(){return n},ve:function(){return c},yz:function(){return a}});o(3362),o(27495),o(62953),o(48408),o(14603),o(47566),o(98721);var i=o(1087);const n="__paste__",s="add_automation_element",r="target_entity_id",a="target_device_id",c="target_area_id",u=(t,e,o,i)=>{const n=new URLSearchParams(window.location.search);if(n.get(s)!==i)return;const u=n.get(r);if(u&&t[u])return{entity_id:u};const l=n.get(a);if(l&&e[l])return{device_id:l};const d=n.get(c);return d&&o[d]?{area_id:d}:void 0},l=()=>Promise.all([o.e(32450),o.e(7305),o.e(92769),o.e(3283),o.e(80131),o.e(70183),o.e(12629),o.e(62574),o.e(61864)]).then(o.bind(o,65467)),d=(t,e)=>{const o=new URLSearchParams(window.location.search);(0,i.r)(t,"show-dialog",{dialogTag:"add-automation-element-dialog",dialogImport:l,dialogParams:e,addHistory:o.get(s)!==e.type})}},89434:function(t,e,o){o.a(t,async function(t,e){try{o(16280),o(74423),o(44114),o(94490),o(26910),o(18111),o(22489),o(7588),o(13579),o(3362),o(62953);var i=o(40445),n=o(5124),s=o(67576),r=o(36312),a=o(69093),c=o(77796),u=o(65829),l=o(86531),d=o(61165),h=o(28669),g=o(11184),_=t([u,g,l]);[u,g,l]=_.then?(await _)():_;let p,b,m,f,y,v=t=>t;const k=(t,e)=>new Date(t.getTime()-1e3*e).getTime()/1e3,w=(t,e)=>(void 0!==t||void 0!==e)&&(!t||!e||t.length!==e.length||t.some(t=>!e.includes(t))||e.some(e=>!t.includes(e)));class C extends n.WF{render(){return(0,r.x)(this.hass.config,"logbook")?this._error?(0,n.qy)(p||(p=v`<div class="no-entries"> ${0} </div>`),`${this.hass.localize("ui.components.logbook.retrieval_error")}: ${this._error}`):void 0===this._logbookEntries?(0,n.qy)(b||(b=v` <div class="progress-wrapper"> <ha-spinner></ha-spinner> </div> `)):0===this._logbookEntries.length?(0,n.qy)(m||(m=v`<div class="no-entries"> ${0} </div>`),this.hass.localize("ui.components.logbook.entries_not_found")):(0,n.qy)(f||(f=v` <ha-logbook-renderer .hass="${0}" .narrow="${0}" .virtualize="${0}" .noIcon="${0}" .noName="${0}" .showIndicator="${0}" .relativeTime="${0}" .entries="${0}" .traceContexts="${0}" .userIdToName="${0}" @hass-logbook-live="${0}"></ha-logbook-renderer> `),this.hass,this.narrow,this.virtualize,this.noIcon,this.noName,this.showIndicator,this.relativeTime,this._logbookEntries,this._traceContexts,this._userIdToName,this._handleLogbookLive):n.s6}async refresh(t=!1){(t||!this._unsubLogbook&&void 0!==this._logbookEntries)&&(this._throttleGetLogbookEntries.cancel(),this._updateTraceContexts.cancel(),this._updateUsers.cancel(),this._unsubscribe(!0),this._liveUpdatesEnabled=!0,t?this._getLogBookData():this._throttleGetLogbookEntries())}shouldUpdate(t){if(1!==t.size||!t.has("hass"))return!0;const e=t.get("hass");return!e||e.localize!==this.hass.localize}willUpdate(t){let e=t.has("time");for(const o of["entityIds","deviceIds","stateFilter"]){if(!t.has(o))continue;const i=t.get(o),n=this[o];if(w(i,n)){e=!0;break}}e&&this.refresh(!0)}_handleLogbookLive(t){t.detail.enable&&!this._liveUpdatesEnabled&&(this._pendingStreamMessages.forEach(t=>this._processStreamMessage(t)),this._pendingStreamMessages=[]),this._liveUpdatesEnabled=t.detail.enable}get _filterAlwaysEmptyResults(){const t=this.entityIds,e=this.deviceIds;return Boolean(t||e)&&(!t||0===t.length)&&(!e||0===e.length)}_unsubscribe(t){this._unsubLogbook&&(this._unsubLogbook.then(t=>t()),this._unsubLogbook=void 0,this._logbookEntries=t?void 0:[],this._pendingStreamMessages=[])}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this._subscribeLogbookPeriod(this._calculateLogbookPeriod())}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe(!0)}_calculateLogbookPeriod(){const t=new Date;if("range"in this.time)return{now:t,startTime:this.time.range[0],endTime:this.time.range[1],purgeBeforePythonTime:void 0};if("recent"in this.time){const e=k(t,this.time.recent);return{now:t,startTime:new Date(1e3*e),endTime:new Date(t.getTime()+31536e6),purgeBeforePythonTime:k(t,this.time.recent)}}throw new Error("Unexpected time specified")}async _subscribeLogbookPeriod(t){if(!this._unsubLogbook)try{this._logbookSubscriptionId++,this._unsubLogbook=(0,l.gM)(this.hass,(t,e)=>{e===this._logbookSubscriptionId&&this._processOrQueueStreamMessage(t)},t.startTime.toISOString(),t.endTime.toISOString(),this._logbookSubscriptionId,this.entityIds,this.deviceIds),await this._unsubLogbook}catch(e){this._unsubLogbook=void 0,this._error=e}}async _getLogBookData(){var t;if(this._error=void 0,this._filterAlwaysEmptyResults)return void this._unsubscribe(!1);const e=this._calculateLogbookPeriod();e.startTime>e.now?this._unsubscribe(!1):(this._updateUsers(),null!==(t=this.hass.user)&&void 0!==t&&t.is_admin&&this._updateTraceContexts(),this._subscribeLogbookPeriod(e))}static get styles(){return[(0,n.AH)(y||(y=v`:host{display:block}:host([virtualize]){height:100%}.no-entries{text-align:center;padding:16px;color:var(--secondary-text-color)}.progress-wrapper{display:flex;justify-content:center;height:100%;align-items:center}`))]}constructor(...t){super(...t),this.narrow=!1,this.virtualize=!1,this.noIcon=!1,this.noName=!1,this.showIndicator=!1,this.relativeTime=!1,this.showMoreLink=!0,this._traceContexts={},this._userIdToName={},this._liveUpdatesEnabled=!0,this._pendingStreamMessages=[],this._throttleGetLogbookEntries=(0,c.n)(()=>this._getLogBookData(),1e3),this._logbookSubscriptionId=0,this._nonExpiredRecords=t=>this._logbookEntries?t?this._logbookEntries.filter(e=>e.when>t):this._logbookEntries:[],this._processOrQueueStreamMessage=t=>{this._liveUpdatesEnabled?this._processStreamMessage(t):this._pendingStreamMessages.push(t)},this._processStreamMessage=t=>{const e="recent"in this.time?k(new Date,this.time.recent):void 0;let o;o=this.stateFilter&&this.stateFilter.length>0?t.events.filter(t=>{var e;return t.state&&(null===(e=this.stateFilter)||void 0===e?void 0:e.includes(t.state))}):[...t.events];const i=o.reverse();if(!this._logbookEntries||!this._logbookEntries.length)return void(this._logbookEntries=i);if(!i.length)return;const n=this._nonExpiredRecords(e);n.length?i[i.length-1].when>n[0].when?this._logbookEntries=i.concat(n):n[n.length-1].when>i[0].when?this._logbookEntries=n.concat(i):this._logbookEntries=n.concat(i).sort((t,e)=>e.when-t.when):this._logbookEntries=i},this._updateTraceContexts=(0,c.n)(async()=>{this._traceContexts=await(0,d.gq)(this.hass)},6e4),this._updateUsers=(0,c.n)(async()=>{var t;const e={},o=(null===(t=this.hass.user)||void 0===t?void 0:t.is_admin)&&(0,h.hU)(this.hass);for(const i of Object.values(this.hass.states))i.attributes.user_id&&"person"===(0,a.t)(i)&&(e[i.attributes.user_id]=i.attributes.friendly_name);if(o){const t=await o;for(const o of t)o.id in e||(e[o.id]=o.name)}this._userIdToName=e},6e4)}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"time",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"entityIds",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"deviceIds",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"stateFilter",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],C.prototype,"narrow",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],C.prototype,"virtualize",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"no-icon"})],C.prototype,"noIcon",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"no-name"})],C.prototype,"noName",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"show-indicator"})],C.prototype,"showIndicator",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"relative-time"})],C.prototype,"relativeTime",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"show-more-link",type:Boolean})],C.prototype,"showMoreLink",void 0),(0,i.Cg)([(0,s.wk)()],C.prototype,"_logbookEntries",void 0),(0,i.Cg)([(0,s.wk)()],C.prototype,"_traceContexts",void 0),(0,i.Cg)([(0,s.wk)()],C.prototype,"_userIdToName",void 0),(0,i.Cg)([(0,s.wk)()],C.prototype,"_error",void 0),C=(0,i.Cg)([(0,s.EM)("ha-logbook")],C),e()}catch(p){e(p)}})}}]);