UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

2 lines 3.69 kB
export const __webpack_ids__=["49"];export const __webpack_modules__={44925:function(t,e,i){var s=i(44249),a=i(57243),n=i(15093),o=i(28816);i(65981);(0,s.Z)([(0,n.Mo)("ha-battery-icon")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"batteryStateObj",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"batteryChargingStateObj",value:void 0},{kind:"method",key:"render",value:function(){return this.batteryStateObj?a.dy` <ha-icon .icon="${(0,o.U)(this.batteryStateObj.state,"on"===this.batteryChargingStateObj?.state)}"></ha-icon> `:a.Ld}}]}}),a.oi)},31650:function(t,e,i){i.r(e);var s=i(44249),a=(i(9359),i(56475),i(70104),i(57243)),n=i(15093),o=i(27486),r=i(59847),d=i(75278),c=i(45061),l=(i(44925),i(23334),i(96194)),h=i(63318),u=i(98538);const b=[{translationKey:"start_mowing",icon:"M8,5.14V19.14L19,12.14L8,5.14Z",serviceName:"start_mowing",isVisible:t=>(0,d.e)(t,u.sO.START_MOWING)},{translationKey:"pause",icon:"M14,19H18V5H14M6,19H10V5H6V19Z",serviceName:"pause",isVisible:t=>(0,d.e)(t,u.sO.PAUSE)},{translationKey:"dock",icon:"M15 13L11 17V14H2V12H11V9L15 13M5 20V16H7V18H17V10.19L12 5.69L7.21 10H4.22L12 3L22 12H19V20H5Z",serviceName:"dock",isVisible:t=>(0,d.e)(t,u.sO.DOCK)}];(0,s.Z)([(0,n.Mo)("more-info-lawn_mower")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"method",key:"render",value:function(){if(!this.hass||!this.stateObj)return a.Ld;const t=this.stateObj;return a.dy` ${t.state!==l.nZ?a.dy` <div class="flex-horizontal"> <div> <span class="status-subtitle">${this.hass.localize("ui.dialogs.more_info_control.lawn_mower.activity")}: </span> <span> <strong>${this.hass.formatEntityState(t)}</strong> </span> </div> ${this._renderBattery()} </div>`:a.Ld} ${b.some((e=>e.isVisible(t)))?a.dy` <div> <p></p> <div class="status-subtitle"> ${this.hass.localize("ui.dialogs.more_info_control.lawn_mower.commands")} </div> <div class="flex-horizontal space-around"> ${b.filter((e=>e.isVisible(t))).map((e=>a.dy` <div> <ha-icon-button .path="${e.icon}" .entry="${e}" @click="${this._callService}" .label="${this.hass.localize(`ui.dialogs.more_info_control.lawn_mower.${e.translationKey}`)}" .disabled="${t.state===l.nZ}"></ha-icon-button> </div> `))} </div> </div> `:""} `}},{kind:"field",key:"_deviceEntities",value:()=>(0,o.Z)(((t,e)=>Object.values(e).filter((e=>e.device_id===t))))},{kind:"method",key:"_renderBattery",value:function(){const t=this.stateObj,e=this.hass.entities[t.entity_id]?.device_id,i=e?this._deviceEntities(e,this.hass.entities):[],s=(0,h.eD)(this.hass,i),n=s?this.hass.states[s.entity_id]:void 0,o=n&&"binary_sensor"===(0,r.N)(n);if(n&&(o||!isNaN(n.state))){const t=(0,h.wX)(this.hass,i),e=t?this.hass.states[t?.entity_id]:void 0;return a.dy` <div> <span> ${o?"":`${Number(n.state).toFixed()}${(0,c.K)(this.hass.locale)}%`} <ha-battery-icon .hass="${this.hass}" .batteryStateObj="${n}" .batteryChargingStateObj="${e}"></ha-battery-icon> </span> </div> `}return a.Ld}},{kind:"method",key:"_callService",value:function(t){const e=t.target.entry;this.hass.callService("lawn_mower",e.serviceName,{entity_id:this.stateObj.entity_id})}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`:host{line-height:1.5}.status-subtitle{color:var(--secondary-text-color)}.flex-horizontal{display:flex;flex-direction:row;justify-content:space-between}.space-around{justify-content:space-around}`}]}}),a.oi)}}; //# sourceMappingURL=49.a9e5ab1ac0e66c86.js.map