iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
11 lines • 17.2 kB
JavaScript
export const __webpack_ids__=["22144"];export const __webpack_modules__={19631:function(e,t,i){i.d(t,{Bt:()=>s,T8:()=>r});var n=i(88977),a=i(20382);const o=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],s=e=>e.first_weekday===a.FS.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(e.language).weekInfo.firstDay%7:(0,n.L)(e.language)%7:o.includes(e.first_weekday)?o.indexOf(e.first_weekday):1,r=e=>{const t=s(e);return o[t]}},94947:function(e,t,i){i.a(e,(async function(e,n){try{i.d(t,{G:()=>d});var a=i(16485),o=i(27486),s=i(27046),r=e([a,s]);[a,s]=r.then?(await r)():r;const l=(0,o.Z)((e=>new Intl.RelativeTimeFormat(e.language,{numeric:"auto"}))),d=(e,t,i,n=!0)=>{const a=(0,s.W)(e,i,t);return n?l(t).format(a.value,a.unit):Intl.NumberFormat(t.language,{style:"unit",unit:a.unit,unitDisplay:"long"}).format(Math.abs(a.value))};n()}catch(e){n(e)}}))},87733:function(e,t,i){i.d(t,{f:()=>n});const n=e=>e.charAt(0).toUpperCase()+e.slice(1)},27046:function(e,t,i){i.a(e,(async function(e,n){try{i.d(t,{W:()=>u});var a=i(13809),o=i(29558),s=i(94763),r=i(19631);const l=1e3,d=60,c=60*d;function u(e,t=Date.now(),i,n={}){const u={...h,...n||{}},v=(+e-+t)/l;if(Math.abs(v)<u.second)return{value:Math.round(v),unit:"second"};const f=v/d;if(Math.abs(f)<u.minute)return{value:Math.round(f),unit:"minute"};const p=v/c;if(Math.abs(p)<u.hour)return{value:Math.round(p),unit:"hour"};const y=new Date(e),b=new Date(t);y.setHours(0,0,0,0),b.setHours(0,0,0,0);const m=(0,a.j)(y,b);if(0===m)return{value:Math.round(p),unit:"hour"};if(Math.abs(m)<u.day)return{value:m,unit:"day"};const k=(0,r.Bt)(i),g=(0,o.z)(y,{weekStartsOn:k}),_=(0,o.z)(b,{weekStartsOn:k}),w=(0,s.p)(g,_);if(0===w)return{value:m,unit:"day"};if(Math.abs(w)<u.week)return{value:w,unit:"week"};const x=y.getFullYear()-b.getFullYear(),C=12*x+y.getMonth()-b.getMonth();return 0===C?{value:w,unit:"week"}:Math.abs(C)<u.month||0===x?{value:C,unit:"month"}:{value:Math.round(x),unit:"year"}}const h={second:45,minute:45,hour:22,day:5,week:4,month:11};n()}catch(v){n(v)}}))},28310:function(e,t,i){var n=i(44249),a=i(57243),o=i(15093),s=i(10916);(0,n.Z)([(0,o.Mo)("ha-bar")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"min",value:()=>0},{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"max",value:()=>100},{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"value",value:void 0},{kind:"method",key:"render",value:function(){const e=(0,s.IU)((0,s.Ff)((0,s.Fv)(this.value,this.min,this.max),this.min,this.max));return a.YP` <svg> <g> <rect/> <rect width="${e}%"/> </g> </svg> `}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`rect{height:100%}rect:first-child{width:100%;fill:var(--ha-bar-background-color,var(--secondary-background-color))}rect:last-child{fill:var(--ha-bar-primary-color,var(--primary-color))}svg{border-radius:var(--ha-bar-border-radius,4px);height:12px;width:100%}`}]}}),a.oi)},20130:function(e,t,i){var n=i(44249),a=i(72621),o=i(39785),s=i(52876),r=i(15093),l=i(57243),d=i(5111);(0,n.Z)([(0,r.Mo)("ha-fab")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"method",key:"firstUpdated",value:function(e){(0,a.Z)(i,"firstUpdated",this,3)([e]),this.style.setProperty("--mdc-theme-secondary","var(--primary-color)")}},{kind:"field",static:!0,key:"styles",value:()=>[s.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"===d.E.document.dir?l.iv`:host .mdc-fab--extended .mdc-fab__icon{direction:rtl}`:l.iv``]}]}}),o._)},89370:function(e,t,i){var n=i(44249),a=i(57243),o=i(15093),s=i(35359),r=i(10916);i(28310),i(30509);(0,n.Z)([(0,o.Mo)("ha-metric")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"value",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:String})],key:"heading",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:String})],key:"tooltip",value:void 0},{kind:"method",key:"render",value:function(){const e=(0,r.IU)(this.value);return a.dy` <ha-settings-row> <span slot="heading"> ${this.heading} </span> <div slot="description" .title="${this.tooltip??""}"> <span class="value"> <div>${e} %</div> </span> <ha-bar class="${(0,s.$)({"target-warning":e>50,"target-critical":e>85})}" .value="${this.value}"></ha-bar> </div> </ha-settings-row> `}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`ha-settings-row{padding:0;height:54px;width:100%}ha-settings-row>div[slot=description]{white-space:normal;color:var(--secondary-text-color);display:flex;justify-content:space-between}ha-bar{--ha-bar-primary-color:var(--metric-bar-ok-color, var(--success-color))}.target-warning{--ha-bar-primary-color:var(
--metric-bar-warning-color,
var(--warning-color)
)}.target-critical{--ha-bar-primary-color:var(
--metric-bar-critical-color,
var(--error-color)
)}.value{width:48px;padding-right:4px;padding-inline-end:4px;padding-inline-start:initial;flex-shrink:0}.value>div{direction:ltr;text-align:var(--float-start)}`}]}}),a.oi)},95975:function(e,t,i){i.a(e,(async function(e,t){try{var n=i(44249),a=i(72621),o=i(74760),s=i(57243),r=i(15093),l=i(94947),d=i(87733),c=e([l]);l=(c.then?(await c)():c)[0];(0,n.Z)([(0,r.Mo)("ha-relative-time")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"datetime",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"capitalize",value:()=>!1},{kind:"field",key:"_interval",value:void 0},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(i,"disconnectedCallback",this,3)([]),this._clearInterval()}},{kind:"method",key:"connectedCallback",value:function(){(0,a.Z)(i,"connectedCallback",this,3)([]),this.datetime&&this._startInterval()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"firstUpdated",value:function(e){(0,a.Z)(i,"firstUpdated",this,3)([e]),this._updateRelative()}},{kind:"method",key:"update",value:function(e){(0,a.Z)(i,"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,o.D)(this.datetime):this.datetime,t=(0,l.G)(e,this.hass.locale);this.innerHTML=this.capitalize?(0,d.f)(t):t}else this.innerHTML=this.hass.localize("ui.components.relative_time.never")}}]}}),s.fl);t()}catch(e){t(e)}}))},30509:function(e,t,i){var n=i(44249),a=i(57243),o=i(15093);(0,n.Z)([(0,o.Mo)("ha-settings-row")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,reflect:!0})],key:"slim",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"three-line"})],key:"threeLine",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"wrap-heading",reflect:!0})],key:"wrapHeading",value:()=>!1},{kind:"method",key:"render",value:function(){return a.dy` <div class="prefix-wrap"> <slot name="prefix"></slot> <div class="body" ?two-line="${!this.threeLine}" ?three-line="${this.threeLine}"> <slot name="heading"></slot> <div class="secondary"><slot name="description"></slot></div> </div> </div> <div class="content"><slot></slot></div> `}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`:host{display:flex;padding:0 16px;align-content:normal;align-self:auto;align-items:center}.body{padding-top:8px;padding-bottom:8px;padding-left:0;padding-inline-start:0;padding-right:16px;padding-inline-end:16px;overflow:hidden;display:var(--layout-vertical_-_display,flex);flex-direction:var(--layout-vertical_-_flex-direction,column);justify-content:var(--layout-center-justified_-_justify-content,center);flex:var(--layout-flex_-_flex,1);flex-basis:var(--layout-flex_-_flex-basis,0.000000001px)}.body[three-line]{min-height:var(--paper-item-body-three-line-min-height,88px)}:host(:not([wrap-heading])) body>*{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.body>.secondary{display:block;padding-top:4px;font-family:var(
--mdc-typography-body2-font-family,
var(--mdc-typography-font-family, Roboto, sans-serif)
);-webkit-font-smoothing:antialiased;font-size:var(--mdc-typography-body2-font-size, .875rem);font-weight:var(--mdc-typography-body2-font-weight,400);line-height:normal;color:var(--secondary-text-color)}.body[two-line]{min-height:calc(var(--paper-item-body-two-line-min-height,72px) - 16px);flex:1}.content{display:contents}:host(:not([narrow])) .content{display:var(--settings-row-content-display,flex);justify-content:flex-end;flex:1;padding:16px 0}.content ::slotted(*){width:var(--settings-row-content-width)}:host([narrow]){align-items:normal;flex-direction:column;border-top:1px solid var(--divider-color);padding-bottom:8px}::slotted(ha-switch){padding:16px 0}.secondary{white-space:normal}.prefix-wrap{display:var(--settings-row-prefix-display)}:host([narrow]) .prefix-wrap{display:flex;align-items:center}:host([slim]),:host([slim]) .content,:host([slim]) ::slotted(ha-switch){padding:0}:host([slim]) .body{min-height:0}`}]}}),a.oi)},78586:function(e,t,i){i.d(t,{JG:()=>l,PT:()=>r,ho:()=>o});i(92745);var n=i(62212);const a=(e,t)=>e.subscribeMessage((e=>{const i={...t.state||{}};if(e.add)for(const t of e.add)i[t.source]=t;if(e.remove)for(const t of e.remove)delete i[t.source];t.setState(i,!0)}),{type:"bluetooth/subscribe_scanner_details"}),o=(e,t)=>(0,n.B)("_bluetoothScannerDetails",(()=>Promise.resolve({})),a,e,t),s=(e,t)=>e.subscribeMessage((e=>{const i=[...t.state||[]];if(e.add)for(const t of e.add){const e=i.findIndex((e=>e.address===t.address));-1===e?i.push(t):i[e]=t}if(e.change)for(const t of e.change){const e=i.findIndex((e=>e.address===t.address));-1!==e&&(i[e]=t)}if(e.remove)for(const t of e.remove){const e=i.findIndex((e=>e.address===t.address));-1!==e&&i.splice(e,1)}t.setState(i,!0)}),{type:"bluetooth/subscribe_advertisements"}),r=(e,t)=>(0,n.B)("_bluetoothDeviceRows",(()=>Promise.resolve([])),s,e,t),l=(e,t,i)=>{const n={type:"bluetooth/subscribe_connection_allocations"};return i&&(n.config_entry_id=i),e.subscribeMessage((e=>t(e)),n)}},53653:function(e,t,i){i.a(e,(async function(e,n){try{i.r(t),i.d(t,{BluetoothConnectionMonitorPanel:()=>f});var a=i(44249),o=i(72621),s=(i(92745),i(9359),i(56475),i(1331),i(70104),i(57243)),r=i(15093),l=i(27486),d=i(68958),c=(i(20130),i(23334),i(95975)),u=i(78586),h=(i(38419),i(28008)),v=(i(89370),e([c]));c=(v.then?(await v)():v)[0];let f=(0,a.Z)([(0,r.Mo)("bluetooth-connection-monitor")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"route",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({attribute:"is-wide",type:Boolean})],key:"isWide",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_data",value:()=>[]},{kind:"field",decorators:[(0,r.SB)()],key:"_scanners",value:()=>({})},{kind:"field",decorators:[(0,r.SB)()],key:"_addressNames",value:()=>({})},{kind:"field",decorators:[(0,r.SB)()],key:"_sourceDevices",value:()=>({})},{kind:"field",decorators:[(0,d.t)({key:"bluetooth-connection-table-grouping",state:!1,subscribe:!1})],key:"_activeGrouping",value:()=>"source"},{kind:"field",decorators:[(0,d.t)({key:"bluetooth-connection-table-collapsed",state:!1,subscribe:!1})],key:"_activeCollapsed",value:()=>[]},{kind:"field",key:"_unsubConnectionAllocations",value:void 0},{kind:"field",key:"_unsubScanners",value:void 0},{kind:"field",key:"_unsub_advertisements",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_connectionAllocationData",value:()=>({})},{kind:"method",key:"connectedCallback",value:function(){if((0,o.Z)(i,"connectedCallback",this,3)([]),this.hass){this._unsubScanners=(0,u.ho)(this.hass.connection,(e=>{this._scanners=e})),this._unsub_advertisements=(0,u.PT)(this.hass.connection,(e=>{for(const t of e)this._addressNames[t.address]=t.name}));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]))),this._subscribeBluetoothConnectionAllocations()}}},{kind:"method",key:"_subscribeBluetoothConnectionAllocations",value:async function(){this._unsubConnectionAllocations||(this._unsubConnectionAllocations=await(0,u.JG)(this.hass.connection,(e=>{for(const t of e)this._connectionAllocationData[t.source]=t;const t=[];for(const e of Object.values(this._connectionAllocationData))for(const i of e.allocated)t.push({address:i,source:e.source});this._data=t})))}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(i,"disconnectedCallback",this,3)([]),this._unsub_advertisements&&(this._unsub_advertisements(),this._unsub_advertisements=void 0),this._unsubConnectionAllocations&&(this._unsubConnectionAllocations(),this._unsubConnectionAllocations=void 0),this._unsubScanners&&(this._unsubScanners(),this._unsubScanners=void 0)}},{kind:"field",key:"_columns",value:()=>(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=>s.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}})))},{kind:"field",key:"_dataWithNamedSourceAndIds",value(){return(0,l.Z)((e=>e.map((e=>{const t=this._sourceDevices[e.address],i=this._sourceDevices[e.source],n=this._scanners[e.source],a=this._addressNames[e.address]||e.address;return{...e,id:e.address,name:a,source_address:e.source,source:i?.name_by_user||i?.name||n?.name||e.source,device:t?.name_by_user||t?.name||void 0}}))))}},{kind:"method",key:"render",value:function(){return s.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)}" .initialGroupColumn="${this._activeGrouping}" .initialCollapsedGroups="${this._activeCollapsed}" .noDataText="${this.hass.localize("ui.panel.config.bluetooth.no_connections")}" @grouping-changed="${this._handleGroupingChanged}" @collapsed-changed="${this._handleCollapseChanged}"></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:"field",static:!0,key:"styles",value:()=>h.Qx}]}}),s.oi);n()}catch(e){n(e)}}))},16485:function(e,t,i){i.a(e,(async function(e,t){try{i(92745);var n=i(61449),a=i(40574),o=i(30532),s=i(41674),r=i(49722),l=i(76632),d=i(7884),c=i(35185),u=i(60933),h=i(44180),v=i(49447);const e=async()=>{const e=(0,h.sS)(),t=[];(0,o.shouldPolyfill)()&&await Promise.all([i.e("80210"),i.e("74055")]).then(i.bind(i,98133)),(0,r.shouldPolyfill)()&&await Promise.all([i.e("83895"),i.e("75297"),i.e("80210"),i.e("60251")]).then(i.bind(i,59095)),(0,n.shouldPolyfill)(e)&&t.push(Promise.all([i.e("83895"),i.e("75297"),i.e("68250")]).then(i.bind(i,80561)).then((()=>(0,v.H)()))),(0,u.shouldPolyfill)()&&t.push(Promise.all([i.e("83895"),i.e("75297"),i.e("65578")]).then(i.bind(i,97995))),(0,a.shouldPolyfill)(e)&&t.push(Promise.all([i.e("83895"),i.e("75297"),i.e("59826")]).then(i.bind(i,31514))),(0,s.shouldPolyfill)(e)&&t.push(Promise.all([i.e("83895"),i.e("75297"),i.e("23649")]).then(i.bind(i,93840))),(0,l.shouldPolyfill)(e)&&t.push(Promise.all([i.e("83895"),i.e("75297"),i.e("42831")]).then(i.bind(i,29559))),(0,d.shouldPolyfill)(e)&&t.push(Promise.all([i.e("83895"),i.e("75297"),i.e("57377")]).then(i.bind(i,39030)).then((()=>i.e("61236").then(i.t.bind(i,4121,23))))),(0,c.shouldPolyfill)(e)&&t.push(Promise.all([i.e("83895"),i.e("75297"),i.e("13870")]).then(i.bind(i,74546))),0!==t.length&&await Promise.all(t).then((()=>(0,v.n)(e)))};await e(),t()}catch(e){t(e)}}),1)},10916:function(e,t,i){i.d(t,{Ff:()=>a,Fv:()=>n,IU:()=>o});const n=(e,t,i)=>isNaN(e)||isNaN(t)||isNaN(i)?0:e>i?i:e<t?t:e,a=(e,t,i)=>100*(e-t)/(i-t),o=e=>Math.round(10*e)/10}};
//# sourceMappingURL=22144.9b86b275cd5670fe.js.map