iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 6 kB
JavaScript
export const __rspack_esm_id=64522;export const __rspack_esm_ids=[64522];export const __webpack_modules__={26571(i,e,s){s.d(e,{Al:()=>n,KY:()=>o,PN:()=>a,dG:()=>l,jm:()=>d,m7:()=>p,sR:()=>h,t1:()=>r,t2:()=>u,x:()=>g,yu:()=>_});var t=s(95350);const o=["bluetooth","dhcp","discovery","esphome","hardware","hassio","homekit","integration_discovery","mqtt","ssdp","unignore","usb","zeroconf"],n=66649!=s.j?["reauth"]:null,c={"HA-Frontend-Base":`${location.protocol}//${location.host}`},r=(i,e,s)=>i.callApi("POST","config/config_entries/flow",{handler:e,entry_id:s},c),a=(i,e)=>i.callApi("GET",`config/config_entries/flow/${e}`,void 0,c),d=(i,e,s)=>i.callApi("POST",`config/config_entries/flow/${e}`,s,c),l=(i,e,s)=>i.callWS({type:"config_entries/ignore_flow",flow_id:e,title:s}),h=(i,e)=>i.callApi("DELETE",`config/config_entries/flow/${e}`),_=(i,e)=>i.callApi("GET","config/config_entries/flow_handlers"+(e?`?type=${e}`:"")),u=i=>i.sendMessagePromise({type:"config_entries/flow/progress"}),g=(i,e)=>i.connection.subscribeMessage(i=>e(i),{type:"config_entries/flow/subscribe"}),p=(i,e)=>e.context.title_placeholders&&0!==Object.keys(e.context.title_placeholders).length?i(`component.${e.handler}.config.flow_title`,e.context.title_placeholders)||("name"in e.context.title_placeholders?e.context.title_placeholders.name:(0,t.p$)(i,e.handler)):(0,t.p$)(i,e.handler)},54706(i,e,s){s.d(e,{E:()=>n});s(74423),s(18111),s(13579);var t=s(62826),o=s(22441);const n=i=>{class e extends i{connectedCallback(){super.connectedCallback(),this._checkSubscribed()}disconnectedCallback(){if(super.disconnectedCallback(),this.__unsubs){for(;this.__unsubs.length;){const i=this.__unsubs.pop();i instanceof Promise?i.then(i=>i()):i()}this.__unsubs=void 0}}updated(i){if(super.updated(i),i.has("hass"))this._checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const e of i.keys())if(this.hassSubscribeRequiredHostProps.includes(e))return void this._checkSubscribed()}hassSubscribe(){return[]}_checkSubscribed(){void 0===this.__unsubs&&this.isConnected&&void 0!==this.hass&&!this.hassSubscribeRequiredHostProps?.some(i=>void 0===this[i])&&(this.__unsubs=this.hassSubscribe())}}return(0,t.Cg)([(0,o.MZ)({attribute:!1})],e.prototype,"hass",void 0),e}},76559(i,e,s){s.d(e,{X:()=>o,n:()=>n});var t=s(1087);const o=(i,e)=>{(0,t.r)(i,"show-dialog",{dialogTag:"dialog-add-integration",dialogImport:()=>Promise.all([s.e(92769),s.e(50672)]).then(s.bind(s,60051)),dialogParams:e})},n=(i,e)=>{(0,t.r)(i,"show-dialog",{dialogTag:"dialog-yaml-integration",dialogImport:()=>s.e(24096).then(s.bind(s,95683)),dialogParams:e})}},38865(i,e,s){s.r(e),s.d(e,{HuiDiscoveredDevicesCard:()=>u});s(74423),s(44114),s(18111),s(22489),s(7588);var t=s(62826),o=s(5124),n=s(22441),c=s(1087),r=(s(76776),s(22573),s(80933),s(32248),s(26571)),a=s(54706),d=s(76559),l=s(22064),h=s(97176),_=s(51989);class u extends((0,a.E)(o.WF)){hassSubscribe(){return this.hass.user?.is_admin?[(0,r.x)(this.hass,i=>{if(0===i.length)return void(this._discoveredFlows=[]);let e=!1;const s=[];if(i.forEach(i=>{if("removed"===i.type){const e=Array.isArray(this._discoveredFlows)?this._discoveredFlows:[];return void(this._discoveredFlows=e.filter(e=>e.flow_id!==i.flow_id))}null!==i.type&&"added"!==i.type||(null===i.type&&(e=!0),r.KY.includes(i.flow.context.source)&&s.push(i.flow))}),!s.length&&!e)return;const t=e||!Array.isArray(this._discoveredFlows)?[]:this._discoveredFlows;this._discoveredFlows=[...t,...s]})]:(this._discoveredFlows=[],[])}setConfig(i){this._config=i}getCardSize(){return this._config?.vertical?2:1}getGridOptions(){let i=6,e=1;return this._config?.vertical&&(e++,i=3),{columns:6,rows:e,min_columns:i,min_rows:e}}async _handleAction(i){if("tap"===i.detail.action&&!(0,h.h)(this._config?.tap_action))return await this.hass.loadFragmentTranslation("config"),void(0,d.X)(this,{brand:"_discovered"});(0,l.$)(this,this.hass,this._config,i.detail.action)}get _hasCardAction(){return!this._config?.tap_action||(0,h.h)(this._config?.tap_action)||(0,h.h)(this._config?.hold_action)||(0,h.h)(this._config?.double_tap_action)}willUpdate(i){if(super.willUpdate(i),!this._config||!this.hass)return;const e=Boolean(!this.hass.user?.is_admin||this._config.hide_empty&&this._discoveredFlows&&0===this._discoveredFlows.length);e!==this.hidden&&(this.style.display=e?"none":"",this.toggleAttribute("hidden",e),(0,c.r)(this,"card-visibility-changed",{value:!e}))}render(){if(!this._config||!this.hass||this.hidden)return o.s6;const i=Array.isArray(this._discoveredFlows)?this._discoveredFlows.length:0,e=this.hass.localize("ui.card.discovered-devices.title"),s=i>0?this.hass.localize("ui.card.discovered-devices.count_devices",{count:i}):this.hass.localize("ui.card.discovered-devices.no_devices"),t=!this._discoveredFlows;return o.qy` <ha-card> <ha-tile-container .vertical="${Boolean(this._config.vertical)}" .interactive="${this._hasCardAction}" .actionHandlerOptions="${{hasHold:(0,h.h)(this._config.hold_action),hasDoubleClick:(0,h.h)(this._config.double_tap_action)}}" @action="${this._handleAction}"> <ha-tile-icon slot="icon" .iconPath="${"M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z"}"></ha-tile-icon> <ha-tile-info slot="info" .primary="${e}" .secondary="${s}" .secondaryLoading="${t}"></ha-tile-info> </ha-tile-container> </ha-card> `}constructor(...i){super(...i),this.connectedWhileHidden=!0}}u.styles=[_.c,o.AH`:host{--tile-color:var(--info-color)}`],(0,t.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,t.Cg)([(0,n.wk)()],u.prototype,"_config",void 0),(0,t.Cg)([(0,n.wk)()],u.prototype,"_discoveredFlows",void 0),u=(0,t.Cg)([(0,n.EM)("hui-discovered-devices-card")],u)}};