iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 17.6 kB
JavaScript
export const __webpack_ids__=["29354"];export const __webpack_modules__={97547:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{c:()=>g,computeStateDisplay:()=>m});var a=n(96194),o=n(20382),r=n(54363),s=n(46467),l=n(64214),d=n(33570),c=n(50602),h=n(87974),b=n(73850),u=e([r,c,s,d,l]);[r,c,s,d,l]=u.then?(await u)():u;const m=(e,t,n,i,a,o,r)=>{const s=o?.[t.entity_id];return g(e,n,i,a,s,t.entity_id,t.attributes,void 0!==r?r:t.state)},g=(e,t,n,i,u,m,g,p)=>{if(p===a.lz||p===a.nZ)return e(`state.default.${p}`);const y=(0,b.M)(m),f="counter"===y||"number"===y||"input_number"===y;if((0,c.sJ)(g,"sensor"===y?n:[])||f){if("duration"===g.device_class&&g.unit_of_measurement&&r.a_.includes(g.unit_of_measurement))try{return(0,r.LU)(t,p,g.unit_of_measurement,u?.display_precision)}catch(e){}if("monetary"===g.device_class)try{return(0,c.uf)(p,t,{style:"currency",currency:g.unit_of_measurement,minimumFractionDigits:2,...(0,c.l4)({state:p,attributes:g},u)})}catch(e){}const n=(0,c.uf)(p,t,(0,c.l4)({state:p,attributes:g},u)),i=u?.translation_key&&e(`component.${u.platform}.entity.${y}.${u.translation_key}.unit_of_measurement`)||g.unit_of_measurement;return i?`${n}${(0,h.L)(i,t)}${i}`:n}if(["date","input_datetime","time"].includes(y))try{const e=p.split(" ");if(2===e.length)return(0,l.o0)(new Date(e.join("T")),{...t,time_zone:o.c_.local},i);if(1===e.length){if(p.includes("-"))return(0,s.p6)(new Date(`${p}T00:00`),{...t,time_zone:o.c_.local},i);if(p.includes(":")){const e=new Date;return(0,d.mr)(new Date(`${e.toISOString().split("T")[0]}T${p}`),{...t,time_zone:o.c_.local},i)}}return p}catch(e){return p}if(["button","conversation","event","image","input_button","notify","scene","stt","tag","tts","wake_word","datetime"].includes(y)||"sensor"===y&&"timestamp"===g.device_class)try{return(0,l.o0)(new Date(p),t,i)}catch(e){return p}return u?.translation_key&&e(`component.${u.platform}.entity.${y}.${u.translation_key}.state.${p}`)||g.device_class&&e(`component.${y}.entity_component.${g.device_class}.state.${p}`)||e(`component.${y}.entity_component._.state.${p}`)||p};i()}catch(e){i(e)}}))},29775:function(e,t,n){var i=n(44249),a=n(57243),o=n(15093),r=n(35359),s=n(20552);n(30043);(0,i.Z)([(0,o.Mo)("ha-badge")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)()],key:"type",value:()=>"badge"},{kind:"field",decorators:[(0,o.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"icon-only"})],key:"iconOnly",value:()=>!1},{kind:"method",key:"render",value:function(){const e=this.label;return a.dy` <div class="badge ${(0,r.$)({"icon-only":this.iconOnly})}" role="${(0,s.o)("button"===this.type?"button":void 0)}" tabindex="${(0,s.o)("button"===this.type?"0":void 0)}"> <ha-ripple .disabled="${"button"!==this.type}"></ha-ripple> <slot name="icon"></slot> ${this.iconOnly?a.Ld:a.dy`<span class="info"> ${e?a.dy`<span class="label">${e}</span>`:a.Ld} <span class="content"><slot></slot></span> </span>`} </div> `}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`:host{--badge-color:var(--secondary-text-color);-webkit-tap-highlight-color:transparent}.badge{position:relative;--ha-ripple-color:var(--badge-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12;transition:box-shadow 180ms ease-in-out,border-color 180ms ease-in-out;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:8px;height:var(--ha-badge-size,36px);min-width:var(--ha-badge-size,36px);padding:0px 12px;box-sizing:border-box;width:auto;border-radius:var(--ha-badge-border-radius,calc(var(--ha-badge-size,36px)/ 2));background:var(--ha-card-background,var(--card-background-color,#fff));-webkit-backdrop-filter:var(--ha-card-backdrop-filter,none);backdrop-filter:var(--ha-card-backdrop-filter,none);border-width:var(--ha-card-border-width,1px);box-shadow:var(--ha-card-box-shadow,none);border-style:solid;border-color:var(--ha-card-border-color,var(--divider-color,#e0e0e0))}.badge:focus-visible{--shadow-default:var(--ha-card-box-shadow, 0 0 0 0 transparent);--shadow-focus:0 0 0 1px var(--badge-color);border-color:var(--badge-color);box-shadow:var(--shadow-default),var(--shadow-focus)}[role=button]{cursor:pointer}[role=button]:focus{outline:0}.info{display:flex;flex-direction:column;align-items:flex-start;padding-inline-start:initial;text-align:center}.label{font-size:10px;font-style:normal;font-weight:500;line-height:10px;letter-spacing:.1px;color:var(--secondary-text-color)}.content{font-size:12px;font-style:normal;font-weight:500;line-height:16px;letter-spacing:.1px;color:var(--primary-text-color)}::slotted([slot=icon]){--mdc-icon-size:18px;color:var(--badge-color);line-height:0;margin-left:-4px;margin-right:0;margin-inline-start:-4px;margin-inline-end:0}::slotted(img[slot=icon]){width:30px;height:30px;border-radius:50%;object-fit:cover;overflow:hidden;margin-left:-10px;margin-right:0;margin-inline-start:-10px;margin-inline-end:0}.badge.icon-only{padding:0}.badge.icon-only ::slotted([slot=icon]){margin-left:0;margin-right:0;margin-inline-start:0;margin-inline-end:0}`}]}}),a.oi)},88991:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{S:()=>l,ST:()=>c,n3:()=>d});var a=n(59847),o=n(81530),r=e([o]);o=(r.then?(await r)():r)[0];const s={alarm_control_panel:()=>n.e("62410").then(n.bind(n,80875)),automation:()=>n.e("98368").then(n.bind(n,13592)),camera:()=>n.e("11569").then(n.bind(n,17712)),climate:()=>Promise.all([n.e("41258"),n.e("21728")]).then(n.bind(n,5192)),configurator:()=>Promise.all([n.e("46379"),n.e("2981"),n.e("16649")]).then(n.bind(n,10080)),conversation:()=>Promise.all([n.e("46379"),n.e("51229"),n.e("59176")]).then(n.bind(n,93726)),counter:()=>n.e("25510").then(n.bind(n,32441)),cover:()=>n.e("78402").then(n.bind(n,72869)),date:()=>Promise.all([n.e("46379"),n.e("41258"),n.e("3561"),n.e("64836")]).then(n.bind(n,6560)),datetime:()=>Promise.all([n.e("46379"),n.e("41258"),n.e("3134"),n.e("3561"),n.e("74040")]).then(n.bind(n,11348)),fan:()=>n.e("88973").then(n.bind(n,54764)),group:()=>Promise.all([n.e("46379"),n.e("41258"),n.e("99287"),n.e("1916"),n.e("81407")]).then(n.bind(n,96771)),humidifier:()=>n.e("66881").then(n.bind(n,9198)),image:()=>n.e("89870").then(n.bind(n,37093)),input_boolean:()=>n.e("64783").then(n.bind(n,85742)),input_datetime:()=>Promise.all([n.e("46379"),n.e("41258"),n.e("3561"),n.e("73561")]).then(n.bind(n,68377)),lawn_mower:()=>n.e("49").then(n.bind(n,31650)),light:()=>n.e("55815").then(n.bind(n,59031)),lock:()=>n.e("51539").then(n.bind(n,1563)),media_player:()=>Promise.all([n.e("41258"),n.e("8656")]).then(n.bind(n,99091)),person:()=>Promise.all([n.e("35637"),n.e("49554"),n.e("73565")]).then(n.bind(n,86554)),remote:()=>Promise.all([n.e("41258"),n.e("2600")]).then(n.bind(n,92081)),script:()=>Promise.all([n.e("46379"),n.e("24199"),n.e("27506"),n.e("99287"),n.e("2981"),n.e("78823"),n.e("13395")]).then(n.bind(n,74358)),siren:()=>n.e("34404").then(n.bind(n,86534)),sun:()=>n.e("8373").then(n.bind(n,55421)),switch:()=>n.e("50728").then(n.bind(n,56985)),time:()=>Promise.all([n.e("46379"),n.e("41258"),n.e("3561"),n.e("52137")]).then(n.bind(n,16347)),timer:()=>n.e("14597").then(n.bind(n,42971)),update:()=>Promise.all([n.e("5080"),n.e("2981"),n.e("49016"),n.e("79195"),n.e("9524")]).then(n.bind(n,51077)),vacuum:()=>Promise.all([n.e("41258"),n.e("29453")]).then(n.bind(n,61372)),valve:()=>n.e("60455").then(n.bind(n,20973)),water_heater:()=>n.e("80518").then(n.bind(n,60054)),weather:()=>Promise.all([n.e("99287"),n.e("15722"),n.e("85078")]).then(n.bind(n,95818))},l=e=>{const t=(0,a.N)(e);return d(t)},d=e=>o.l.includes(e)?e:o.tm.includes(e)?"hidden":"default",c=e=>{e in s&&s[e]()};i()}catch(e){i(e)}}))},88693:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{K1:()=>D,ak:()=>x,fp:()=>C,g5:()=>z});var a=n(44249),o=n(57243),r=n(15093),s=n(35359),l=n(69634),d=n(27486),c=n(75011),h=n(11259),b=n(73850),u=n(59847),m=n(47194),g=n(5839),p=n(42818),y=(n(29775),n(30043),n(51223)),f=(n(37583),n(99650)),_=n(3967),v=n(69223),w=n(1617),k=n(5684),$=e([y]);y=($.then?(await $)():$)[0];const P="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",x=["minimal","standard","complete"],z={type:"entity",show_name:!1,show_state:!0,show_icon:!0},C=e=>{const t={...e};return e.display_type&&(void 0===e.show_name&&"complete"===e.display_type&&(t.show_name=!0),void 0===e.show_state&&"minimal"===e.display_type&&(t.show_state=!1),delete t.display_type),t};let D=(0,a.Z)([(0,r.Mo)("hui-entity-badge")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await Promise.all([n.e("79931"),n.e("3371"),n.e("95444"),n.e("40955"),n.e("72931")]).then(n.bind(n,38717)),document.createElement("hui-entity-badge-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(e,t,n){return{type:"entity",entity:(0,v.j)(e,1,t,n,["sensor","light","switch"])[0]||""}}},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(e){this._config={...z,...C(e)}}},{kind:"get",key:"hasAction",value:function(){return!this._config?.tap_action||(0,k._)(this._config?.tap_action)||(0,k._)(this._config?.hold_action)||(0,k._)(this._config?.double_tap_action)}},{kind:"field",key:"_computeStateColor",value:()=>(0,d.Z)(((e,t)=>{if(t)return(0,g.v)(e)?(0,c.I)(t):void 0;if("light"===(0,b.M)(e.entity_id)&&e.attributes.rgb_color){const t=(0,h.DM)(e.attributes.rgb_color);return t[1]<.4&&(t[1]<.1?t[2]=225:t[1]=.4),(0,h.CO)((0,h.XG)(t))}return(0,p.Hh)(e)}))},{kind:"method",key:"_getImageUrl",value:function(e){const t=e.attributes.entity_picture_local||e.attributes.entity_picture;if(!t)return;let n=this.hass.hassUrl(t);return"camera"===(0,u.N)(e)&&(n=(0,f.Ch)(n,32,32)),n}},{kind:"method",key:"render",value:function(){if(!this._config||!this.hass)return o.Ld;const e=this._config.entity,t=e?this.hass.states[e]:void 0;if(!t)return o.dy` <ha-badge .label="${e}" class="error"> <ha-svg-icon slot="icon" .hass="${this.hass}" .path="${P}"></ha-svg-icon> ${this.hass.localize("ui.badge.entity.not_found")} </ha-badge> `;const n=(0,g.v)(t),i={"--badge-color":this._computeStateColor(t,this._config.color)},a=o.dy` <state-display .stateObj="${t}" .hass="${this.hass}" .content="${this._config.state_content}" .name="${this._config.name}"> </state-display> `,r=this._config.name||(0,m.C)(t),d=this._config.show_state,c=this._config.show_name,h=this._config.show_icon,b=this._config.show_entity_picture?this._getImageUrl(t):void 0,u=d&&c?r:void 0,p=d?a:c?r:void 0;return o.dy` <ha-badge .type="${this.hasAction?"button":"badge"}" @action="${this._handleAction}" .actionHandler="${(0,_.K)({hasHold:(0,k._)(this._config.hold_action),hasDoubleClick:(0,k._)(this._config.double_tap_action)})}" .label="${u}" .iconOnly="${!p}" style="${(0,l.V)(i)}" class="${(0,s.$)({active:n})}"> ${h?b?o.dy`<img slot="icon" src="${b}" aria-hidden>`:o.dy` <ha-state-icon slot="icon" .hass="${this.hass}" .stateObj="${t}" .icon="${this._config.icon}"></ha-state-icon> `:o.Ld} ${p} </ha-badge> `}},{kind:"method",key:"_handleAction",value:function(e){(0,w.G)(this,this.hass,this._config,e.detail.action)}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`ha-badge{--badge-color:var(--state-inactive-color)}ha-badge.error{--badge-color:var(--red-color)}ha-badge.active{--badge-color:var(--primary-color)}`}]}}),o.oi);i()}catch(e){i(e)}}))},62037:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{Do:()=>v,Z6:()=>_,l$:()=>f});n(92519),n(42179),n(89256),n(24931),n(88463),n(57449),n(19814);var a=n(28113),o=n(49e3),r=(n(3613),n(49025),n(3709)),s=n(49461),l=n(27526),d=n(88374),c=n(59913),h=n(40598),b=n(53251),u=n(50625),m=n(40249),g=e([a,o,r,s,l,d,c,h,b,u]);[a,o,r,s,l,d,c,h,b,u]=g.then?(await g)():g;const p=new Set(["entity","entities","button","entity-button","glance","grid","section","light","sensor","thermostat","weather-forecast","tile","heading"]),y={"alarm-panel":()=>Promise.all([n.e("46379"),n.e("84269")]).then(n.bind(n,40036)),area:()=>Promise.all([n.e("79931"),n.e("37910")]).then(n.bind(n,82820)),calendar:()=>Promise.all([n.e("41103"),n.e("49016"),n.e("78018"),n.e("45898"),n.e("49312")]).then(n.bind(n,18377)),conditional:()=>n.e("8715").then(n.bind(n,22194)),"empty-state":()=>n.e("18248").then(n.bind(n,98962)),"energy-compare":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("15590")]).then(n.bind(n,54586)),"energy-carbon-consumed-gauge":()=>Promise.all([n.e("99287"),n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("32654")]).then(n.bind(n,67790)),"energy-date-selection":()=>Promise.all([n.e("46379"),n.e("3134"),n.e("28612"),n.e("12767"),n.e("11012"),n.e("72743"),n.e("27232"),n.e("62058")]).then(n.bind(n,23893)),"energy-devices-graph":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("87593"),n.e("87969")]).then(n.bind(n,18709)),"energy-devices-detail-graph":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("41163"),n.e("72743"),n.e("87593"),n.e("63697")]).then(n.bind(n,36681)),"energy-distribution":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("16160")]).then(n.bind(n,93892)),"energy-gas-graph":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("41163"),n.e("72743"),n.e("87593"),n.e("61217")]).then(n.bind(n,74257)),"energy-water-graph":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("41163"),n.e("72743"),n.e("87593"),n.e("19764")]).then(n.bind(n,52081)),"energy-grid-neutrality-gauge":()=>Promise.all([n.e("99287"),n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("90564")]).then(n.bind(n,4117)),"energy-solar-consumed-gauge":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("84464")]).then(n.bind(n,33637)),"energy-self-sufficiency-gauge":()=>Promise.all([n.e("99287"),n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("43752")]).then(n.bind(n,70477)),"energy-solar-graph":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("41163"),n.e("72743"),n.e("87593"),n.e("85745")]).then(n.bind(n,63)),"energy-sources-table":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("66018"),n.e("72743"),n.e("21483")]).then(n.bind(n,74549)),"energy-usage-graph":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("41163"),n.e("72743"),n.e("87593"),n.e("51171")]).then(n.bind(n,32672)),"energy-sankey":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("50382"),n.e("3707"),n.e("72743"),n.e("87593"),n.e("64409")]).then(n.bind(n,10782)),"entity-filter":()=>n.e("94369").then(n.bind(n,91308)),error:()=>n.e("37269").then(n.bind(n,53257)),gauge:()=>n.e("40389").then(n.bind(n,10188)),"history-graph":()=>Promise.all([n.e("50382"),n.e("77535"),n.e("87593"),n.e("6473"),n.e("34815")]).then(n.bind(n,26799)),"horizontal-stack":()=>n.e("94618").then(n.bind(n,41023)),humidifier:()=>n.e("6892").then(n.bind(n,18344)),iframe:()=>n.e("47473").then(n.bind(n,28528)),logbook:()=>Promise.all([n.e("65499"),n.e("3098")]).then(n.bind(n,18573)),map:()=>Promise.all([n.e("35637"),n.e("49554"),n.e("13740")]).then(n.bind(n,11823)),markdown:()=>Promise.all([n.e("2981"),n.e("34172")]).then(n.bind(n,91713)),clock:()=>n.e("64153").then(n.bind(n,91502)),"media-control":()=>Promise.all([n.e("24061"),n.e("59105")]).then(n.bind(n,78793)),"picture-elements":()=>Promise.all([n.e("79931"),n.e("3371"),n.e("10745"),n.e("71683")]).then(n.bind(n,31221)),"picture-entity":()=>Promise.all([n.e("79931"),n.e("14517")]).then(n.bind(n,54529)),"picture-glance":()=>Promise.all([n.e("79931"),n.e("99457")]).then(n.bind(n,57733)),picture:()=>n.e("23339").then(n.bind(n,69773)),"plant-status":()=>n.e("63519").then(n.bind(n,84255)),"recovery-mode":()=>Promise.all([n.e("5080"),n.e("50408"),n.e("837"),n.e("31664"),n.e("39124")]).then(n.bind(n,34713)),"todo-list":()=>Promise.all([n.e("46379"),n.e("41258"),n.e("2981"),n.e("81119")]).then(n.bind(n,33841)),"shopping-list":()=>Promise.all([n.e("46379"),n.e("41258"),n.e("2981"),n.e("81119"),n.e("91480")]).then(n.bind(n,28081)),starting:()=>n.e("32197").then(n.bind(n,50957)),"statistics-graph":()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("51062")]).then(n.bind(n,56615)),statistic:()=>Promise.all([n.e("3134"),n.e("28612"),n.e("12767"),n.e("72743"),n.e("92692")]).then(n.bind(n,98578)),"vertical-stack":()=>n.e("13157").then(n.bind(n,73753))},f=e=>(0,m.Xm)("card",e,p,y,void 0,void 0),_=e=>(0,m.Tw)("card",e,p,y,void 0,void 0),v=e=>(0,m.ED)(e,"card",p,y);i()}catch(e){i(e)}}))},64830:function(e,t,n){n.d(t,{Q:()=>r,t:()=>o});var i=n(40249);const a={picture:()=>n.e("64167").then(n.bind(n,75142)),buttons:()=>Promise.all([n.e("59821"),n.e("65970")]).then(n.bind(n,46667)),graph:()=>n.e("87828").then(n.bind(n,43403))},o=e=>(0,i.Tw)("header-footer",e,void 0,a,void 0,void 0),r=e=>(0,i.ED)(e,"header-footer",void 0,a)},52032:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{w:()=>b});n(92519),n(42179),n(89256),n(24931),n(88463),n(57449),n(19814);var a=n(35729),o=(n(83442),n(92263)),r=n(15367),s=n(56332),l=n(13888),d=(n(9427),n(40249)),c=e([a,o,r,s,l]);[a,o,r,s,l]=c.then?(await c)():c;const h=new Set(["conditional","icon","image","service-button","state-badge","state-icon","state-label"]),b=e=>("action-button"===e.type&&(e={...e,type:"service-button"}),(0,d.Tw)("element",e,h));i()}catch(e){i(e)}}))}};
//# sourceMappingURL=29354.796fbb0ccb734e12.js.map