iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 4.12 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["45006"],{96137:function(t,e,a){a.d(e,{$Q:()=>i,Hq:()=>s,py:()=>o});var n=a(26833);const s=!1,i=s?n.N:"A078F6B0",o="urn:x-cast:com.nabucasa.hast"},26833:function(t,e,a){a.d(e,{M:()=>s,N:()=>n});const n="5FE44367",s="http://192.168.1.234:8123"},17439:function(t,e,a){a.d(e,{Il:()=>o,Ni:()=>i,W_:()=>c});a(40251);var n=a(96137),s=a(26833);const i=(t,e)=>t.sendMessage({type:"connect",refreshToken:e.data.refresh_token,clientId:e.data.clientId,hassUrl:n.Hq?s.M:e.data.hassUrl}),o=(t,e,a,i)=>t.sendMessage({type:"show_lovelace_view",viewPath:a,urlPath:i||null,hassUrl:n.Hq?s.M:e}),c=(t,e)=>{if(!t.castConnectedToOurHass)return new Promise((a=>{const n=t.addEventListener("connection-changed",(()=>{t.castConnectedToOurHass&&(n(),a())}));i(t,e)}))}},15638:function(t,e,a){a.r(e);var n=a(61701),s=a(72621),i=(a(71695),a(19423),a(40251),a(47021),a(31622),a(57243)),o=a(50778),c=a(35359),d=a(17439);a(65981);let r,l,h,u,g,f,v=t=>t;(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(){return!1}},{kind:"method",key:"setConfig",value:function(t){this._config=Object.assign({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 i.Ld;const t=this._castManager&&this._castManager.status&&this._config.view===this._castManager.status.lovelacePath&&this._config.dashboard===this._castManager.status.urlPath;return(0,i.dy)(r||(r=v` <ha-icon .icon="${0}"></ha-icon> <div class="flex"> <div class="name">${0}</div> ${0} </div> `),this._config.icon,this._config.name,this._noHTTPS?(0,i.dy)(l||(l=v` Cast requires HTTPS `)):void 0===this._castManager?i.Ld:null===this._castManager?(0,i.dy)(h||(h=v` Cast API unavailable `)):"NO_DEVICES_AVAILABLE"===this._castManager.castState?(0,i.dy)(u||(u=v` No devices found `)):(0,i.dy)(g||(g=v` <div class="controls"> <google-cast-launcher></google-cast-launcher> <mwc-button ="${0}" class="${0}" .unelevated="${0}" .disabled="${0}"> SHOW </mwc-button> </div> `),this._sendLovelace,(0,c.$)({inactive:!t}),t,!this._castManager.status))}},{kind:"method",key:"firstUpdated",value:function(t){(0,s.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,s.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(){return(0,i.iv)(f||(f=v`: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}`))}}]}}),i.oi)}}]);
//# sourceMappingURL=45006.b37dbfd7b72ece68.js.map