iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 3.6 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[10405],{50816:function(t,a,e){e.d(a,{I:function(){return s}});const s="http://192.168.1.234:8123"},40461:function(t,a,e){e.d(a,{oK:function(){return s},tb:function(){return n},xV:function(){return i}});e(3362),e(50816);const s=(t,a)=>t.sendMessage({type:"connect",refreshToken:a.data.refresh_token,clientId:a.data.clientId,hassUrl:a.data.hassUrl}),n=(t,a,e,s)=>t.sendMessage({type:"show_lovelace_view",viewPath:e,urlPath:s||null,hassUrl:a}),i=(t,a)=>{if(!t.castConnectedToOurHass)return new Promise(e=>{const n=t.addEventListener("connection-changed",()=>{t.castConnectedToOurHass&&(n(),e())});s(t,a)})}},96612:function(t,a,e){e.a(t,async function(t,s){try{e.r(a);e(3362),e(62953);var n=e(40445),i=e(5124),o=e(67576),c=e(6412),r=e(40461),h=e(18350),l=(e(47680),t([h]));h=(l.then?(await l)():l)[0];let d,g,u,p,_,f,v=t=>t;class m extends i.WF{setConfig(t){this._config=Object.assign({icon:"mdi:television",name:"ioBroker Cast",view:0},t)}shouldUpdate(t){return!(1===t.size&&t.has("hass"))}render(){if(!this._config)return i.s6;const t=this._castManager&&this._castManager.status&&this._config.view===this._castManager.status.lovelacePath&&this._config.dashboard===this._castManager.status.urlPath;return(0,i.qy)(d||(d=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.qy)(g||(g=v` Cast requires HTTPS `)):void 0===this._castManager?i.s6:null===this._castManager?(0,i.qy)(u||(u=v` Cast API unavailable `)):"NO_DEVICES_AVAILABLE"===this._castManager.castState?(0,i.qy)(p||(p=v` No devices found `)):(0,i.qy)(_||(_=v` <div class="controls"> <google-cast-launcher></google-cast-launcher> <ha-button ="${0}" class="${0}" appearance="plain" size="small" .disabled="${0}"> SHOW </ha-button> </div> `),this._sendLovelace,(0,c.H)({inactive:!t}),!this._castManager.status))}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}}m.styles=(0,i.AH)(f||(f=v`: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,n.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,n.Cg)([(0,o.wk)()],m.prototype,"_config",void 0),(0,n.Cg)([(0,o.wk)()],m.prototype,"_castManager",void 0),(0,n.Cg)([(0,o.wk)()],m.prototype,"_noHTTPS",void 0),m=(0,n.Cg)([(0,o.EM)("hui-cast-row")],m),s()}catch(d){s(d)}})}}]);