UNPKG

iobroker.lovelace

Version:

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

2 lines 17.5 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["3371"],{75034:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(61701),o=(i(71695),i(40251),i(47021),i(57243)),a=i(50778),s=i(76131),c=i(29095),r=i(36522),l=t([c]);c=(l.then?(await l)():l)[0];let d,h=t=>t;(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(){return!1}},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"progress",value(){return!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(){return{}}},{kind:"field",decorators:[(0,a.Cb)()],key:"confirmation",value:void 0},{kind:"method",key:"render",value:function(){return(0,o.dy)(d||(d=h` <ha-progress-button .progress="${0}" .disabled="${0}" @click="${0}" tabindex="0"> <slot></slot></ha-progress-button> `),this.progress,this.disabled,this._buttonTapped)}},{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(d){e(d)}}))},44804:function(t,e,i){i.a(t,(async function(t,n){try{i.d(e,{O:()=>c});i(9359),i(31526);var o=i(52032),a=t([o]);function c(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(s){n(s)}}))},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(52247),i(71695),i(92745),i(9359),i(31526),i(40251),i(47021);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(s){e(s)}}))},83442:function(t,e,i){var n=i(61701),o=(i(52247),i(71695),i(19423),i(40251),i(47021),i(57243)),a=i(50778),s=i(20552),c=(i(65981),i(84674)),r=i(3967),l=i(1617),d=i(5684);let h,u,f=t=>t;(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=Object.assign({tap_action:{action:"more-info"}},t)}},{kind:"method",key:"render",value:function(){return this._config&&this.hass?(0,o.dy)(h||(h=f` <ha-icon .icon="${0}" .title="${0}" @action="${0}" .actionHandler="${0}" tabindex="${0}"></ha-icon> `),this._config.icon,(0,c.$)(this.hass,this._config),this._handleAction,(0,r.K)({hasHold:(0,d._)(this._config.hold_action),hasDoubleClick:(0,d._)(this._config.double_tap_action)}),(0,s.o)((0,d._)(this._config.tap_action)?"0":void 0)):o.Ld}},{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(){return(0,o.iv)(u||(u=f`: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(61701),o=(i(52247),i(71695),i(9359),i(56475),i(19423),i(40251),i(47021),i(57243)),a=i(50778),s=i(20552),c=i(72099),r=i(84674),l=i(3967),d=i(1617),h=i(5684),u=i(63848),f=t([u]);u=(f.then?(await f)():f)[0];let _,g,v=t=>t;(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=Object.assign({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]),(0,o.dy)(_||(_=v` <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}" @action="${0}" .actionHandler="${0}" tabindex="${0}"></hui-image> `),this.hass,this._config.entity,t?(0,c.U)(t):this._config.image,this._config.state_image,this._config.camera_image,this._config.camera_view,this._config.filter,this._config.state_filter,(0,r.$)(this.hass,this._config),this._config.aspect_ratio,this._config.dark_mode_image,this._config.dark_mode_filter,this._handleAction,(0,l.K)({hasHold:(0,h._)(this._config.hold_action),hasDoubleClick:(0,h._)(this._config.double_tap_action)}),(0,s.o)((0,h._)(this._config.tap_action)?"0":void 0))}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(g||(g=v`: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,d.G)(this,this.hass,this._config,t.detail.action)}}]}}),o.oi);e()}catch(_){e(_)}}))},15367:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(61701),o=(i(52247),i(71695),i(40251),i(47021),i(57243)),a=i(50778),s=i(75034),c=t([s]);s=(c.then?(await c)():c)[0];let r,l,d=t=>t;(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("78943"),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){var e;if(!t||!t.action&&!t.service)throw Error("Action required");if([this._domain,this._service]=(null!==(e=t.action)&&void 0!==e?e: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(){var t,e,i,n;if(!this._config||!this.hass)return o.Ld;const{entity_id:a,label_id:s,floor_id:c,device_id:l,area_id:h}=null!==(t=null!==(e=this._config.service_data)&&void 0!==e?e:this._config.data)&&void 0!==t?t:{},u=null!==(i=this._config.target)&&void 0!==i?i:{entity_id:a,label_id:s,floor_id:c,device_id:l,area_id:h};return(0,o.dy)(r||(r=d` <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,u,this._config.title)}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(l||(l=d`ha-call-service-button{color:var(--primary-color);white-space:nowrap}`))}}]}}),o.oi);e()}catch(r){e(r)}}))},56332:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(61701),o=(i(52247),i(71695),i(19423),i(40251),i(47021),i(57243)),a=i(50778),s=i(20552),c=i(69223),r=i(47194),l=i(78555),d=i(3967),h=i(1617),u=i(5684),f=i(96194),_=i(93331),g=i(62577),v=(i(76986),t([l]));l=(v.then?(await v)():v)[0];let m,k,y=t=>t;(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=Object.assign({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?(0,o.dy)(k||(k=y` <ha-state-label-badge .hass="${0}" .state="${0}" .title="${0}" show-name @action="${0}" .actionHandler="${0}" tabindex="${0}"></ha-state-label-badge> `),this.hass,t,void 0===this._config.title?(0,r.C)(t):null===this._config.title?"":this._config.title,this._handleAction,(0,d.K)({hasHold:(0,u._)(this._config.hold_action),hasDoubleClick:(0,u._)(this._config.double_tap_action)}),(0,s.o)((0,u._)(this._config.tap_action)?"0":void 0)):(0,o.dy)(m||(m=y` <hui-warning-element .label="${0}"></hui-warning-element> `),(0,g.i)(this.hass,this._config.entity))}},{kind:"method",key:"_handleAction",value:function(t){(0,h.G)(this,this.hass,this._config,t.detail.action)}}]}}),o.oi);e()}catch(m){e(m)}}))},13888:function(t,e,i){i.a(t,(async function(t,e){try{var n=i(61701),o=(i(52247),i(71695),i(19423),i(40251),i(47021),i(57243)),a=i(50778),s=i(20552),c=i(69223),r=i(5460),l=i(84674),d=i(3967),h=i(1617),u=i(5684),f=i(96194),_=i(93331),g=i(62577),v=(i(76986),t([r]));r=(v.then?(await v)():v)[0];let m,k,y,b=t=>t;(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=Object.assign({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?(0,o.dy)(k||(k=b` <state-badge .hass="${0}" .stateObj="${0}" .title="${0}" @action="${0}" .actionHandler="${0}" tabindex="${0}" .overrideIcon="${0}" .stateColor="${0}"></state-badge> `),this.hass,t,(0,l.$)(this.hass,this._config),this._handleAction,(0,d.K)({hasHold:(0,u._)(this._config.hold_action),hasDoubleClick:(0,u._)(this._config.double_tap_action)}),(0,s.o)((0,u._)(this._config.tap_action)?"0":void 0),this._config.icon,this._config.state_color):(0,o.dy)(m||(m=b` <hui-warning-element .label="${0}"></hui-warning-element> `),(0,g.i)(this.hass,this._config.entity))}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(y||(y=b`: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(m){e(m)}}))},9427:function(t,e,i){var n=i(61701),o=(i(52247),i(71695),i(19423),i(40251),i(47021),i(57243)),a=i(50778),s=i(20552),c=i(69223),r=i(84674),l=i(3967),d=i(1617),h=i(5684),u=i(96194),f=i(93331),_=i(62577);i(76986);let g,v,m,k,y=t=>t;(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=Object.assign({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)?(0,o.dy)(v||(v=y` <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,o.dy)(m||(m=y` <div .title="${0}" @action="${0}" .actionHandler="${0}" tabindex="${0}"> ${0}${0}${0} </div> `),(0,r.$)(this.hass,this._config),this._handleAction,(0,l.K)({hasHold:(0,h._)(this._config.hold_action),hasDoubleClick:(0,h._)(this._config.double_tap_action)}),(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):(0,o.dy)(g||(g=y` <hui-warning-element .label="${0}"></hui-warning-element> `),(0,_.i)(this.hass,this._config.entity))}},{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(){return(0,o.iv)(k||(k=y`:host{cursor:pointer}div{padding:8px;white-space:nowrap}div:focus{outline:0;background:var(--divider-color);border-radius:100%}`))}}]}}),o.oi)}}]); //# sourceMappingURL=3371.b8ab57d10bc2f1ae.js.map