iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 3.64 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["23339"],{72099:function(t,i,e){e.d(i,{U:()=>n});const n=t=>`/api/image_proxy/${t.entity_id}?token=${t.attributes.access_token}&state=${t.state}`},69773:function(t,i,e){e.r(i),e.d(i,{HuiPictureCard:()=>v});var n=e(61701),s=e(72621),a=(e(52247),e(71695),e(19423),e(40251),e(47021),e(57243)),o=e(50778),c=e(35359),h=e(20552),r=e(82393),d=e(73850),_=(e(54977),e(72099)),u=e(3967),g=e(1617),f=e(5684),l=e(93331),m=e(62577);let k,y,p,b=t=>t,v=(0,n.Z)([(0,o.Mo)("hui-picture-card")],(function(t,i){class n extends i{constructor(...i){super(...i),t(this)}}return{F:n,d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await Promise.all([e.e("46379"),e.e("24199"),e.e("41258"),e.e("78943"),e.e("99287"),e.e("78823"),e.e("85567"),e.e("87471"),e.e("51995")]).then(e.bind(e,82634)),document.createElement("hui-picture-card-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(){return{type:"picture",image:"https://demo.home-assistant.io/stub_config/t-shirt-promo.png"}}},{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:"method",key:"getCardSize",value:function(){return 5}},{kind:"method",key:"setConfig",value:function(t){if(!t||!t.image&&!t.image_entity)throw new Error("Image required");this._config=Object.assign({tap_action:{action:"more-info"}},t)}},{kind:"method",key:"shouldUpdate",value:function(t){if(!this._config||(0,l.SN)(this,t))return!0;if(this._config.image_entity&&t.has("hass")){const i=t.get("hass");if(!i||i.states[this._config.image_entity]!==this.hass.states[this._config.image_entity])return!0}return!1}},{kind:"method",key:"updated",value:function(t){if((0,s.Z)(n,"updated",this,3)([t]),!this._config||!this.hass)return;const i=t.get("hass"),e=t.get("_config");i&&e&&i.themes===this.hass.themes&&e.theme===this._config.theme||(0,r.R)(this,this.hass.themes,this._config.theme)}},{kind:"method",key:"render",value:function(){var t;if(!this._config||!this.hass)return a.Ld;let i;if(this._config.image_entity&&(i=this.hass.states[this._config.image_entity],!i))return(0,a.dy)(k||(k=b`<hui-warning> ${0} </hui-warning>`),(0,m.i)(this.hass,this._config.image_entity));let e=this._config.image;if(this._config.image_entity){switch((0,d.M)(this._config.image_entity)){case"image":e=(0,_.U)(i);break;case"person":i.attributes.entity_picture&&(e=i.attributes.entity_picture)}}return(0,a.dy)(y||(y=b` <ha-card ="${0}" .actionHandler="${0}" tabindex="${0}" class="${0}"> <img alt="${0}" src="${0}"> </ha-card> `),this._handleAction,(0,u.K)({hasHold:(0,f._)(this._config.hold_action),hasDoubleClick:(0,f._)(this._config.double_tap_action)}),(0,h.o)((0,f._)(this._config.tap_action)||this._config.image_entity?"0":void 0),(0,c.$)({clickable:Boolean(this._config.image_entity&&!this._config.tap_action||this._config.tap_action&&"none"!==this._config.tap_action.action||this._config.hold_action&&"none"!==this._config.hold_action.action||this._config.double_tap_action&&"none"!==this._config.double_tap_action.action)}),(0,h.o)(this._config.alt_text||(null===(t=i)||void 0===t?void 0:t.attributes.friendly_name)),this.hass.hassUrl(e))}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(p||(p=b`ha-card{overflow:hidden;height:100%}ha-card.clickable{cursor:pointer}img{display:block;width:100%}`))}},{kind:"method",key:"_handleAction",value:function(t){(0,g.G)(this,this.hass,this._config,t.detail.action)}}]}}),a.oi)}}]);
//# sourceMappingURL=23339.8c8eff934752f7e8.js.map