UNPKG

iobroker.lovelace

Version:

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

2 lines 16.4 kB
export const __webpack_ids__=["3371"];export const __webpack_modules__={75034:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(44249),o=i(57243),a=i(15093),s=i(76131),c=i(29095),r=i(36522),d=t([c]);c=(d.then?(await d)():d)[0];(0,n.Z)([(0,a.Mo)("ha-call-service-button")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"progress",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)()],key:"domain",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"service",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Object})],key:"target",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Object})],key:"data",value:()=>({})},{kind:"field",decorators:[(0,a.Cb)()],key:"confirmation",value:void 0},{kind:"method",key:"render",value:function(){return o.dy` <ha-progress-button .progress="${this.progress}" .disabled="${this.disabled}" @click="${this._buttonTapped}" tabindex="0"> <slot></slot></ha-progress-button> `}},{kind:"method",key:"_callService",value:async function(){this.progress=!0;const t={domain:this.domain,service:this.service,data:this.data,target:this.target,success:!1},e=this.shadowRoot.querySelector("ha-progress-button");try{await this.hass.callService(this.domain,this.service,this.data,this.target),this.progress=!1,e.actionSuccess(),t.success=!0}catch(i){return this.progress=!1,e.actionError(),void(t.success=!1)}finally{(0,r.B)(this,"hass-service-called",t)}}},{kind:"method",key:"_buttonTapped",value:function(){this.confirmation?(0,s.showConfirmationDialog)(this,{text:this.confirmation,confirm:()=>this._callService()}):this._callService()}}]}}),o.oi);e()}catch(t){e(t)}}))},44804:function(t,e,i){i.a(t,(async function(t,n){try{i.d(e,{O:()=>s});i(9359),i(31526);var o=i(52032),a=t([o]);function s(t){const e=(0,o.w)(t);return"HUI-CONDITIONAL-ELEMENT"!==e.tagName&&e.classList.add("element"),t.style&&Object.keys(t.style).forEach((i=>{e.style.setProperty(i,t.style[i])})),e}o=(a.then?(await a)():a)[0],n()}catch(c){n(c)}}))},84674:function(t,e,i){i.d(e,{$:()=>a});var n=i(47194);function o(t,e,i,n){if(!i||!i.action||"none"===i.action)return"";let o=n?t.localize("ui.panel.lovelace.cards.picture-elements.hold"):t.localize("ui.panel.lovelace.cards.picture-elements.tap");switch(i.action){case"navigate":o+=` ${t.localize("ui.panel.lovelace.cards.picture-elements.navigate_to",{location:i.navigation_path})}`;break;case"url":o+=` ${t.localize("ui.panel.lovelace.cards.picture-elements.url",{url_path:i.url_path})}`;break;case"toggle":o+=` ${t.localize("ui.panel.lovelace.cards.picture-elements.toggle",{name:e})}`;break;case"call-service":o+=`${t.localize("ui.panel.lovelace.cards.picture-elements.perform_action",{name:i.service})}`;break;case"more-info":o+=`${t.localize("ui.panel.lovelace.cards.picture-elements.more_info",{name:e})}`}return o}const a=(t,e)=>{if(null===e.title)return"";if(e.title)return e.title;let i="",a="";if(e.entity&&(i=e.entity in t.states?(0,n.C)(t.states[e.entity]):e.entity),!e.tap_action&&!e.hold_action)return i;const s=e.tap_action?o(t,i,e.tap_action,!1):"",c=e.hold_action?o(t,i,e.hold_action,!0):"";return a=s+(s&&c?"\n":"")+c,a}},35729:function(t,e,i){i.a(t,(async function(t,e){try{i(92745),i(9359),i(31526);var n=i(44804),o=i(94264),a=t([n]);n=(a.then?(await a)():a)[0];class s extends HTMLElement{constructor(...t){super(...t),this._hass=void 0,this._config=void 0,this._elements=[]}static async getConfigElement(){return await Promise.all([i.e("41258"),i.e("95444"),i.e("37008"),i.e("90747")]).then(i.bind(i,63837)),document.createElement("hui-conditional-element-editor")}setConfig(t){if(!(t.conditions&&Array.isArray(t.conditions)&&t.elements&&Array.isArray(t.elements)&&(0,o.s_)(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,n.O)(t))})),this._updateElements()}set hass(t){this._hass=t,this._updateElements()}_updateElements(){if(!this._hass||!this._config)return;const t=(0,o.Ec)(this._config.conditions,this._hass);this._elements.forEach((e=>{t?(e.hass=this._hass,e.parentElement||this.appendChild(e)):e.parentElement&&e.parentElement.removeChild(e)}))}}customElements.define("hui-conditional-element",s),e()}catch(t){e(t)}}))},83442:function(t,e,i){var n=i(44249),o=i(57243),a=i(15093),s=i(20552),c=(i(65981),i(84674)),r=i(3967),d=i(1617),l=i(5684);(0,n.Z)([(0,a.Mo)("hui-icon-element")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await i.e("47161").then(i.bind(i,83888)),document.createElement("hui-icon-element-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(){return{type:"icon",icon:"mdi:alert-circle"}}},{kind:"field",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.icon)throw Error("Icon required");this._config={tap_action:{action:"more-info"},...t}}},{kind:"method",key:"render",value:function(){return this._config&&this.hass?o.dy` <ha-icon .icon="${this._config.icon}" .title="${(0,c.$)(this.hass,this._config)}" @action="${this._handleAction}" .actionHandler="${(0,r.K)({hasHold:(0,l._)(this._config.hold_action),hasDoubleClick:(0,l._)(this._config.double_tap_action)})}" tabindex="${(0,s.o)((0,l._)(this._config.tap_action)?"0":void 0)}"></ha-icon> `:o.Ld}},{kind:"method",key:"_handleAction",value:function(t){(0,d.G)(this,this.hass,this._config,t.detail.action)}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{cursor:pointer}ha-icon:focus{outline:0;background:var(--divider-color);border-radius:100%}`}]}}),o.oi)},92263:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(44249),o=(i(9359),i(56475),i(57243)),a=i(15093),s=i(20552),c=i(72099),r=i(84674),d=i(3967),l=i(1617),h=i(5684),u=i(63848),f=t([u]);u=(f.then?(await f)():f)[0];(0,n.Z)([(0,a.Mo)("hui-image-element")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await i.e("99123").then(i.bind(i,66471)),document.createElement("hui-image-element-editor")}},{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 Error("Invalid configuration");this._config={tap_action:{action:"more-info"},...t},this.classList.toggle("clickable",this._config.tap_action&&"none"!==this._config.tap_action.action)}},{kind:"method",key:"render",value:function(){if(!this._config||!this.hass)return o.Ld;let t;return this._config.image_entity&&(t=this.hass.states[this._config.image_entity]),o.dy` <hui-image .hass="${this.hass}" .entity="${this._config.entity}" .image="${t?(0,c.U)(t):this._config.image}" .stateImage="${this._config.state_image}" .cameraImage="${this._config.camera_image}" .cameraView="${this._config.camera_view}" .filter="${this._config.filter}" .stateFilter="${this._config.state_filter}" .title="${(0,r.$)(this.hass,this._config)}" .aspectRatio="${this._config.aspect_ratio}" .darkModeImage="${this._config.dark_mode_image}" .darkModeFilter="${this._config.dark_mode_filter}" @action="${this._handleAction}" .actionHandler="${(0,d.K)({hasHold:(0,h._)(this._config.hold_action),hasDoubleClick:(0,h._)(this._config.double_tap_action)})}" tabindex="${(0,s.o)((0,h._)(this._config.tap_action)?"0":void 0)}"></hui-image> `}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host(.clickable){cursor:pointer;overflow:hidden;-webkit-touch-callout:none!important}hui-image{-webkit-user-select:none!important}hui-image:focus{outline:0;background:var(--divider-color);border-radius:100%}`},{kind:"method",key:"_handleAction",value:function(t){(0,l.G)(this,this.hass,this._config,t.detail.action)}}]}}),o.oi);e()}catch(t){e(t)}}))},15367:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(44249),o=i(57243),a=i(15093),s=i(75034),c=t([s]);s=(c.then?(await c)():c)[0];(0,n.Z)([(0,a.Mo)("hui-service-button-element")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await Promise.all([i.e("46379"),i.e("24199"),i.e("27506"),i.e("78823"),i.e("89816")]).then(i.bind(i,72007)),document.createElement("hui-service-button-element-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(t){return{type:"action-button",action:"homeassistant.turn_on",title:t.localize("ui.card.common.turn_on")}}},{kind:"field",key:"hass",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_config",value:void 0},{kind:"field",key:"_domain",value:void 0},{kind:"field",key:"_service",value:void 0},{kind:"method",key:"setConfig",value:function(t){if(!t||!t.action&&!t.service)throw Error("Action required");if([this._domain,this._service]=(t.action??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}},{kind:"method",key:"render",value:function(){if(!this._config||!this.hass)return o.Ld;const{entity_id:t,label_id:e,floor_id:i,device_id:n,area_id:a}=this._config.service_data??this._config.data??{},s=this._config.target??{entity_id:t,label_id:e,floor_id:i,device_id:n,area_id:a};return o.dy` <ha-call-service-button .hass="${this.hass}" .domain="${this._domain}" .service="${this._service}" .data="${this._config.data??this._config.service_data}" .target="${s}"> ${this._config.title} </ha-call-service-button> `}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`ha-call-service-button{color:var(--primary-color);white-space:nowrap}`}]}}),o.oi);e()}catch(t){e(t)}}))},56332:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(44249),o=i(57243),a=i(15093),s=i(20552),c=i(69223),r=i(47194),d=i(78555),l=i(3967),h=i(1617),u=i(5684),f=i(96194),_=i(93331),g=i(62577),m=(i(76986),t([d]));d=(m.then?(await m)():m)[0];(0,n.Z)([(0,a.Mo)("hui-state-badge-element")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await i.e("3674").then(i.bind(i,74010)),document.createElement("hui-state-badge-element-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(t,e,i){return{type:"state-badge",entity:(0,c.j)(t,1,e,i,["light","switch","sensor"],(t=>!(0,f.rk)(t.state)))[0]||""}}},{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.entity)throw Error("Entity required");this._config={tap_action:{action:"more-info"},...t}}},{kind:"method",key:"shouldUpdate",value:function(t){return(0,_.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` <ha-state-label-badge .hass="${this.hass}" .state="${t}" .title="${void 0===this._config.title?(0,r.C)(t):null===this._config.title?"":this._config.title}" show-name @action="${this._handleAction}" .actionHandler="${(0,l.K)({hasHold:(0,u._)(this._config.hold_action),hasDoubleClick:(0,u._)(this._config.double_tap_action)})}" tabindex="${(0,s.o)((0,u._)(this._config.tap_action)?"0":void 0)}"></ha-state-label-badge> `:o.dy` <hui-warning-element .label="${(0,g.i)(this.hass,this._config.entity)}"></hui-warning-element> `}},{kind:"method",key:"_handleAction",value:function(t){(0,h.G)(this,this.hass,this._config,t.detail.action)}}]}}),o.oi);e()}catch(t){e(t)}}))},13888:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(44249),o=i(57243),a=i(15093),s=i(20552),c=i(69223),r=i(5460),d=i(84674),l=i(3967),h=i(1617),u=i(5684),f=i(96194),_=i(93331),g=i(62577),m=(i(76986),t([r]));r=(m.then?(await m)():m)[0];(0,n.Z)([(0,a.Mo)("hui-state-icon-element")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await i.e("80766").then(i.bind(i,66943)),document.createElement("hui-state-icon-element-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(t,e,i){return{type:"state-icon",entity:(0,c.j)(t,1,e,i,["light","switch","sensor"],(t=>!(0,f.rk)(t.state)))[0]||""}}},{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.entity)throw Error("Entity required");this._config={state_color:!0,tap_action:{action:"more-info"},...t}}},{kind:"method",key:"shouldUpdate",value:function(t){return(0,_.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` <state-badge .hass="${this.hass}" .stateObj="${t}" .title="${(0,d.$)(this.hass,this._config)}" @action="${this._handleAction}" .actionHandler="${(0,l.K)({hasHold:(0,u._)(this._config.hold_action),hasDoubleClick:(0,u._)(this._config.double_tap_action)})}" tabindex="${(0,s.o)((0,u._)(this._config.tap_action)?"0":void 0)}" .overrideIcon="${this._config.icon}" .stateColor="${this._config.state_color}"></state-badge> `:o.dy` <hui-warning-element .label="${(0,g.i)(this.hass,this._config.entity)}"></hui-warning-element> `}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{cursor:pointer}state-badge:focus{outline:0;background:var(--divider-color);border-radius:100%}`},{kind:"method",key:"_handleAction",value:function(t){(0,h.G)(this,this.hass,this._config,t.detail.action)}}]}}),o.oi);e()}catch(t){e(t)}}))},9427:function(t,e,i){var n=i(44249),o=i(57243),a=i(15093),s=i(20552),c=i(69223),r=i(84674),d=i(3967),l=i(1617),h=i(5684),u=i(96194),f=i(93331),_=i(62577);i(76986);(0,n.Z)([(0,a.Mo)("hui-state-label-element")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await i.e("25813").then(i.bind(i,66831)),document.createElement("hui-state-label-element-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(t,e,i){return{type:"state-label",entity:(0,c.j)(t,1,e,i,["light","switch","sensor"],(t=>!(0,u.rk)(t.state)))[0]||""}}},{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.entity)throw Error("Entity required");this._config={tap_action:{action:"more-info"},...t}}},{kind:"method",key:"shouldUpdate",value:function(t){return(0,f.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?this._config.attribute&&!(this._config.attribute in t.attributes)?o.dy` <hui-warning-element label="${this.hass.localize("ui.panel.lovelace.warning.attribute_not_found",{attribute:this._config.attribute,entity:this._config.entity})}"></hui-warning-element> `:o.dy` <div .title="${(0,r.$)(this.hass,this._config)}" @action="${this._handleAction}" .actionHandler="${(0,d.K)({hasHold:(0,h._)(this._config.hold_action),hasDoubleClick:(0,h._)(this._config.double_tap_action)})}" tabindex="${(0,s.o)((0,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} </div> `:o.dy` <hui-warning-element .label="${(0,_.i)(this.hass,this._config.entity)}"></hui-warning-element> `}},{kind:"method",key:"_handleAction",value:function(t){(0,l.G)(this,this.hass,this._config,t.detail.action)}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{cursor:pointer}div{padding:8px;white-space:nowrap}div:focus{outline:0;background:var(--divider-color);border-radius:100%}`}]}}),o.oi)}}; //# sourceMappingURL=3371.f156d35ebd81637c.js.map