iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
11 lines • 18.2 kB
JavaScript
webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["22144"],{19631:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{Bt:()=>d,T8:()=>c});n(19083);var a=n(16485),o=n(88977),s=n(20382),r=e([a]);a=(r.then?(await r)():r)[0];const l=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],d=e=>e.first_weekday===s.FS.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(e.language).weekInfo.firstDay%7:(0,o.L)(e.language)%7:l.includes(e.first_weekday)?l.indexOf(e.first_weekday):1,c=e=>{const t=d(e);return l[t]};i()}catch(l){i(l)}}))},94947:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{G:()=>d});var a=n(16485),o=n(27486),s=n(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,n,i=!0)=>{const a=(0,s.W)(e,n,t);return i?l(t).format(a.value,a.unit):Intl.NumberFormat(t.language,{style:"unit",unit:a.unit,unitDisplay:"long"}).format(Math.abs(a.value))};i()}catch(l){i(l)}}))},87733:function(e,t,n){n.d(t,{f:()=>i});const i=e=>e.charAt(0).toUpperCase()+e.slice(1)},27046:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{W:()=>v});n(19423);var a=n(13809),o=n(29558),s=n(94763),r=n(19631),l=e([r]);r=(l.then?(await l)():l)[0];const c=1e3,u=60,h=60*u;function v(e,t=Date.now(),n,i={}){const l=Object.assign(Object.assign({},f),i||{}),d=(+e-+t)/c;if(Math.abs(d)<l.second)return{value:Math.round(d),unit:"second"};const v=d/u;if(Math.abs(v)<l.minute)return{value:Math.round(v),unit:"minute"};const y=d/h;if(Math.abs(y)<l.hour)return{value:Math.round(y),unit:"hour"};const b=new Date(e),p=new Date(t);b.setHours(0,0,0,0),p.setHours(0,0,0,0);const m=(0,a.j)(b,p);if(0===m)return{value:Math.round(y),unit:"hour"};if(Math.abs(m)<l.day)return{value:m,unit:"day"};const k=(0,r.Bt)(n),g=(0,o.z)(b,{weekStartsOn:k}),_=(0,o.z)(p,{weekStartsOn:k}),w=(0,s.p)(g,_);if(0===w)return{value:m,unit:"day"};if(Math.abs(w)<l.week)return{value:w,unit:"week"};const x=b.getFullYear()-p.getFullYear(),C=12*x+b.getMonth()-p.getMonth();return 0===C?{value:w,unit:"week"}:Math.abs(C)<l.month||0===x?{value:C,unit:"month"}:{value:Math.round(x),unit:"year"}}const f={second:45,minute:45,hour:22,day:5,week:4,month:11};i()}catch(d){i(d)}}))},28310:function(e,t,n){var i=n(61701),a=(n(71695),n(47021),n(57243)),o=n(50778),s=n(10916);let r,l,d=e=>e;(0,i.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(){return 0}},{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"max",value(){return 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(0,a.YP)(r||(r=d` <svg> <g> <rect/> <rect width="${0}%"/> </g> </svg> `),e)}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(l||(l=d`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,n){var i=n(61701),a=n(72621),o=(n(71695),n(47021),n(39785)),s=n(52876),r=n(50778),l=n(57243),d=n(5111);let c,u,h,v=e=>e;(0,i.Z)([(0,r.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,a.Z)(n,"firstUpdated",this,3)([e]),this.style.setProperty("--mdc-theme-secondary","var(--primary-color)")}},{kind:"field",static:!0,key:"styles",value(){return[s.W,(0,l.iv)(c||(c=v`: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?(0,l.iv)(u||(u=v`:host .mdc-fab--extended .mdc-fab__icon{direction:rtl}`)):(0,l.iv)(h||(h=v``))]}}]}}),o._)},89370:function(e,t,n){var i=n(61701),a=(n(71695),n(47021),n(57243)),o=n(50778),s=n(35359),r=n(10916);n(28310),n(30509);let l,d,c=e=>e;(0,i.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(){var e;const t=(0,r.IU)(this.value);return(0,a.dy)(l||(l=c` <ha-settings-row> <span slot="heading"> ${0} </span> <div slot="description" .title="${0}"> <span class="value"> <div>${0} %</div> </span> <ha-bar class="${0}" .value="${0}"></ha-bar> </div> </ha-settings-row> `),this.heading,null!==(e=this.tooltip)&&void 0!==e?e:"",t,(0,s.$)({"target-warning":t>50,"target-critical":t>85}),this.value)}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(d||(d=c`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,n){n.a(e,(async function(e,t){try{var i=n(61701),a=n(72621),o=(n(71695),n(47021),n(74760)),s=n(57243),r=n(50778),l=n(94947),d=n(87733),c=e([l]);l=(c.then?(await c)():c)[0];(0,i.Z)([(0,r.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,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(){return!1}},{kind:"field",key:"_interval",value:void 0},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(n,"disconnectedCallback",this,3)([]),this._clearInterval()}},{kind:"method",key:"connectedCallback",value:function(){(0,a.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,a.Z)(n,"firstUpdated",this,3)([e]),this._updateRelative()}},{kind:"method",key:"update",value:function(e){(0,a.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,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(u){t(u)}}))},30509:function(e,t,n){var i=n(61701),a=(n(71695),n(47021),n(57243)),o=n(50778);let s,r,l=e=>e;(0,i.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(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,reflect:!0})],key:"slim",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"three-line"})],key:"threeLine",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"wrap-heading",reflect:!0})],key:"wrapHeading",value(){return!1}},{kind:"method",key:"render",value:function(){return(0,a.dy)(s||(s=l` <div class="prefix-wrap"> <slot name="prefix"></slot> <div class="body" ?two-line="${0}" ?three-line="${0}"> <slot name="heading"></slot> <div class="secondary"><slot name="description"></slot></div> </div> </div> <div class="content"><slot></slot></div> `),!this.threeLine,this.threeLine)}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(r||(r=l`: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,n){n.d(t,{JG:()=>l,PT:()=>r,ho:()=>o});n(71695),n(92745),n(19423),n(40251),n(47021);var i=n(62212);const a=(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"}),o=(e,t)=>(0,i.B)("_bluetoothScannerDetails",(()=>Promise.resolve({})),a,e,t),s=(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"}),r=(e,t)=>(0,i.B)("_bluetoothDeviceRows",(()=>Promise.resolve([])),s,e,t),l=(e,t,n)=>{const i={type:"bluetooth/subscribe_connection_allocations"};return n&&(i.config_entry_id=n),e.subscribeMessage((e=>t(e)),i)}},53653:function(e,t,n){n.a(e,(async function(e,i){try{n.r(t),n.d(t,{BluetoothConnectionMonitorPanel:()=>m});var a=n(61701),o=n(72621),s=(n(71695),n(92745),n(9359),n(56475),n(1331),n(70104),n(19423),n(92551),n(40251),n(47021),n(57243)),r=n(50778),l=n(27486),d=n(68958),c=(n(20130),n(23334),n(95975)),u=n(78586),h=n(38419),v=n(28008),f=(n(89370),e([c,h]));[c,h]=f.then?(await f)():f;let y,b,p=e=>e,m=(0,a.Z)([(0,r.Mo)("bluetooth-connection-monitor")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,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(){return!1}},{kind:"field",decorators:[(0,r.Cb)({attribute:"is-wide",type:Boolean})],key:"isWide",value(){return!1}},{kind:"field",decorators:[(0,r.SB)()],key:"_data",value(){return[]}},{kind:"field",decorators:[(0,r.SB)()],key:"_scanners",value(){return{}}},{kind:"field",decorators:[(0,r.SB)()],key:"_addressNames",value(){return{}}},{kind:"field",decorators:[(0,r.SB)()],key:"_sourceDevices",value(){return{}}},{kind:"field",decorators:[(0,d.t)({key:"bluetooth-connection-table-grouping",state:!1,subscribe:!1})],key:"_activeGrouping",value(){return"source"}},{kind:"field",decorators:[(0,d.t)({key:"bluetooth-connection-table-collapsed",state:!1,subscribe:!1})],key:"_activeCollapsed",value(){return[]}},{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(){return{}}},{kind:"method",key:"connectedCallback",value:function(){if((0,o.Z)(n,"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 n of e)this._connectionAllocationData[n.source]=n;const t=[];for(const n of Object.values(this._connectionAllocationData))for(const e of n.allocated)t.push({address:e,source:n.source});this._data=t})))}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(n,"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(){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=>(0,s.dy)(y||(y=p`${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}})))}},{kind:"field",key:"_dataWithNamedSourceAndIds",value(){return(0,l.Z)((e=>e.map((e=>{const t=this._sourceDevices[e.address],n=this._sourceDevices[e.source],i=this._scanners[e.source],a=this._addressNames[e.address]||e.address;return Object.assign(Object.assign({},e),{},{id:e.address,name:a,source_address:e.source,source:(null==n?void 0:n.name_by_user)||(null==n?void 0:n.name)||(null==i?void 0:i.name)||e.source,device:(null==t?void 0:t.name_by_user)||(null==t?void 0:t.name)||void 0})}))))}},{kind:"method",key:"render",value:function(){return(0,s.dy)(b||(b=p` <hass-tabs-subpage-data-table .hass="${0}" .narrow="${0}" .route="${0}" .columns="${0}" .data="${0}" .initialGroupColumn="${0}" .initialCollapsedGroups="${0}" .noDataText="${0}" @grouping-changed="${0}" @collapsed-changed="${0}"></hass-tabs-subpage-data-table> `),this.hass,this.narrow,this.route,this._columns(this.hass.localize),this._dataWithNamedSourceAndIds(this._data),this._activeGrouping,this._activeCollapsed,this.hass.localize("ui.panel.config.bluetooth.no_connections"),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:"field",static:!0,key:"styles",value(){return v.Qx}}]}}),s.oi);i()}catch(y){i(y)}}))},16485:function(e,t,n){n.a(e,(async function(e,t){try{n(71695),n(92745),n(40251),n(47021);var i=n(61449),a=n(40574),o=n(30532),s=n(41674),r=n(49722),l=n(76632),d=n(7884),c=n(35185),u=n(65401),h=n(44180),v=n(49447);const e=async()=>{const e=(0,h.sS)(),t=[];(0,o.shouldPolyfill)()&&await Promise.all([n.e("80210"),n.e("74055")]).then(n.bind(n,98133)),(0,r.shouldPolyfill)()&&await Promise.all([n.e("2142"),n.e("75297"),n.e("80210"),n.e("60251")]).then(n.bind(n,59095)),(0,i.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("68250")]).then(n.bind(n,80561)).then((()=>(0,v.H)()))),(0,u.shouldPolyfill)()&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("65578")]).then(n.bind(n,97995))),(0,a.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("59826")]).then(n.bind(n,31514))),(0,s.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("23649")]).then(n.bind(n,93840))),(0,l.shouldPolyfill)(e)&&t.push(Promise.all([n.e("2142"),n.e("75297"),n.e("42831")]).then(n.bind(n,29559))),(0,d.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,c.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,v.n)(e)))};await e(),t()}catch(f){t(f)}}),1)},10916:function(e,t,n){n.d(t,{Ff:()=>a,Fv:()=>i,IU:()=>o});const i=(e,t,n)=>isNaN(e)||isNaN(t)||isNaN(n)?0:e>n?n:e<t?t:e,a=(e,t,n)=>100*(e-t)/(n-t),o=e=>Math.round(10*e)/10}}]);
//# sourceMappingURL=22144.3a16c72f501d3e56.js.map
;(self.