iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 7.56 kB
JavaScript
export const __webpack_ids__=["50764"];export const __webpack_modules__={46631:function(t,i,e){e.d(i,{o:()=>n,q:()=>s});const s=t=>{switch(t.attributes.device_class){case"awning":case"door":case"gate":case"curtain":return"M9,11H15V8L19,12L15,16V13H9V16L5,12L9,8V11M2,20V4H4V20H2M20,20V4H22V20H20Z";default:return"M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z"}},n=t=>{switch(t.attributes.device_class){case"awning":case"door":case"gate":case"curtain":return"M13,20V4H15.03V20H13M10,20V4H12.03V20H10M5,8L9.03,12L5,16V13H2V11H5V8M20,16L16,12L20,8V11H23V13H20V16Z";default:return"M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z"}}},80588:function(t,i,e){var s=e(44249),n=e(57243),o=e(15093),a=e(35359),r=e(46631),c=e(75278),u=e(78304);e(23334);(0,s.Z)([(0,o.Mo)("ha-cover-controls")],(function(t,i){return{F:class extends i{constructor(...i){super(...i),t(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"method",key:"render",value:function(){return this.stateObj?n.dy` <div class="state"> <ha-icon-button class="${(0,a.$)({hidden:!(0,c.e)(this.stateObj,u.mk.OPEN)})}" .label="${this.hass.localize("ui.card.cover.open_cover")}" ="${this._onOpenTap}" .disabled="${!(0,u.g6)(this.stateObj)}" .path="${(0,r.q)(this.stateObj)}"> </ha-icon-button> <ha-icon-button class="${(0,a.$)({hidden:!(0,c.e)(this.stateObj,u.mk.STOP)})}" .label="${this.hass.localize("ui.card.cover.stop_cover")}" .path="${"M18,18H6V6H18V18Z"}" ="${this._onStopTap}" .disabled="${!(0,u.qY)(this.stateObj)}"></ha-icon-button> <ha-icon-button class="${(0,a.$)({hidden:!(0,c.e)(this.stateObj,u.mk.CLOSE)})}" .label="${this.hass.localize("ui.card.cover.close_cover")}" ="${this._onCloseTap}" .disabled="${!(0,u.Lg)(this.stateObj)}" .path="${(0,r.o)(this.stateObj)}"> </ha-icon-button> </div> `:n.Ld}},{kind:"method",key:"_onOpenTap",value:function(t){t.stopPropagation(),this.hass.callService("cover","open_cover",{entity_id:this.stateObj.entity_id})}},{kind:"method",key:"_onCloseTap",value:function(t){t.stopPropagation(),this.hass.callService("cover","close_cover",{entity_id:this.stateObj.entity_id})}},{kind:"method",key:"_onStopTap",value:function(t){t.stopPropagation(),this.hass.callService("cover","stop_cover",{entity_id:this.stateObj.entity_id})}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`.state{white-space:nowrap}.hidden{visibility:hidden!important}`}]}}),n.oi)},22969:function(t,i,e){var s=e(44249),n=e(57243),o=e(15093),a=e(35359),r=e(75278),c=e(78304);e(23334);(0,s.Z)([(0,o.Mo)("ha-cover-tilt-controls")],(function(t,i){return{F:class extends i{constructor(...i){super(...i),t(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"method",key:"render",value:function(){return this.stateObj?n.dy` <ha-icon-button class="${(0,a.$)({invisible:!(0,r.e)(this.stateObj,c.mk.OPEN_TILT)})}" .label="${this.hass.localize("ui.card.cover.open_tilt_cover")}" .path="${"M5,17.59L15.59,7H9V5H19V15H17V8.41L6.41,19L5,17.59Z"}" ="${this._onOpenTiltTap}" .disabled="${!(0,c.NE)(this.stateObj)}"></ha-icon-button> <ha-icon-button class="${(0,a.$)({invisible:!(0,r.e)(this.stateObj,c.mk.STOP_TILT)})}" .label="${this.hass.localize("ui.card.cover.stop_cover")}" .path="${"M18,18H6V6H18V18Z"}" ="${this._onStopTiltTap}" .disabled="${!(0,c.JB)(this.stateObj)}"></ha-icon-button> <ha-icon-button class="${(0,a.$)({invisible:!(0,r.e)(this.stateObj,c.mk.CLOSE_TILT)})}" .label="${this.hass.localize("ui.card.cover.close_tilt_cover")}" .path="${"M19,6.41L17.59,5L7,15.59V9H5V19H15V17H8.41L19,6.41Z"}" ="${this._onCloseTiltTap}" .disabled="${!(0,c.oc)(this.stateObj)}"></ha-icon-button>`:n.Ld}},{kind:"method",key:"_onOpenTiltTap",value:function(t){t.stopPropagation(),this.hass.callService("cover","open_cover_tilt",{entity_id:this.stateObj.entity_id})}},{kind:"method",key:"_onCloseTiltTap",value:function(t){t.stopPropagation(),this.hass.callService("cover","close_cover_tilt",{entity_id:this.stateObj.entity_id})}},{kind:"method",key:"_onStopTiltTap",value:function(t){t.stopPropagation(),this.hass.callService("cover","stop_cover_tilt",{entity_id:this.stateObj.entity_id})}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host{white-space:nowrap}.invisible{visibility:hidden!important}`}]}}),n.oi)},78304:function(t,i,e){e.d(i,{JB:()=>_,L3:()=>v,Lg:()=>u,NE:()=>h,g6:()=>c,mk:()=>a,oc:()=>d,pu:()=>r,qY:()=>l});var s=e(5839),n=e(75278),o=e(96194);let a=function(t){return t[t.OPEN=1]="OPEN",t[t.CLOSE=2]="CLOSE",t[t.SET_POSITION=4]="SET_POSITION",t[t.STOP=8]="STOP",t[t.OPEN_TILT=16]="OPEN_TILT",t[t.CLOSE_TILT=32]="CLOSE_TILT",t[t.STOP_TILT=64]="STOP_TILT",t[t.SET_TILT_POSITION=128]="SET_TILT_POSITION",t}({});function r(t){const i=(0,n.e)(t,a.OPEN)||(0,n.e)(t,a.CLOSE)||(0,n.e)(t,a.STOP);return((0,n.e)(t,a.OPEN_TILT)||(0,n.e)(t,a.CLOSE_TILT)||(0,n.e)(t,a.STOP_TILT))&&!i}function c(t){if(t.state===o.nZ)return!1;return!0===t.attributes.assumed_state||!function(t){return void 0!==t.attributes.current_position?100===t.attributes.current_position:"open"===t.state}(t)&&!function(t){return"opening"===t.state}(t)}function u(t){if(t.state===o.nZ)return!1;return!0===t.attributes.assumed_state||!function(t){return void 0!==t.attributes.current_position?0===t.attributes.current_position:"closed"===t.state}(t)&&!function(t){return"closing"===t.state}(t)}function l(t){return t.state!==o.nZ}function h(t){if(t.state===o.nZ)return!1;return!0===t.attributes.assumed_state||!function(t){return 100===t.attributes.current_tilt_position}(t)}function d(t){if(t.state===o.nZ)return!1;return!0===t.attributes.assumed_state||!function(t){return 0===t.attributes.current_tilt_position}(t)}function _(t){return t.state!==o.nZ}function v(t,i,e){const n=(0,s.v)(t)?t.attributes.current_position??t.attributes.current_tilt_position:void 0,o=e??n;return o&&100!==o?i.formatEntityAttributeValue(t,"current_position",Math.round(o)):""}},4806:function(t,i,e){e.a(t,(async function(t,s){try{e.r(i);var n=e(44249),o=e(57243),a=e(15093),r=(e(80588),e(22969),e(78304)),c=e(93331),u=e(8069),l=e(62577),h=t([u]);u=(h.then?(await h)():h)[0];(0,n.Z)([(0,a.Mo)("hui-cover-entity-row")],(function(t,i){return{F:class extends i{constructor(...i){super(...i),t(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(t){if(!t)throw new Error("Invalid configuration");this._config=t}},{kind:"method",key:"shouldUpdate",value:function(t){return(0,c.G2)(this,t)}},{kind:"method",key:"render",value:function(){if(!this._config||!this.hass)return o.Ld;const t=this.hass.states[this._config.entity];return t?o.dy` <hui-generic-entity-row .hass="${this.hass}" .config="${this._config}"> ${(0,r.pu)(t)?o.dy` <ha-cover-tilt-controls .hass="${this.hass}" .stateObj="${t}"></ha-cover-tilt-controls> `:o.dy` <ha-cover-controls .hass="${this.hass}" .stateObj="${t}"></ha-cover-controls> `} </hui-generic-entity-row> `:o.dy` <hui-warning> ${(0,l.i)(this.hass,this._config.entity)} </hui-warning> `}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`ha-cover-controls,ha-cover-tilt-controls{margin-right:-.57em;margin-inline-end:-.57em;margin-inline-start:initial}`}]}}),o.oi);s()}catch(t){s(t)}}))}};
//# sourceMappingURL=50764.f004585775b64d24.js.map