UNPKG

iobroker.lovelace

Version:

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

1 lines 11.8 kB
export const __rspack_esm_id=17910;export const __rspack_esm_ids=[17910];export const __webpack_modules__={92020(t,e,s){s.a(t,async function(t,a){try{s.d(e,{d:()=>l});var o=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,a)=>{const r=a??new Date;return(0,o.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)};a()}catch(t){a(t)}})},70773(t,e,s){s.a(t,async function(t,e){try{var a=s(62826),o=s(92913),i=s(35932),n=s(83339),c=s(5124),r=s(22441),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,o.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,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"datetime",void 0),d=(0,a.Cg)([(0,r.EM)("ha-absolute-time")],d),e()}catch(t){e(t)}})},6531(t,e,s){s.a(t,async function(t,e){try{var a=s(62826),o=s(5124),i=s(22441),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;class d extends o.WF{_localizeState(){return this.stateObj.attributes.device_class===l.Sn&&this.stateObj.state!==r.Hh&&this.stateObj.state!==r.HV?o.qy` <hui-timestamp-display .hass="${this.hass}" .ts="${new Date(this.stateObj.state)}" format="relative" capitalize></hui-timestamp-display> `:this.hass.formatEntityState(this.stateObj)}_toggleAbsolute(){this._absoluteTime=!this._absoluteTime}render(){const t=this.stateOverride??this._localizeState();return o.qy` <p class="state">${t}</p> <div class="time-row"> <p class="last-changed" @click="${this._toggleAbsolute}"> ${this._absoluteTime?o.qy` <ha-absolute-time .hass="${this.hass}" .datetime="${this.changedOverride??this.stateObj.last_changed}"></ha-absolute-time> `:o.qy` <ha-relative-time .hass="${this.hass}" .datetime="${this.changedOverride??this.stateObj.last_changed}" capitalize></ha-relative-time> `} </p> <slot name="after-time"></slot> </div> `}constructor(...t){super(...t),this._absoluteTime=!1}}d.styles=o.AH`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,a.Cg)([(0,i.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,i.MZ)({attribute:!1})],d.prototype,"stateObj",void 0),(0,a.Cg)([(0,i.MZ)({attribute:!1})],d.prototype,"stateOverride",void 0),(0,a.Cg)([(0,i.MZ)({attribute:!1})],d.prototype,"changedOverride",void 0),(0,a.Cg)([(0,i.wk)()],d.prototype,"_absoluteTime",void 0),d=(0,a.Cg)([(0,i.EM)("ha-more-info-state-header")],d),e()}catch(t){e(t)}})},37863(t,e,s){s.d(e,{K:()=>a});const a=s(5124).AH`: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(t,e,s){s.a(t,async function(t,a){try{s.r(e);var o=s(62826),i=s(5124),n=s(22441),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;const g="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",v=5,_=2;class y 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",_)):this._setButtonState("confirm",v)}_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 i.qy` <ha-more-info-state-header .hass="${this.hass}" .stateObj="${this.stateObj}"></ha-more-info-state-header> <div class="controls" style="${(0,c.W)(e)}"> ${(0,u.jW)(this.stateObj)?i.qy` <div class="status"> <span></span> <div class="icon"> <ha-state-icon .stateObj="${this.stateObj}"></ha-state-icon> </div> </div> `:i.qy` <ha-state-control-lock-toggle @lock-service-called="${this._resetButtonState}" .stateObj="${this.stateObj}" .hass="${this.hass}"> </ha-state-control-lock-toggle> `} ${t?i.qy` <div class="buttons"> ${"done"===this._buttonState?i.qy` <p class="open-done"> <ha-svg-icon path="${g}"></ha-svg-icon> ${this.hass.localize("ui.card.lock.open_door_done")} </p> `:i.qy` <ha-control-button .disabled="${!(0,u.pc)(this.stateObj)}" class="open-button ${this._buttonState}" @click="${this._open}"> ${"confirm"===this._buttonState?this.hass.localize("ui.card.lock.open_door_confirm"):this.hass.localize("ui.card.lock.open_door")} </ha-control-button> `} </div> `:i.s6} </div> <div> ${(0,u.jW)(this.stateObj)?i.qy` <ha-control-button-group class="jammed"> <ha-control-button @click="${this._unlock}"> ${this.hass.localize("ui.card.lock.unlock")} </ha-control-button> <ha-control-button @click="${this._lock}"> ${this.hass.localize("ui.card.lock.lock")} </ha-control-button> </ha-control-button-group> `:i.s6} </div> `}static get styles(){return[p.K,i.AH`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}@keyframes 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,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"stateObj",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_buttonState",void 0),y=(0,o.Cg)([(0,n.EM)("more-info-lock")],y),a()}catch(t){a(t)}})},59815(t,e,s){s.d(e,{B:()=>i,e:()=>o});var a=s(5124);const o=a.AH`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}`,i=a.AH`@keyframes pulse{0%{opacity:1}50%{opacity:0}100%{opacity:1}}.pulse{animation:pulse 1s infinite}`},41721(t,e,s){s.a(t,async function(t,e){try{var a=s(62826),o=s(5124),i=s(22441),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];class g extends o.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?o.qy` <div class="buttons"> <ha-control-button .label="${this.hass.localize("ui.card.lock.lock")}" @click="${this._turnOn}"> <ha-state-icon .stateObj="${this.stateObj}" .stateValue="${t?"locking":"locked"}"></ha-state-icon> </ha-control-button> <ha-control-button .label="${this.hass.localize("ui.card.lock.unlock")}" @click="${this._turnOff}"> <ha-state-icon .stateObj="${this.stateObj}" .stateValue="${e?"unlocking":"unlocked"}"></ha-state-icon> </ha-control-button> </div> `:o.qy` <ha-control-switch touch-action="none" vertical reversed .checked="${this._isOn}" @change="${this._valueChanged}" .label="${this._isOn?this.hass.localize("ui.card.lock.unlock"):this.hass.localize("ui.card.lock.lock")}" style="${(0,c.W)({"--control-switch-on-color":s,"--control-switch-off-color":s})}" .disabled="${this.stateObj.state===u.Hh}"> <ha-state-icon slot="icon-on" .stateObj="${this.stateObj}" .stateValue="${t?"locking":"locked"}" class="${(0,n.H)({pulse:t})}"></ha-state-icon> <ha-state-icon slot="icon-off" .stateObj="${this.stateObj}" .stateValue="${e?"unlocking":"unlocked"}" class="${(0,n.H)({pulse:e})}"></ha-state-icon> </ha-control-switch> `}constructor(...t){super(...t),this._isOn=!1}}g.styles=[p.e,p.B],(0,a.Cg)([(0,i.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,i.MZ)({attribute:!1})],g.prototype,"stateObj",void 0),(0,a.Cg)([(0,i.wk)()],g.prototype,"_isOn",void 0),g=(0,a.Cg)([(0,i.EM)("ha-state-control-lock-toggle")],g),e()}catch(t){e(t)}})},83309(t,e,s){s.d(e,{r:()=>i});var a=s(74816),o=s(35932);function i(t,e,s){const[i,n]=(0,a.x)(s?.in,t,e);return+(0,o.o)(i)===+(0,o.o)(n)}},12010(t,e,s){s.d(e,{s:()=>o});var a=s(74816);function o(t,e,s){const[o,i]=(0,a.x)(s?.in,t,e);return o.getFullYear()===i.getFullYear()}}};