iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 3.89 kB
JavaScript
export const __webpack_ids__=["45006"];export const __webpack_modules__={96137:function(t,e,a){a.d(e,{$Q:()=>s,Hq:()=>i,py:()=>o});var n=a(26833);const i=!1,s=i?n.N:"A078F6B0",o="urn:x-cast:com.nabucasa.hast"},26833:function(t,e,a){a.d(e,{M:()=>i,N:()=>n});const n="5FE44367",i="http://192.168.1.234:8123"},17439:function(t,e,a){a.d(e,{Il:()=>o,Ni:()=>s,W_:()=>c});var n=a(96137),i=a(26833);const s=(t,e)=>t.sendMessage({type:"connect",refreshToken:e.data.refresh_token,clientId:e.data.clientId,hassUrl:n.Hq?i.M:e.data.hassUrl}),o=(t,e,a,s)=>t.sendMessage({type:"show_lovelace_view",viewPath:a,urlPath:s||null,hassUrl:n.Hq?i.M:e}),c=(t,e)=>{if(!t.castConnectedToOurHass)return new Promise((a=>{const n=t.addEventListener("connection-changed",(()=>{t.castConnectedToOurHass&&(n(),a())}));s(t,e)}))}},15638:function(t,e,a){a.r(e);var n=a(44249),i=a(72621),s=(a(31622),a(57243)),o=a(15093),c=a(35359),d=a(17439);a(65981);(0,n.Z)([(0,o.Mo)("hui-cast-row")],(function(t,e){class n extends e{constructor(...e){super(...e),t(this)}}return{F:n,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_castManager",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_noHTTPS",value:()=>!1},{kind:"method",key:"setConfig",value:function(t){this._config={icon:"mdi:television",name:"ioBroker Cast",view:0,...t}}},{kind:"method",key:"shouldUpdate",value:function(t){return!(1===t.size&&t.has("hass"))}},{kind:"method",key:"render",value:function(){if(!this._config)return s.Ld;const t=this._castManager&&this._castManager.status&&this._config.view===this._castManager.status.lovelacePath&&this._config.dashboard===this._castManager.status.urlPath;return s.dy` <ha-icon .icon="${this._config.icon}"></ha-icon> <div class="flex"> <div class="name">${this._config.name}</div> ${this._noHTTPS?s.dy` Cast requires HTTPS `:void 0===this._castManager?s.Ld:null===this._castManager?s.dy` Cast API unavailable `:"NO_DEVICES_AVAILABLE"===this._castManager.castState?s.dy` No devices found `:s.dy` <div class="controls"> <google-cast-launcher></google-cast-launcher> <mwc-button ="${this._sendLovelace}" class="${(0,c.$)({inactive:!t})}" .unelevated="${t}" .disabled="${!this._castManager.status}"> SHOW </mwc-button> </div> `} </div> `}},{kind:"method",key:"firstUpdated",value:function(t){(0,i.Z)(n,"firstUpdated",this,3)([t]),"http:"===location.protocol&&"localhost"!==location.hostname&&(this._noHTTPS=!0),a.e("29248").then(a.bind(a,58382)).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}))))}},{kind:"method",key:"updated",value:function(t){(0,i.Z)(n,"updated",this,3)([t]),this._config&&this._config.hide_if_unavailable&&(this.style.display=this._castManager&&"NO_DEVICES_AVAILABLE"!==this._castManager.castState?"":"none")}},{kind:"method",key:"_sendLovelace",value:async function(){await(0,d.W_)(this._castManager,this.hass.auth),(0,d.Il)(this._castManager,this.hass.auth.data.hassUrl,this._config.view,this._config.dashboard)}},{kind:"field",static:!0,key:"styles",value:()=>s.iv`:host{display:flex;align-items:center}ha-icon{padding:8px;color:var(--paper-item-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}`}]}}),s.oi)}};
//# sourceMappingURL=45006.6efbfd6566d0c195.js.map