iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 12.3 kB
JavaScript
webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["62885"],{19631:function(e,t,n){n.a(e,(async function(e,a){try{n.d(t,{Bt:()=>r,T8:()=>u});n(19083);var i=n(16485),s=n(88977),o=n(20382),l=e([i]);i=(l.then?(await l)():l)[0];const d=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],r=e=>e.first_weekday===o.FS.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(e.language).weekInfo.firstDay%7:(0,s.L)(e.language)%7:d.includes(e.first_weekday)?d.indexOf(e.first_weekday):1,u=e=>{const t=r(e);return d[t]};a()}catch(d){a(d)}}))},94947:function(e,t,n){n.a(e,(async function(e,a){try{n.d(t,{G:()=>r});var i=n(16485),s=n(27486),o=n(27046),l=e([i,o]);[i,o]=l.then?(await l)():l;const d=(0,s.Z)((e=>new Intl.RelativeTimeFormat(e.language,{numeric:"auto"}))),r=(e,t,n,a=!0)=>{const i=(0,o.W)(e,n,t);return a?d(t).format(i.value,i.unit):Intl.NumberFormat(t.language,{style:"unit",unit:i.unit,unitDisplay:"long"}).format(Math.abs(i.value))};a()}catch(d){a(d)}}))},87733:function(e,t,n){n.d(t,{f:()=>a});const a=e=>e.charAt(0).toUpperCase()+e.slice(1)},27046:function(e,t,n){n.a(e,(async function(e,a){try{n.d(t,{W:()=>f});n(19423);var i=n(13809),s=n(29558),o=n(94763),l=n(19631),d=e([l]);l=(d.then?(await d)():d)[0];const u=1e3,c=60,h=60*c;function f(e,t=Date.now(),n,a={}){const d=Object.assign(Object.assign({},v),a||{}),r=(+e-+t)/u;if(Math.abs(r)<d.second)return{value:Math.round(r),unit:"second"};const f=r/c;if(Math.abs(f)<d.minute)return{value:Math.round(f),unit:"minute"};const b=r/h;if(Math.abs(b)<d.hour)return{value:Math.round(b),unit:"hour"};const m=new Date(e),y=new Date(t);m.setHours(0,0,0,0),y.setHours(0,0,0,0);const k=(0,i.j)(m,y);if(0===k)return{value:Math.round(b),unit:"hour"};if(Math.abs(k)<d.day)return{value:k,unit:"day"};const _=(0,l.Bt)(n),p=(0,s.z)(m,{weekStartsOn:_}),g=(0,s.z)(y,{weekStartsOn:_}),w=(0,o.p)(p,g);if(0===w)return{value:k,unit:"day"};if(Math.abs(w)<d.week)return{value:w,unit:"week"};const C=m.getFullYear()-y.getFullYear(),P=12*C+m.getMonth()-y.getMonth();return 0===P?{value:w,unit:"week"}:Math.abs(P)<d.month||0===C?{value:P,unit:"month"}:{value:Math.round(C),unit:"year"}}const v={second:45,minute:45,hour:22,day:5,week:4,month:11};a()}catch(r){a(r)}}))},20130:function(e,t,n){var a=n(61701),i=n(72621),s=(n(71695),n(47021),n(39785)),o=n(52876),l=n(50778),d=n(57243),r=n(5111);let u,c,h,f=e=>e;(0,a.Z)([(0,l.Mo)("ha-fab")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"method",key:"firstUpdated",value:function(e){(0,i.Z)(n,"firstUpdated",this,3)([e]),this.style.setProperty("--mdc-theme-secondary","var(--primary-color)")}},{kind:"field",static:!0,key:"styles",value(){return[o.W,(0,d.iv)(u||(u=f`:host .mdc-fab--extended .mdc-fab__icon{margin-inline-start:-8px;margin-inline-end:12px;direction:var(--direction)}:disabled{--mdc-theme-secondary:var(--disabled-text-color);pointer-events:none}`)),"rtl"===r.E.document.dir?(0,d.iv)(c||(c=f`:host .mdc-fab--extended .mdc-fab__icon{direction:rtl}`)):(0,d.iv)(h||(h=f``))]}}]}}),s._)},95975:function(e,t,n){n.a(e,(async function(e,t){try{var a=n(61701),i=n(72621),s=(n(71695),n(47021),n(74760)),o=n(57243),l=n(50778),d=n(94947),r=n(87733),u=e([d]);d=(u.then?(await u)():u)[0];(0,a.Z)([(0,l.Mo)("ha-relative-time")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"datetime",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"capitalize",value(){return!1}},{kind:"field",key:"_interval",value:void 0},{kind:"method",key:"disconnectedCallback",value:function(){(0,i.Z)(n,"disconnectedCallback",this,3)([]),this._clearInterval()}},{kind:"method",key:"connectedCallback",value:function(){(0,i.Z)(n,"connectedCallback",this,3)([]),this.datetime&&this._startInterval()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"firstUpdated",value:function(e){(0,i.Z)(n,"firstUpdated",this,3)([e]),this._updateRelative()}},{kind:"method",key:"update",value:function(e){(0,i.Z)(n,"update",this,3)([e]),this._updateRelative()}},{kind:"method",key:"_clearInterval",value:function(){this._interval&&(window.clearInterval(this._interval),this._interval=void 0)}},{kind:"method",key:"_startInterval",value:function(){this._clearInterval(),this._interval=window.setInterval((()=>this._updateRelative()),6e4)}},{kind:"method",key:"_updateRelative",value:function(){if(this.datetime){const e="string"==typeof this.datetime?(0,s.D)(this.datetime):this.datetime,t=(0,d.G)(e,this.hass.locale);this.innerHTML=this.capitalize?(0,r.f)(t):t}else this.innerHTML=this.hass.localize("ui.components.relative_time.never")}}]}}),o.fl);t()}catch(c){t(c)}}))},78586:function(e,t,n){n.d(t,{JG:()=>d,PT:()=>l,ho:()=>s});n(71695),n(92745),n(19423),n(40251),n(47021);var a=n(62212);const i=(e,t)=>e.subscribeMessage((e=>{const n=Object.assign({},t.state||{});if(e.add)for(const t of e.add)n[t.source]=t;if(e.remove)for(const t of e.remove)delete n[t.source];t.setState(n,!0)}),{type:"bluetooth/subscribe_scanner_details"}),s=(e,t)=>(0,a.B)("_bluetoothScannerDetails",(()=>Promise.resolve({})),i,e,t),o=(e,t)=>e.subscribeMessage((e=>{const n=[...t.state||[]];if(e.add)for(const t of e.add){const e=n.findIndex((e=>e.address===t.address));-1===e?n.push(t):n[e]=t}if(e.change)for(const t of e.change){const e=n.findIndex((e=>e.address===t.address));-1!==e&&(n[e]=t)}if(e.remove)for(const t of e.remove){const e=n.findIndex((e=>e.address===t.address));-1!==e&&n.splice(e,1)}t.setState(n,!0)}),{type:"bluetooth/subscribe_advertisements"}),l=(e,t)=>(0,a.B)("_bluetoothDeviceRows",(()=>Promise.resolve([])),o,e,t),d=(e,t,n)=>{const a={type:"bluetooth/subscribe_connection_allocations"};return n&&(a.config_entry_id=n),e.subscribeMessage((e=>t(e)),a)}},57948:function(e,t,n){n.a(e,(async function(e,a){try{n.r(t),n.d(t,{BluetoothAdvertisementMonitorPanel:()=>p});var i=n(61701),s=n(72621),o=(n(71695),n(9359),n(56475),n(1331),n(70104),n(19423),n(92551),n(47021),n(57243)),l=n(50778),d=n(27486),r=n(68958),u=(n(20130),n(23334),n(95975)),c=n(78586),h=n(38419),f=n(28008),v=n(23273),b=e([u,h]);[u,h]=b.then?(await b)():b;let m,y,k,_=e=>e,p=(0,i.Z)([(0,l.Mo)("bluetooth-advertisement-monitor")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"route",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"narrow",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({attribute:"is-wide",type:Boolean})],key:"isWide",value(){return!1}},{kind:"field",decorators:[(0,l.SB)()],key:"_data",value(){return[]}},{kind:"field",decorators:[(0,l.SB)()],key:"_scanners",value(){return{}}},{kind:"field",decorators:[(0,l.SB)()],key:"_sourceDevices",value(){return{}}},{kind:"field",decorators:[(0,r.t)({key:"bluetooth-advertisement-table-grouping",state:!1,subscribe:!1})],key:"_activeGrouping",value(){return"source"}},{kind:"field",decorators:[(0,r.t)({key:"bluetooth-advertisement-table-collapsed",state:!1,subscribe:!1})],key:"_activeCollapsed",value(){return[]}},{kind:"field",key:"_unsub_advertisements",value:void 0},{kind:"field",key:"_unsub_scanners",value:void 0},{kind:"method",key:"connectedCallback",value:function(){if((0,s.Z)(n,"connectedCallback",this,3)([]),this.hass){this._unsub_advertisements=(0,c.PT)(this.hass.connection,(e=>{this._data=e})),this._unsub_scanners=(0,c.ho)(this.hass.connection,(e=>{this._scanners=e}));const e=Object.values(this.hass.devices).filter((e=>e.connections.find((e=>"bluetooth"===e[0]))));this._sourceDevices=Object.fromEntries(e.map((e=>[e.connections.find((e=>"bluetooth"===e[0]))[1],e])))}}},{kind:"method",key:"disconnectedCallback",value:function(){(0,s.Z)(n,"disconnectedCallback",this,3)([]),this._unsub_advertisements&&(this._unsub_advertisements(),this._unsub_advertisements=void 0),this._unsub_scanners&&(this._unsub_scanners(),this._unsub_scanners=void 0)}},{kind:"field",key:"_columns",value(){return(0,d.Z)((e=>({address:{title:e("ui.panel.config.bluetooth.address"),sortable:!0,filterable:!0,showNarrow:!0,main:!0,hideable:!1,moveable:!1,direction:"asc",flex:1},name:{title:e("ui.panel.config.bluetooth.name"),filterable:!0,sortable:!0},device:{title:e("ui.panel.config.bluetooth.device"),filterable:!0,sortable:!0,template:e=>(0,o.dy)(m||(m=_`${0}`),e.device||"-")},source:{title:e("ui.panel.config.bluetooth.source"),filterable:!0,sortable:!0,groupable:!0},source_address:{title:e("ui.panel.config.bluetooth.source_address"),filterable:!0,sortable:!0,defaultHidden:!0},time:{title:e("ui.panel.config.bluetooth.updated"),filterable:!1,sortable:!0,defaultHidden:!1,template:e=>(0,o.dy)(y||(y=_`<ha-relative-time .hass="${0}" .datetime="${0}" capitalize></ha-relative-time>`),this.hass,e.datetime)},rssi:{title:e("ui.panel.config.bluetooth.rssi"),type:"numeric",maxWidth:"60px",sortable:!0}})))}},{kind:"field",key:"_dataWithNamedSourceAndIds",value(){return(0,d.Z)((e=>e.map((e=>{const t=this._sourceDevices[e.address],n=this._sourceDevices[e.source],a=this._scanners[e.source];return Object.assign(Object.assign({},e),{},{id:e.address,source_address:e.source,source:(null==n?void 0:n.name_by_user)||(null==n?void 0:n.name)||(null==a?void 0:a.name)||e.source,device:(null==t?void 0:t.name_by_user)||(null==t?void 0:t.name)||void 0,datetime:new Date(1e3*e.time)})}))))}},{kind:"method",key:"render",value:function(){return(0,o.dy)(k||(k=_` <hass-tabs-subpage-data-table .hass="${0}" .narrow="${0}" .route="${0}" .columns="${0}" .data="${0}" @row-click="${0}" .initialGroupColumn="${0}" .initialCollapsedGroups="${0}" @grouping-changed="${0}" @collapsed-changed="${0}" clickable></hass-tabs-subpage-data-table> `),this.hass,this.narrow,this.route,this._columns(this.hass.localize),this._dataWithNamedSourceAndIds(this._data),this._handleRowClicked,this._activeGrouping,this._activeCollapsed,this._handleGroupingChanged,this._handleCollapseChanged)}},{kind:"method",key:"_handleGroupingChanged",value:function(e){this._activeGrouping=e.detail.value}},{kind:"method",key:"_handleCollapseChanged",value:function(e){this._activeCollapsed=e.detail.value}},{kind:"method",key:"_handleRowClicked",value:function(e){const t=this._data.find((t=>t.address===e.detail.id));(0,v.o)(this,{entry:t})}},{kind:"field",static:!0,key:"styles",value(){return f.Qx}}]}}),o.oi);a()}catch(m){a(m)}}))},23273:function(e,t,n){n.d(t,{o:()=>s});n(71695),n(40251),n(47021);var a=n(36522);const i=()=>n.e("11407").then(n.bind(n,30274)),s=(e,t)=>{(0,a.B)(e,"show-dialog",{dialogTag:"dialog-bluetooth-device-info",dialogImport:i,dialogParams:t})}},16485:function(e,t,n){n.a(e,(async function(e,t){try{n(71695),n(92745),n(40251),n(47021);var a=n(61449),i=n(40574),s=n(30532),o=n(41674),l=n(49722),d=n(76632),r=n(7884),u=n(35185),c=n(65401),h=n(44180),f=n(49447);const e=async()=>{const e=(0,h.sS)(),t=[];(0,s.shouldPolyfill)()&&await Promise.all([n.e("80210"),n.e("74055")]).then(n.bind(n,98133)),(0,l.shouldPolyfill)()&&await Promise.all([n.e("2142"),n.e("75297"),n.e("80210"),n.e("60251")]).then(n.bind(n,59095)),(0,a.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("68250")]).then(n.bind(n,80561)).then((()=>(0,f.H)()))),(0,c.shouldPolyfill)()&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("65578")]).then(n.bind(n,97995))),(0,i.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("59826")]).then(n.bind(n,31514))),(0,o.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("23649")]).then(n.bind(n,93840))),(0,d.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("42831")]).then(n.bind(n,29559))),(0,r.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("57377")]).then(n.bind(n,39030)).then((()=>n.e("61236").then(n.t.bind(n,4121,23))))),(0,u.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("13870")]).then(n.bind(n,74546))),0!==t.length&&await Promise.all(t).then((()=>(0,f.n)(e)))};await e(),t()}catch(v){t(v)}}),1)}}]);
//# sourceMappingURL=62885.702a1086995b49f9.js.map
;(self.