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