iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 7.56 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[41243],{48548:function(t,i,n){n.d(i,{R:function(){return e},i:function(){return 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"}},e=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"}}},7962:function(t,i,n){n.a(t,async function(t,i){try{var s=n(40445),e=n(5124),o=n(67576),a=n(6412),r=n(48548),c=n(82286),u=n(98079),h=n(26300),l=t([h]);h=(l.then?(await l)():l)[0];let p,_,d=t=>t;const b="M18,18H6V6H18V18Z";class v extends e.WF{render(){return this.stateObj?(0,e.qy)(p||(p=d` <div class="state"> <ha-icon-button class="${0}" .label="${0}" ="${0}" .disabled="${0}" .path="${0}"> </ha-icon-button> <ha-icon-button class="${0}" .label="${0}" .path="${0}" ="${0}" .disabled="${0}"></ha-icon-button> <ha-icon-button class="${0}" .label="${0}" ="${0}" .disabled="${0}" .path="${0}"> </ha-icon-button> </div> `),(0,a.H)({hidden:!(0,c.$)(this.stateObj,u.Jp.OPEN)}),this.hass.localize("ui.card.cover.open_cover"),this._onOpenTap,!(0,u.pc)(this.stateObj),(0,r.i)(this.stateObj),(0,a.H)({hidden:!(0,c.$)(this.stateObj,u.Jp.STOP)}),this.hass.localize("ui.card.cover.stop_cover"),b,this._onStopTap,!(0,u.lg)(this.stateObj),(0,a.H)({hidden:!(0,c.$)(this.stateObj,u.Jp.CLOSE)}),this.hass.localize("ui.card.cover.close_cover"),this._onCloseTap,!(0,u.hJ)(this.stateObj),(0,r.R)(this.stateObj)):e.s6}_onOpenTap(t){t.stopPropagation(),this.hass.callService("cover","open_cover",{entity_id:this.stateObj.entity_id})}_onCloseTap(t){t.stopPropagation(),this.hass.callService("cover","close_cover",{entity_id:this.stateObj.entity_id})}_onStopTap(t){t.stopPropagation(),this.hass.callService("cover","stop_cover",{entity_id:this.stateObj.entity_id})}}v.styles=(0,e.AH)(_||(_=d`.state{white-space:nowrap}.hidden{visibility:hidden!important}`)),(0,s.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"stateObj",void 0),v=(0,s.Cg)([(0,o.EM)("ha-cover-controls")],v),i()}catch(p){i(p)}})},69001:function(t,i,n){n.a(t,async function(t,i){try{var s=n(40445),e=n(5124),o=n(67576),a=n(6412),r=n(82286),c=n(98079),u=n(26300),h=t([u]);u=(h.then?(await h)():h)[0];let l,p,_=t=>t;const d="M19,6.41L17.59,5L7,15.59V9H5V19H15V17H8.41L19,6.41Z",b="M5,17.59L15.59,7H9V5H19V15H17V8.41L6.41,19L5,17.59Z",v="M18,18H6V6H18V18Z";class f extends e.WF{render(){return this.stateObj?(0,e.qy)(l||(l=_` <ha-icon-button class="${0}" .label="${0}" .path="${0}" ="${0}" .disabled="${0}"></ha-icon-button> <ha-icon-button class="${0}" .label="${0}" .path="${0}" ="${0}" .disabled="${0}"></ha-icon-button> <ha-icon-button class="${0}" .label="${0}" .path="${0}" ="${0}" .disabled="${0}"></ha-icon-button>`),(0,a.H)({invisible:!(0,r.$)(this.stateObj,c.Jp.OPEN_TILT)}),this.hass.localize("ui.card.cover.open_tilt_cover"),b,this._onOpenTiltTap,!(0,c.uB)(this.stateObj),(0,a.H)({invisible:!(0,r.$)(this.stateObj,c.Jp.STOP_TILT)}),this.hass.localize("ui.card.cover.stop_cover"),v,this._onStopTiltTap,!(0,c.UE)(this.stateObj),(0,a.H)({invisible:!(0,r.$)(this.stateObj,c.Jp.CLOSE_TILT)}),this.hass.localize("ui.card.cover.close_tilt_cover"),d,this._onCloseTiltTap,!(0,c.Yx)(this.stateObj)):e.s6}_onOpenTiltTap(t){t.stopPropagation(),this.hass.callService("cover","open_cover_tilt",{entity_id:this.stateObj.entity_id})}_onCloseTiltTap(t){t.stopPropagation(),this.hass.callService("cover","close_cover_tilt",{entity_id:this.stateObj.entity_id})}_onStopTiltTap(t){t.stopPropagation(),this.hass.callService("cover","stop_cover_tilt",{entity_id:this.stateObj.entity_id})}}f.styles=(0,e.AH)(p||(p=_`:host{white-space:nowrap}.invisible{visibility:hidden!important}`)),(0,s.Cg)([(0,o.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],f.prototype,"stateObj",void 0),f=(0,s.Cg)([(0,o.EM)("ha-cover-tilt-controls")],f),i()}catch(l){i(l)}})},98079:function(t,i,n){n.d(i,{Av:function(){return u},Et:function(){return r},Jp:function(){return a},MF:function(){return l},UE:function(){return f},Yx:function(){return v},dx:function(){return c},hJ:function(){return _},lg:function(){return d},nX:function(){return h},ns:function(){return O},pc:function(){return p},uB:function(){return b}});var s=n(47129),e=n(82286),o=n(22675),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}({});const r=[0,25,75,100],c=t=>(0,e.$)(t,4),u=t=>(0,e.$)(t,128),h=t=>c(t)||u(t);function l(t){const i=(0,e.$)(t,1)||(0,e.$)(t,2)||(0,e.$)(t,8);return((0,e.$)(t,16)||(0,e.$)(t,32)||(0,e.$)(t,64))&&!i}function p(t){if(t.state===o.Hh)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 _(t){if(t.state===o.Hh)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 d(t){return t.state!==o.Hh}function b(t){if(t.state===o.Hh)return!1;return!0===t.attributes.assumed_state||!function(t){return 100===t.attributes.current_tilt_position}(t)}function v(t){if(t.state===o.Hh)return!1;return!0===t.attributes.assumed_state||!function(t){return 0===t.attributes.current_tilt_position}(t)}function f(t){return t.state!==o.Hh}function O(t,i,n){var e;const o=(0,s.a)(t)?null!==(e=t.attributes.current_position)&&void 0!==e?e:t.attributes.current_tilt_position:void 0,a=null!=n?n:o;return a&&100!==a?i.formatEntityAttributeValue(t,"current_position",Math.round(a)):""}},79734:function(t,i,n){n.a(t,async function(t,s){try{n.r(i);n(16280);var e=n(40445),o=n(5124),a=n(67576),r=n(7962),c=n(69001),u=n(98079),h=n(784),l=n(79757),p=n(85979),_=t([r,c,l,p]);[r,c,l,p]=_.then?(await _)():_;let d,b,v,f,O,T=t=>t;class $ extends o.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}shouldUpdate(t){return(0,h.LX)(this,t)}render(){if(!this._config||!this.hass)return o.s6;const t=this.hass.states[this._config.entity];return t?(0,o.qy)(b||(b=T` <hui-generic-entity-row .hass="${0}" .config="${0}"> ${0} </hui-generic-entity-row> `),this.hass,this._config,(0,u.MF)(t)?(0,o.qy)(v||(v=T` <ha-cover-tilt-controls .hass="${0}" .stateObj="${0}"></ha-cover-tilt-controls> `),this.hass,t):(0,o.qy)(f||(f=T` <ha-cover-controls .hass="${0}" .stateObj="${0}"></ha-cover-controls> `),this.hass,t)):(0,o.qy)(d||(d=T` <hui-warning .hass="${0}"> ${0} </hui-warning> `),this.hass,(0,p.j)(this.hass,this._config.entity))}}$.styles=(0,o.AH)(O||(O=T`ha-cover-controls,ha-cover-tilt-controls{margin-right:-.57em;margin-inline-end:-.57em;margin-inline-start:initial}`)),(0,e.Cg)([(0,a.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,e.Cg)([(0,a.wk)()],$.prototype,"_config",void 0),$=(0,e.Cg)([(0,a.EM)("hui-cover-entity-row")],$),s()}catch(d){s(d)}})}}]);