iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 12.6 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[17910],{92020:function(t,e,s){s.a(t,async function(t,o){try{s.d(e,{d:function(){return l}});var a=s(83309),i=s(12010),n=s(95747),c=s(30162),r=t([c,n]);[c,n]=r.then?(await r)():r;const l=(t,e,s,o)=>{const r=null!=o?o:new Date;return(0,a.r)(t,r)?(0,c.fU)(t,e,s):(0,i.s)(t,r)?(0,n.ZS)(t,e,s):(0,n.aQ)(t,e,s)};o()}catch(l){o(l)}})},70773:function(t,e,s){s.a(t,async function(t,e){try{var o=s(40445),a=s(92913),i=s(35932),n=s(83339),c=s(5124),r=s(67576),l=s(92020),h=t([l]);l=(h.then?(await h)():h)[0];const u=5e3;class d extends c.mN{disconnectedCallback(){super.disconnectedCallback(),this._clearTimeout()}connectedCallback(){super.connectedCallback(),this.datetime&&this._updateNextDay()}createRenderRoot(){return this}firstUpdated(t){super.firstUpdated(t),this._updateAbsolute()}update(t){super.update(t),this._updateAbsolute()}_clearTimeout(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=void 0)}_updateNextDay(){this._clearTimeout();const t=new Date,e=(0,a.f)((0,i.o)(t),1),s=(0,n.b)(e,t)+u;this._timeout=window.setTimeout(()=>{this._updateNextDay(),this._updateAbsolute()},s)}_updateAbsolute(){this.datetime?this.innerHTML=(0,l.d)(new Date(this.datetime),this.hass.locale,this.hass.config):this.innerHTML=this.hass.localize("ui.components.absolute_time.never")}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"datetime",void 0),d=(0,o.Cg)([(0,r.EM)("ha-absolute-time")],d),e()}catch(u){e(u)}})},6531:function(t,e,s){s.a(t,async function(t,e){try{s(62953);var o=s(40445),a=s(5124),i=s(67576),n=s(70773),c=s(36158),r=s(22675),l=s(64808),h=s(62688),u=t([n,c,h]);[n,c,h]=u.then?(await u)():u;let d,b,p,m,g,f=t=>t;class v extends a.WF{_localizeState(){return this.stateObj.attributes.device_class===l.Sn&&this.stateObj.state!==r.Hh&&this.stateObj.state!==r.HV?(0,a.qy)(d||(d=f` <hui-timestamp-display .hass="${0}" .ts="${0}" format="relative" capitalize></hui-timestamp-display> `),this.hass,new Date(this.stateObj.state)):this.hass.formatEntityState(this.stateObj)}_toggleAbsolute(){this._absoluteTime=!this._absoluteTime}render(){var t,e,s;const o=null!==(t=this.stateOverride)&&void 0!==t?t:this._localizeState();return(0,a.qy)(b||(b=f` <p class="state">${0}</p> <div class="time-row"> <p class="last-changed" ="${0}"> ${0} </p> <slot name="after-time"></slot> </div> `),o,this._toggleAbsolute,this._absoluteTime?(0,a.qy)(p||(p=f` <ha-absolute-time .hass="${0}" .datetime="${0}"></ha-absolute-time> `),this.hass,null!==(e=this.changedOverride)&&void 0!==e?e:this.stateObj.last_changed):(0,a.qy)(m||(m=f` <ha-relative-time .hass="${0}" .datetime="${0}" capitalize></ha-relative-time> `),this.hass,null!==(s=this.changedOverride)&&void 0!==s?s:this.stateObj.last_changed))}constructor(...t){super(...t),this._absoluteTime=!1}}v.styles=(0,a.AH)(g||(g=f`p{text-align:center;margin:0}.state{font-style:normal;font-weight:var(--ha-font-weight-normal);font-size:36px;line-height:var(--ha-line-height-condensed)}.time-row{position:relative;display:flex;align-items:center;justify-content:center;margin-bottom:var(--ha-space-5)}::slotted([slot=after-time]){position:absolute;inset-inline-end:0;top:50%;transform:translateY(-50%)}.last-changed{font-style:normal;font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-normal);letter-spacing:.1px;padding:var(--ha-space-1) 0;cursor:pointer;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}`)),(0,o.Cg)([(0,i.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],v.prototype,"stateObj",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],v.prototype,"stateOverride",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],v.prototype,"changedOverride",void 0),(0,o.Cg)([(0,i.wk)()],v.prototype,"_absoluteTime",void 0),v=(0,o.Cg)([(0,i.EM)("ha-more-info-state-header")],v),e()}catch(d){e(d)}})},37863:function(t,e,s){s.d(e,{K:function(){return a}});let o;const a=(0,s(5124).AH)(o||(o=(t=>t)`:host{display:flex;flex-direction:column;flex:1;justify-content:space-between}.controls{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1}.controls:not(:last-child){margin-bottom:var(--ha-space-6)}.controls>:not(:last-child){margin-bottom:var(--ha-space-6)}.buttons{display:flex;align-items:center;justify-content:center;margin-bottom:var(--ha-space-3)}.buttons>*{margin:var(--ha-space-2)}ha-attributes{display:block;width:100%}ha-more-info-control-select-container+ha-attributes:not([empty]){margin-top:var(--ha-space-4)}`))},54101:function(t,e,s){s.a(t,async function(t,o){try{s.r(e);s(3362),s(62953);var a=s(40445),i=s(5124),n=s(67576),c=s(89784),r=s(52658),l=s(82286),h=(s(48374),s(28624),s(8889),s(93367)),u=s(55881),d=s(41721),b=s(6531),p=s(37863),m=t([h,d,b]);[h,d,b]=m.then?(await m)():m;let g,f,v,y,_,k,O,x,j=t=>t;const w="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",$=5,C=2;class S extends i.WF{_setButtonState(t,e){clearTimeout(this._buttonTimeout),this._buttonState=t,e&&(this._buttonTimeout=window.setTimeout(()=>{this._buttonState="normal"},1e3*e))}async _open(){"confirm"===this._buttonState?((0,u.hW)(this,this.hass,this.stateObj,"open"),this._setButtonState("done",C)):this._setButtonState("confirm",$)}_resetButtonState(){this._setButtonState("normal")}disconnectedCallback(){super.disconnectedCallback(),this._resetButtonState()}async _lock(){(0,u.hW)(this,this.hass,this.stateObj,"lock")}async _unlock(){(0,u.hW)(this,this.hass,this.stateObj,"unlock")}render(){if(!this.hass||!this.stateObj)return i.s6;const t=(0,l.$)(this.stateObj,u.Z0.OPEN),e={"--state-color":(0,r.Se)(this.stateObj)};return(0,i.qy)(g||(g=j` <ha-more-info-state-header .hass="${0}" .stateObj="${0}"></ha-more-info-state-header> <div class="controls" style="${0}"> ${0} ${0} </div> <div> ${0} </div> `),this.hass,this.stateObj,(0,c.W)(e),(0,u.jW)(this.stateObj)?(0,i.qy)(f||(f=j` <div class="status"> <span></span> <div class="icon"> <ha-state-icon .stateObj="${0}"></ha-state-icon> </div> </div> `),this.stateObj):(0,i.qy)(v||(v=j` <ha-state-control-lock-toggle -service-called="${0}" .stateObj="${0}" .hass="${0}"> </ha-state-control-lock-toggle> `),this._resetButtonState,this.stateObj,this.hass),t?(0,i.qy)(y||(y=j` <div class="buttons"> ${0} </div> `),"done"===this._buttonState?(0,i.qy)(_||(_=j` <p class="open-done"> <ha-svg-icon path="${0}"></ha-svg-icon> ${0} </p> `),w,this.hass.localize("ui.card.lock.open_door_done")):(0,i.qy)(k||(k=j` <ha-control-button .disabled="${0}" class="open-button ${0}" ="${0}"> ${0} </ha-control-button> `),!(0,u.pc)(this.stateObj),this._buttonState,this._open,"confirm"===this._buttonState?this.hass.localize("ui.card.lock.open_door_confirm"):this.hass.localize("ui.card.lock.open_door"))):i.s6,(0,u.jW)(this.stateObj)?(0,i.qy)(O||(O=j` <ha-control-button-group class="jammed"> <ha-control-button ="${0}"> ${0} </ha-control-button> <ha-control-button ="${0}"> ${0} </ha-control-button> </ha-control-button-group> `),this._unlock,this.hass.localize("ui.card.lock.unlock"),this._lock,this.hass.localize("ui.card.lock.lock")):i.s6)}static get styles(){return[p.K,(0,i.AH)(x||(x=j`ha-control-button{font-size:var(--ha-font-size-m);height:60px;--control-button-border-radius:var(--ha-border-radius-3xl)}.open-button{width:130px;--control-button-background-color:var(--state-color)}.open-button.confirm{--control-button-background-color:var(--warning-color)}.open-done{line-height:60px;display:flex;align-items:center;flex-direction:row;gap:var(--ha-space-2);font-weight:var(--ha-font-weight-medium);color:var(--success-color)}ha-control-button-group.jammed{--control-button-group-thickness:60px;width:100%;max-width:400px;margin:0 auto} pulse{0%{opacity:1}50%{opacity:0}100%{opacity:1}}.status{display:flex;align-items:center;flex-direction:column;justify-content:center;height:45vh;max-height:320px;min-height:200px}.status .icon{position:relative;--mdc-icon-size:80px;animation:pulse 1s infinite;color:var(--state-color);border-radius:var(--ha-border-radius-circle);width:144px;height:144px;display:flex;align-items:center;justify-content:center}.status .icon::before{content:"";position:absolute;top:0;left:0;height:100%;width:100%;border-radius:var(--ha-border-radius-circle);background-color:var(--state-color);transition:background-color 180ms ease-in-out;opacity:.2}`))]}constructor(...t){super(...t),this._buttonState="normal"}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"stateObj",void 0),(0,a.Cg)([(0,n.wk)()],S.prototype,"_buttonState",void 0),S=(0,a.Cg)([(0,n.EM)("more-info-lock")],S),o()}catch(g){o(g)}})},59815:function(t,e,s){s.d(e,{B:function(){return r},e:function(){return c}});var o=s(5124);let a,i,n=t=>t;const c=(0,o.AH)(a||(a=n`ha-control-switch{height:45vh;max-height:320px;min-height:200px;--control-switch-thickness:130px;--control-switch-border-radius:var(--ha-border-radius-6xl);--control-switch-padding:6px;--mdc-icon-size:24px}.buttons{display:flex;flex-direction:column;width:130px;height:45vh;max-height:320px;min-height:200px;padding:6px;box-sizing:border-box}ha-control-button{flex:1;width:100%;--control-button-border-radius:var(--ha-border-radius-6xl);--mdc-icon-size:24px}ha-control-button.active{--control-button-icon-color:white;--control-button-background-color:var(--color);--control-button-focus-color:var(--color);--control-button-background-opacity:1}ha-control-button:not(:last-child){margin-bottom:6px}`)),r=(0,o.AH)(i||(i=n` pulse{0%{opacity:1}50%{opacity:0}100%{opacity:1}}.pulse{animation:pulse 1s infinite}`))},41721:function(t,e,s){s.a(t,async function(t,e){try{s(3362),s(62953);var o=s(40445),a=s(5124),i=s(67576),n=s(6412),c=s(89784),r=s(1087),l=s(52658),h=(s(48374),s(25094),s(93367)),u=s(22675),d=s(88360),b=s(55881),p=s(59815),m=t([h]);h=(m.then?(await m)():m)[0];let g,f,v=t=>t;class y extends a.WF{willUpdate(t){super.willUpdate(t),t.has("stateObj")&&(this._isOn="locked"===this.stateObj.state||"locking"===this.stateObj.state)}_valueChanged(t){t.target.checked?this._turnOn():this._turnOff()}async _turnOn(){this._isOn=!0;try{await this._callService(!0)}catch(t){this._isOn=!1}}async _turnOff(){this._isOn=!1;try{await this._callService(!1)}catch(t){this._isOn=!0}}async _callService(t){this.hass&&this.stateObj&&((0,d.j)(this,"light"),(0,r.r)(this,"lock-service-called"),(0,b.hW)(this,this.hass,this.stateObj,t?"lock":"unlock"))}render(){const t="locking"===this.stateObj.state,e="unlocking"===this.stateObj.state,s=(0,l.Se)(this.stateObj);return this.stateObj.state===u.HV?(0,a.qy)(g||(g=v` <div class="buttons"> <ha-control-button .label="${0}" ="${0}"> <ha-state-icon .stateObj="${0}" .stateValue="${0}"></ha-state-icon> </ha-control-button> <ha-control-button .label="${0}" ="${0}"> <ha-state-icon .stateObj="${0}" .stateValue="${0}"></ha-state-icon> </ha-control-button> </div> `),this.hass.localize("ui.card.lock.lock"),this._turnOn,this.stateObj,t?"locking":"locked",this.hass.localize("ui.card.lock.unlock"),this._turnOff,this.stateObj,e?"unlocking":"unlocked"):(0,a.qy)(f||(f=v` <ha-control-switch touch-action="none" vertical reversed .checked="${0}" ="${0}" .label="${0}" style="${0}" .disabled="${0}"> <ha-state-icon slot="icon-on" .stateObj="${0}" .stateValue="${0}" class="${0}"></ha-state-icon> <ha-state-icon slot="icon-off" .stateObj="${0}" .stateValue="${0}" class="${0}"></ha-state-icon> </ha-control-switch> `),this._isOn,this._valueChanged,this._isOn?this.hass.localize("ui.card.lock.unlock"):this.hass.localize("ui.card.lock.lock"),(0,c.W)({"--control-switch-on-color":s,"--control-switch-off-color":s}),this.stateObj.state===u.Hh,this.stateObj,t?"locking":"locked",(0,n.H)({pulse:t}),this.stateObj,e?"unlocking":"unlocked",(0,n.H)({pulse:e}))}constructor(...t){super(...t),this._isOn=!1}}y.styles=[p.e,p.B],(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"stateObj",void 0),(0,o.Cg)([(0,i.wk)()],y.prototype,"_isOn",void 0),y=(0,o.Cg)([(0,i.EM)("ha-state-control-lock-toggle")],y),e()}catch(g){e(g)}})},83309:function(t,e,s){s.d(e,{r:function(){return i}});s(62953);var o=s(74816),a=s(35932);function i(t,e,s){const[i,n]=(0,o.x)(null==s?void 0:s.in,t,e);return+(0,a.o)(i)===+(0,a.o)(n)}},12010:function(t,e,s){s.d(e,{s:function(){return a}});s(62953);var o=s(74816);function a(t,e,s){const[a,i]=(0,o.x)(null==s?void 0:s.in,t,e);return a.getFullYear()===i.getFullYear()}}}]);