UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 3.34 kB
export const __rspack_esm_id=10405;export const __rspack_esm_ids=[10405];export const __webpack_modules__={50816(t,a,e){e.d(a,{I:()=>s});const s="http://192.168.1.234:8123"},40461(t,a,e){e.d(a,{oK:()=>s,tb:()=>i,xV:()=>n});e(50816);const s=(t,a)=>t.sendMessage({type:"connect",refreshToken:a.data.refresh_token,clientId:a.data.clientId,hassUrl:a.data.hassUrl}),i=(t,a,e,s)=>t.sendMessage({type:"show_lovelace_view",viewPath:e,urlPath:s||null,hassUrl:a}),n=(t,a)=>{if(!t.castConnectedToOurHass)return new Promise(e=>{const i=t.addEventListener("connection-changed",()=>{t.castConnectedToOurHass&&(i(),e())});s(t,a)})}},96612(t,a,e){e.a(t,async function(t,s){try{e.r(a);var i=e(62826),n=e(5124),o=e(22441),c=e(6412),r=e(40461),h=e(18350),l=(e(47680),t([h]));h=(l.then?(await l)():l)[0];class d extends n.WF{setConfig(t){this._config={icon:"mdi:television",name:"ioBroker Cast",view:0,...t}}shouldUpdate(t){return!(1===t.size&&t.has("hass"))}render(){if(!this._config)return n.s6;const t=this._castManager&&this._castManager.status&&this._config.view===this._castManager.status.lovelacePath&&this._config.dashboard===this._castManager.status.urlPath;return n.qy` <ha-icon .icon="${this._config.icon}"></ha-icon> <div class="flex"> <div class="name">${this._config.name}</div> ${this._noHTTPS?n.qy` Cast requires HTTPS `:void 0===this._castManager?n.s6:null===this._castManager?n.qy` Cast API unavailable `:"NO_DEVICES_AVAILABLE"===this._castManager.castState?n.qy` No devices found `:n.qy` <div class="controls"> <google-cast-launcher></google-cast-launcher> <ha-button @click="${this._sendLovelace}" class="${(0,c.H)({inactive:!t})}" appearance="plain" size="small" .disabled="${!this._castManager.status}"> SHOW </ha-button> </div> `} </div> `}firstUpdated(t){super.firstUpdated(t),"http:"===location.protocol&&"localhost"!==location.hostname&&(this._noHTTPS=!0),e.e(20947).then(e.bind(e,41278)).then(({getCastManager:t})=>t(this.hass.auth).then(t=>{this._castManager=t,t.addEventListener("connection-changed",()=>{this.requestUpdate()}),t.addEventListener("state-changed",()=>{this.requestUpdate()})},()=>{this._castManager=null}))}updated(t){super.updated(t),this._config&&this._config.hide_if_unavailable&&(this.style.display=this._castManager&&"NO_DEVICES_AVAILABLE"!==this._castManager.castState?"":"none")}async _sendLovelace(){await(0,r.xV)(this._castManager,this.hass.auth),(0,r.tb)(this._castManager,this.hass.auth.data.hassUrl,this._config.view,this._config.dashboard)}constructor(...t){super(...t),this._noHTTPS=!1}}d.styles=n.AH`:host{display:flex;align-items:center}ha-icon{padding:8px;color:var(--state-icon-color)}.flex{flex:1;margin-left:16px;margin-inline-start:16px;margin-inline-end:initial;display:flex;justify-content:space-between;align-items:center}.name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.controls{display:flex;align-items:center}google-cast-launcher{margin-right:.57em;margin-inline-end:-.57em;margin-inline-start:initial;cursor:pointer;display:inline-block;height:24px;width:24px}.inactive{padding:0 4px}`,(0,i.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,i.Cg)([(0,o.wk)()],d.prototype,"_config",void 0),(0,i.Cg)([(0,o.wk)()],d.prototype,"_castManager",void 0),(0,i.Cg)([(0,o.wk)()],d.prototype,"_noHTTPS",void 0),d=(0,i.Cg)([(0,o.EM)("hui-cast-row")],d),s()}catch(t){s(t)}})}};