iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 8.2 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[97524],{96986:function(t,i,e){e.d(i,{LR:function(){return s},m9:function(){return o}});const a={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},n={10:"M16,18H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",20:"M16,17H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",30:"M16,15H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",40:"M16,14H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",50:"M16,13H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",60:"M16,12H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",70:"M16,10H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",80:"M16,9H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",90:"M16,8H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",100:"M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z"},r={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},s=(t,i)=>{const e=Number(t);if(isNaN(e))return"off"===t?"mdi:battery":"on"===t?"mdi:battery-alert":"mdi:battery-unknown";const n=10*Math.round(e/10);return i&&e>=10?r[n]:i?"mdi:battery-charging-outline":e<=5?"mdi:battery-alert-variant-outline":a[n]},o=t=>{const i=Number(t);if(isNaN(i))return"M15.07,12.25L14.17,13.17C13.63,13.71 13.25,14.18 13.09,15H11.05C11.16,14.1 11.56,13.28 12.17,12.67L13.41,11.41C13.78,11.05 14,10.55 14,10C14,8.89 13.1,8 12,8A2,2 0 0,0 10,10H8A4,4 0 0,1 12,6A4,4 0 0,1 16,10C16,10.88 15.64,11.68 15.07,12.25M13,19H11V17H13M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.66C6,21.4 6.6,22 7.33,22H16.67C17.4,22 18,21.4 18,20.66V5.33C18,4.59 17.4,4 16.67,4Z";if(i<=5)return"M14 20H6V6H14M14.67 4H13V2H7V4H5.33C4.6 4 4 4.6 4 5.33V20.67C4 21.4 4.6 22 5.33 22H14.67C15.4 22 16 21.4 16 20.67V5.33C16 4.6 15.4 4 14.67 4M21 7H19V13H21V8M21 15H19V17H21V15Z";const e=10*Math.round(i/10);return n[e]}},89759:function(t,i,e){e.a(t,async function(t,a){try{e.r(i);e(16280),e(18111),e(22489),e(61701),e(3362),e(62953);var n=e(40445),r=e(5124),s=e(67576),o=e(42372),h=e(1087),d=e(96986),c=(e(76776),e(67094),e(19037)),u=e(13632),H=e(784),g=e(85979),m=t([g]);g=(m.then?(await m)():m)[0];let l,V,b,f,y,p,C=t=>t;const v={moisture:"M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z",temperature:"M15 13V5A3 3 0 0 0 9 5V13A5 5 0 1 0 15 13M12 4A1 1 0 0 1 13 5V8H11V5A1 1 0 0 1 12 4Z",brightness:"M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13",conductivity:"M2,22V20C2,20 7,18 12,18C17,18 22,20 22,20V22H2M11.3,9.1C10.1,5.2 4,6.1 4,6.1C4,6.1 4.2,13.9 9.9,12.7C9.5,9.8 8,9 8,9C10.8,9 11,12.4 11,12.4V17C11.3,17 11.7,17 12,17C12.3,17 12.7,17 13,17V12.8C13,12.8 13,8.9 16,7.9C16,7.9 14,10.9 14,12.9C21,13.6 21,4 21,4C21,4 12.1,3 11.3,9.1Z",battery:void 0};class M extends r.WF{static async getConfigElement(){return await e.e(57607).then(e.bind(e,76730)),document.createElement("hui-plant-status-card-editor")}static getStubConfig(t,i,e){return{type:"plant-status",entity:(0,u.B)(t,1,i,e,["plant"])[0]||""}}getCardSize(){return 3}setConfig(t){if(!t.entity||"plant"!==t.entity.split(".")[0])throw new Error("Specify an entity from within the plant domain");this._config=t}shouldUpdate(t){return(0,H.LX)(this,t)}updated(t){if(super.updated(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,o.Q)(this,this.hass.themes,this._config.theme)}render(){if(!this.hass||!this._config)return r.s6;const t=this.hass.states[this._config.entity];return t?(0,r.qy)(V||(V=C` <ha-card class="${0}"> <div class="banner" style="background-image:url(${0})"> <div class="header"> ${0} </div> </div> <div class="content"> ${0} </div> </ha-card> `),t.attributes.entity_picture?"has-plant-image":"",t.attributes.entity_picture,this.hass.formatEntityName(t,this._config.name),this._computeAttributes(t).map(i=>(0,r.qy)(b||(b=C` <div class="attributes" ="${0}" .actionHandler="${0}" tabindex="0" .value="${0}"> <div class="icon"> ${0} </div> <div class="${0}"> ${0} </div> <div class="uom"> ${0} </div> </div> `),this._handleMoreInfo,(0,c.T)(),i,"battery"===i?(0,r.qy)(f||(f=C`<ha-icon .icon="${0}"></ha-icon>`),(0,d.LR)(t.attributes.battery)):(0,r.qy)(y||(y=C`<ha-svg-icon .path="${0}"></ha-svg-icon>`),v[i]),-1===t.attributes.problem.indexOf(i)?"":"problem",this._formatSensorValue(t,i),t.attributes.unit_of_measurement_dict[i]||""))):(0,r.qy)(l||(l=C` <hui-warning .hass="${0}"> ${0} </hui-warning> `),this.hass,(0,g.j)(this.hass,this._config.entity))}_formatSensorValue(t,i){var e,a;const n=null===(e=t.attributes.sensors)||void 0===e?void 0:e[i],r=n?this.hass.states[n]:void 0;return r?this.hass.formatEntityStateToParts(r).filter(t=>"unit"!==t.type).map(t=>t.value).join(""):null!==(a=t.attributes[i])&&void 0!==a?a:""}_computeAttributes(t){return Object.keys(v).filter(i=>i in t.attributes)}_handleMoreInfo(t){const i=t.currentTarget,e=this.hass.states[this._config.entity];i.value&&(0,h.r)(this,"hass-more-info",{entityId:e.attributes.sensors[i.value]})}}M.styles=(0,r.AH)(p||(p=C`ha-card{height:100%;box-sizing:border-box}.banner{display:flex;align-items:flex-end;background-repeat:no-repeat;background-size:cover;background-position:center;padding-top:12px}.has-plant-image .banner{padding-top:30%}.header{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-2xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);padding:8px 16px}.has-plant-image .header{font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-medium);line-height:16px;padding:16px;color:#fff;width:100%;background:rgba(0,0,0,var(--dark-secondary-opacity))}.content{display:flex;justify-content:space-between;padding:16px 32px 24px 32px}.has-plant-image .content{padding-bottom:16px}.icon{margin-bottom:8px}ha-icon,ha-svg-icon{color:var(--state-icon-color)}.attributes{cursor:pointer}.attributes:focus{outline:0;background:var(--divider-color);border-radius:var(--ha-border-radius-pill)}.attributes div{text-align:center}.problem{color:var(--error-color);font-weight:var(--ha-font-weight-bold)}.uom{color:var(--secondary-text-color)}`)),(0,n.Cg)([(0,s.MZ)({attribute:!1})],M.prototype,"hass",void 0),(0,n.Cg)([(0,s.wk)()],M.prototype,"_config",void 0),M=(0,n.Cg)([(0,s.EM)("hui-plant-status-card")],M),a()}catch(l){a(l)}})}}]);