iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 15.6 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[66990],{599:function(t,i,e){e.a(t,async function(t,i){try{e(3362),e(62953);var n=e(40445),a=e(5124),o=e(67576),s=e(65063),c=e(89300),r=e(1087),h=t([c]);c=(h.then?(await h)():h)[0];let l,d=t=>t;class g extends a.WF{render(){return(0,a.qy)(l||(l=d` <ha-progress-button .progress="${0}" .disabled="${0}" .appearance="${0}" ="${0}" tabindex="0"> <slot></slot></ha-progress-button> `),this.progress,this.disabled,this.appearance,this._buttonTapped)}async _callService(){this.progress=!0;const t={domain:this.domain,service:this.service,data:this.data,target:this.target,success:!1},i=this.shadowRoot.querySelector("ha-progress-button");try{await this.hass.callService(this.domain,this.service,this.data,this.target),this.progress=!1,i.actionSuccess(),t.success=!0}catch(e){return this.progress=!1,i.actionError(),void(t.success=!1)}finally{(0,r.r)(this,"hass-service-called",t)}}_buttonTapped(){this.confirmation?(0,s.dk)(this,{text:this.confirmation,confirm:()=>this._callService()}):this._callService()}constructor(...t){super(...t),this.disabled=!1,this.progress=!1,this.data={},this.appearance="plain"}}(0,n.Cg)([(0,o.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,n.Cg)([(0,o.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,n.Cg)([(0,o.MZ)({type:Boolean})],g.prototype,"progress",void 0),(0,n.Cg)([(0,o.MZ)()],g.prototype,"domain",void 0),(0,n.Cg)([(0,o.MZ)()],g.prototype,"service",void 0),(0,n.Cg)([(0,o.MZ)({type:Object})],g.prototype,"target",void 0),(0,n.Cg)([(0,o.MZ)({type:Object})],g.prototype,"data",void 0),(0,n.Cg)([(0,o.MZ)()],g.prototype,"confirmation",void 0),(0,n.Cg)([(0,o.MZ)()],g.prototype,"appearance",void 0),g=(0,n.Cg)([(0,o.EM)("ha-call-service-button")],g),i()}catch(l){i(l)}})},25618:function(t,i,e){e.a(t,async function(t,n){try{e.d(i,{M:function(){return c}});e(18111),e(7588);var a=e(84043),o=t([a]);function c(t){const i=(0,a.d)(t);return"HUI-CONDITIONAL-ELEMENT"!==i.tagName&&i.classList.add("element"),t.style&&Object.keys(t.style).forEach(e=>{i.style.setProperty(e,t.style[e])}),i}a=(o.then?(await o)():o)[0],n()}catch(s){n(s)}})},27722:function(t,i,e){e.d(i,{d:function(){return o}});var n=e(28978);function a(t,i,e,n){if(!e||!e.action||"none"===e.action)return"";let a=n?t.localize("ui.panel.lovelace.cards.picture-elements.hold"):t.localize("ui.panel.lovelace.cards.picture-elements.tap");switch(e.action){case"navigate":a+=` ${t.localize("ui.panel.lovelace.cards.picture-elements.navigate_to",{location:e.navigation_path})}`;break;case"url":a+=` ${t.localize("ui.panel.lovelace.cards.picture-elements.url",{url_path:e.url_path})}`;break;case"toggle":a+=` ${t.localize("ui.panel.lovelace.cards.picture-elements.toggle",{name:i})}`;break;case"call-service":a+=`${t.localize("ui.panel.lovelace.cards.picture-elements.perform_action",{name:e.service})}`;break;case"more-info":a+=`${t.localize("ui.panel.lovelace.cards.picture-elements.more_info",{name:i})}`}return a}const o=(t,i)=>{if(null===i.title)return"";if(i.title)return i.title;let e="";if(i.entity&&(e=i.entity in t.states?(0,n.u)(t.states[i.entity]):i.entity),!i.tap_action&&!i.hold_action)return e;const o=i.tap_action?a(t,e,i.tap_action,!1):"",s=i.hold_action?a(t,e,i.hold_action,!0):"";return o+(o&&s?"\n":"")+s}},98743:function(t,i,e){e.a(t,async function(t,i){try{e(16280),e(44114),e(18111),e(7588),e(3362),e(62953);var n=e(40445),a=e(67576),o=e(25618),s=e(14487),c=t([o,s]);[o,s]=c.then?(await c)():c;class r extends HTMLElement{static async getConfigElement(){return await Promise.all([e.e(81804),e.e(18377),e.e(74981)]).then(e.bind(e,98852)),document.createElement("hui-conditional-element-editor")}setConfig(t){if(!(t.conditions&&Array.isArray(t.conditions)&&t.elements&&Array.isArray(t.elements)&&(0,s.db)(t.conditions)))throw new Error("Invalid configuration");this._elements.length>0&&(this._elements.forEach(t=>{t.parentElement&&t.parentElement.removeChild(t)}),this._elements=[]),this._config=t,this._config.elements.forEach(t=>{this._elements.push((0,o.M)(t))}),this._updateElements()}set hass(t){this._hass=t,this._updateElements()}_updateElements(){if(!this._hass||!this._config)return;const t=(0,s.XH)(this._config.conditions,this._hass,{});this._elements.forEach(i=>{t?(i.hass=this._hass,i.parentElement||this.appendChild(i)):i.parentElement&&i.parentElement.removeChild(i)})}constructor(...t){super(...t),this._elements=[]}}r=(0,n.Cg)([(0,a.EM)("hui-conditional-element")],r),i()}catch(r){i(r)}})},16732:function(t,i,e){e(16280),e(3362),e(62953);var n=e(40445),a=e(5124),o=e(67576),s=e(63672),c=(e(47680),e(27722)),r=e(19037),h=e(22064),l=e(97176);let d,g,u=t=>t;class _ extends a.WF{static async getConfigElement(){return await e.e(28588).then(e.bind(e,59559)),document.createElement("hui-icon-element-editor")}static getStubConfig(){return{type:"icon",icon:"mdi:alert-circle"}}setConfig(t){if(!t.icon)throw Error("Icon required");this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}render(){return this._config&&this.hass?(0,a.qy)(d||(d=u` <ha-icon .icon="${0}" .title="${0}" ="${0}" .actionHandler="${0}" tabindex="${0}"></ha-icon> `),this._config.icon,(0,c.d)(this.hass,this._config),this._handleAction,(0,r.T)({hasHold:(0,l.h)(this._config.hold_action),hasDoubleClick:(0,l.h)(this._config.double_tap_action)}),(0,s.J)((0,l.h)(this._config.tap_action)?"0":void 0)):a.s6}_handleAction(t){(0,h.$)(this,this.hass,this._config,t.detail.action)}}_.styles=(0,a.AH)(g||(g=u`:host{cursor:pointer}ha-icon:focus{outline:0;background:var(--divider-color);border-radius:var(--ha-border-radius-pill)}`)),(0,n.Cg)([(0,o.wk)()],_.prototype,"_config",void 0),_=(0,n.Cg)([(0,o.EM)("hui-icon-element")],_)},9578:function(t,i,e){e.a(t,async function(t,i){try{e(16280),e(18111),e(22489),e(3362),e(62953);var n=e(40445),a=e(5124),o=e(67576),s=e(63672),c=e(67013),r=e(27722),h=e(19037),l=e(22064),d=e(97176),g=e(57914),u=t([g]);g=(u.then?(await u)():u)[0];let _,f,p=t=>t;class m extends a.WF{static async getConfigElement(){return await e.e(29472).then(e.bind(e,63376)),document.createElement("hui-image-element-editor")}setConfig(t){if(!t)throw Error("Invalid configuration");this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t),this.classList.toggle("clickable",this._config.tap_action&&"none"!==this._config.tap_action.action)}render(){var t;if(!this._config||!this.hass)return a.s6;let i;this._config.image_entity&&(i=this.hass.states[this._config.image_entity]);const e=i?(0,c.e)(i):"object"==typeof(null===(t=this._config)||void 0===t?void 0:t.image)&&this._config.image.media_content_id||this._config.image;return(0,a.qy)(_||(_=p` <div ="${0}" .actionHandler="${0}" tabindex="${0}" role="${0}"> <hui-image .hass="${0}" .entity="${0}" .image="${0}" .stateImage="${0}" .cameraImage="${0}" .cameraView="${0}" .filter="${0}" .stateFilter="${0}" .title="${0}" .aspectRatio="${0}" .darkModeImage="${0}" .darkModeFilter="${0}"></hui-image> </div> `),this._handleAction,(0,h.T)({hasHold:(0,d.h)(this._config.hold_action),hasDoubleClick:(0,d.h)(this._config.double_tap_action)}),(0,s.J)((0,d.h)(this._config.tap_action)?"0":void 0),(0,s.J)((0,d.h)(this._config.tap_action)?"button":void 0),this.hass,this._config.entity,e,this._config.state_image,this._config.camera_image,this._config.camera_view,this._config.filter,this._config.state_filter,(0,r.d)(this.hass,this._config),this._config.aspect_ratio,this._config.dark_mode_image,this._config.dark_mode_filter)}_handleAction(t){(0,l.$)(this,this.hass,this._config,t.detail.action)}}m.styles=(0,a.AH)(f||(f=p`:host(.clickable){cursor:pointer;overflow:hidden;-webkit-touch-callout:none!important}hui-image{-webkit-user-select:none!important;pointer-events:none}div:focus{outline:0}div:focus hui-image{background:var(--divider-color);border-radius:var(--ha-border-radius-pill)}`)),(0,n.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,n.Cg)([(0,o.wk)()],m.prototype,"_config",void 0),m=(0,n.Cg)([(0,o.EM)("hui-image-element")],m),i()}catch(_){i(_)}})},51007:function(t,i,e){e.a(t,async function(t,i){try{e(16280),e(3362),e(62953);var n=e(40445),a=e(5124),o=e(67576),s=e(599),c=t([s]);s=(c.then?(await c)():c)[0];let r,h,l=t=>t;class d extends a.WF{static async getConfigElement(){return await e.e(21323).then(e.bind(e,42566)),document.createElement("hui-service-button-element-editor")}static getStubConfig(t){return{type:"action-button",action:"homeassistant.turn_on",title:t.localize("ui.card.common.turn_on")}}setConfig(t){var i;if(!t||!t.action&&!t.service)throw Error("Action required");if([this._domain,this._service]=(null!==(i=t.action)&&void 0!==i?i:t.service).split(".",2),!this._domain)throw Error("Action does not have a domain");if(!this._service)throw Error("Action does not have an action name");this._config=t}render(){var t,i,e,n;if(!this._config||!this.hass)return a.s6;const{entity_id:o,label_id:s,floor_id:c,device_id:h,area_id:d}=null!==(t=null!==(i=this._config.service_data)&&void 0!==i?i:this._config.data)&&void 0!==t?t:{},g=null!==(e=this._config.target)&&void 0!==e?e:{entity_id:o,label_id:s,floor_id:c,device_id:h,area_id:d};return(0,a.qy)(r||(r=l` <ha-call-service-button .hass="${0}" .domain="${0}" .service="${0}" .data="${0}" .target="${0}"> ${0} </ha-call-service-button> `),this.hass,this._domain,this._service,null!==(n=this._config.data)&&void 0!==n?n:this._config.service_data,g,this._config.title)}}d.styles=(0,a.AH)(h||(h=l`ha-call-service-button{color:var(--primary-color);white-space:nowrap}`)),(0,n.Cg)([(0,o.wk)()],d.prototype,"_config",void 0),d=(0,n.Cg)([(0,o.EM)("hui-service-button-element")],d),i()}catch(r){i(r)}})},37696:function(t,i,e){e.a(t,async function(t,i){try{e(16280),e(3362),e(62953);var n=e(40445),a=e(5124),o=e(67576),s=e(63672),c=e(28978),r=e(58234),h=e(22675),l=e(19037),d=e(13632),g=e(22064),u=e(97176),_=e(784),f=e(85979),p=(e(47046),t([r,f]));[r,f]=p.then?(await p)():p;let m,v,y=t=>t;class b extends a.WF{static async getConfigElement(){return await e.e(70610).then(e.bind(e,13129)),document.createElement("hui-state-badge-element-editor")}static getStubConfig(t,i,e){return{type:"state-badge",entity:(0,d.B)(t,1,i,e,["light","switch","sensor"],t=>t.state!==h.Hh&&t.state!==h.HV)[0]||""}}setConfig(t){if(!t.entity)throw Error("Entity required");this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}shouldUpdate(t){return(0,_.LX)(this,t)}render(){if(!this._config||!this.hass)return a.s6;const t=this.hass.states[this._config.entity];return t?(0,a.qy)(v||(v=y` <ha-state-label-badge .hass="${0}" .state="${0}" .name="${0}" .title="${0}" show-name ="${0}" .actionHandler="${0}" tabindex="${0}"></ha-state-label-badge> `),this.hass,t,void 0===this._config.name?(0,c.u)(t):null===this._config.name?"":this._config.name,void 0===this._config.title?(0,c.u)(t):null===this._config.title?"":this._config.title,this._handleAction,(0,l.T)({hasHold:(0,u.h)(this._config.hold_action),hasDoubleClick:(0,u.h)(this._config.double_tap_action)}),(0,s.J)((0,u.h)(this._config.tap_action)?"0":void 0)):(0,a.qy)(m||(m=y` <hui-warning-element .label="${0}"></hui-warning-element> `),(0,f.j)(this.hass,this._config.entity))}_handleAction(t){(0,g.$)(this,this.hass,this._config,t.detail.action)}}(0,n.Cg)([(0,o.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,n.Cg)([(0,o.wk)()],b.prototype,"_config",void 0),b=(0,n.Cg)([(0,o.EM)("hui-state-badge-element")],b),i()}catch(m){i(m)}})},10792:function(t,i,e){e.a(t,async function(t,i){try{e(16280),e(3362),e(62953);var n=e(40445),a=e(5124),o=e(67576),s=e(63672),c=e(74281),r=e(22675),h=e(27722),l=e(19037),d=e(13632),g=e(22064),u=e(97176),_=e(784),f=e(85979),p=(e(47046),t([c,f]));[c,f]=p.then?(await p)():p;let m,v,y,b=t=>t;class $ extends a.WF{static async getConfigElement(){return await e.e(12148).then(e.bind(e,91551)),document.createElement("hui-state-icon-element-editor")}static getStubConfig(t,i,e){return{type:"state-icon",entity:(0,d.B)(t,1,i,e,["light","switch","sensor"],t=>t.state!==r.Hh&&t.state!==r.HV)[0]||""}}setConfig(t){if(!t.entity)throw Error("Entity required");this._config=Object.assign({state_color:!0,tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}shouldUpdate(t){return(0,_.LX)(this,t)}render(){if(!this._config||!this.hass)return a.s6;const t=this.hass.states[this._config.entity];return t?(0,a.qy)(v||(v=b` <state-badge .hass="${0}" .stateObj="${0}" .title="${0}" ="${0}" .actionHandler="${0}" tabindex="${0}" .overrideIcon="${0}" .stateColor="${0}"></state-badge> `),this.hass,t,(0,h.d)(this.hass,this._config),this._handleAction,(0,l.T)({hasHold:(0,u.h)(this._config.hold_action),hasDoubleClick:(0,u.h)(this._config.double_tap_action)}),(0,s.J)((0,u.h)(this._config.tap_action)?"0":void 0),this._config.icon,this._config.state_color):(0,a.qy)(m||(m=b` <hui-warning-element .label="${0}"></hui-warning-element> `),(0,f.j)(this.hass,this._config.entity))}_handleAction(t){(0,g.$)(this,this.hass,this._config,t.detail.action)}}$.styles=(0,a.AH)(y||(y=b`:host{cursor:pointer}state-badge:focus{outline:0;background:var(--divider-color);border-radius:var(--ha-border-radius-pill)}`)),(0,n.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,n.Cg)([(0,o.wk)()],$.prototype,"_config",void 0),$=(0,n.Cg)([(0,o.EM)("hui-state-icon-element")],$),i()}catch(m){i(m)}})},14097:function(t,i,e){e.a(t,async function(t,i){try{e(16280),e(3362),e(62953);var n=e(40445),a=e(5124),o=e(67576),s=e(63672),c=e(22675),r=e(27722),h=e(19037),l=e(13632),d=e(22064),g=e(97176),u=e(784),_=e(85979),f=(e(47046),t([_]));_=(f.then?(await f)():f)[0];let p,m,v,y,b=t=>t;class $ extends a.WF{static async getConfigElement(){return await e.e(27431).then(e.bind(e,56474)),document.createElement("hui-state-label-element-editor")}static getStubConfig(t,i,e){return{type:"state-label",entity:(0,l.B)(t,1,i,e,["light","switch","sensor"],t=>t.state!==c.Hh&&t.state!==c.HV)[0]||""}}setConfig(t){if(!t.entity)throw Error("Entity required");this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}shouldUpdate(t){return(0,u.LX)(this,t)}render(){if(!this._config||!this.hass)return a.s6;const t=this.hass.states[this._config.entity];return t?this._config.attribute&&!(this._config.attribute in t.attributes)?(0,a.qy)(m||(m=b` <hui-warning-element label="${0}"></hui-warning-element> `),this.hass.localize("ui.panel.lovelace.warning.attribute_not_found",{attribute:this._config.attribute,entity:this._config.entity})):(0,a.qy)(v||(v=b` <div .title="${0}" ="${0}" .actionHandler="${0}" tabindex="${0}"> ${0}${0}${0} </div> `),(0,r.d)(this.hass,this._config),this._handleAction,(0,h.T)({hasHold:(0,g.h)(this._config.hold_action),hasDoubleClick:(0,g.h)(this._config.double_tap_action)}),(0,s.J)((0,g.h)(this._config.tap_action)?"0":void 0),this._config.prefix,this._config.attribute?t.attributes[this._config.attribute]:this.hass.formatEntityState(t),this._config.suffix):(0,a.qy)(p||(p=b` <hui-warning-element .label="${0}"></hui-warning-element> `),(0,_.j)(this.hass,this._config.entity))}_handleAction(t){(0,d.$)(this,this.hass,this._config,t.detail.action)}}$.styles=(0,a.AH)(y||(y=b`:host{cursor:pointer}div{padding:8px;white-space:nowrap}div:focus{outline:0;background:var(--divider-color);border-radius:var(--ha-border-radius-pill)}`)),(0,n.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,n.Cg)([(0,o.wk)()],$.prototype,"_config",void 0),$=(0,n.Cg)([(0,o.EM)("hui-state-label-element")],$),i()}catch(p){i(p)}})}}]);