iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 13.8 kB
JavaScript
export const __rspack_esm_id=3650;export const __rspack_esm_ids=[3650];export const __webpack_modules__={66639(e,t,a){a.d(t,{Vu:()=>o,Xz:()=>i,cs:()=>n});a(44114),a(18111),a(61701),a(45367),a(92731);const n=(e,t)=>{const a=new Map,n=[];for(const e of t)e.floor_id?(a.has(e.floor_id)||a.set(e.floor_id,[]),a.get(e.floor_id).push(e.area_id)):n.push(e.area_id);return{floors:e.map(e=>({id:e.floor_id,areas:a.get(e.floor_id)||[]})),areas:n}},i=e=>{const t=[];for(const a of e.floors)t.push(...a.areas);return t.push(...e.areas),t},o=e=>e.floors.map(e=>e.id)},18198(e,t,a){a.d(t,{Dc:()=>r,Si:()=>s});var n=a(62826),i=a(5124),o=a(22441);a(47680),a(67094);const s=e=>{switch(e.level){case 0:return"M11,10H13V16H11V10M22,12H19V20H5V12H2L12,3L22,12M15,10A2,2 0 0,0 13,8H11A2,2 0 0,0 9,10V16A2,2 0 0,0 11,18H13A2,2 0 0,0 15,16V10Z";case 1:return"M12,3L2,12H5V20H19V12H22L12,3M10,8H14V18H12V10H10V8Z";case 2:return"M12,3L2,12H5V20H19V12H22L12,3M9,8H13A2,2 0 0,1 15,10V12A2,2 0 0,1 13,14H11V16H15V18H9V14A2,2 0 0,1 11,12H13V10H9V8Z";case 3:return"M12,3L22,12H19V20H5V12H2L12,3M15,11.5V10C15,8.89 14.1,8 13,8H9V10H13V12H11V14H13V16H9V18H13A2,2 0 0,0 15,16V14.5A1.5,1.5 0 0,0 13.5,13A1.5,1.5 0 0,0 15,11.5Z";case-1:return"M12,3L2,12H5V20H19V12H22L12,3M11,15H7V13H11V15M15,18H13V10H11V8H15V18Z"}return"M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z"},r=e=>{switch(e.level){case 0:return"mdi:home-floor-0";case 1:return"mdi:home-floor-1";case 2:return"mdi:home-floor-2";case 3:return"mdi:home-floor-3";case-1:return"mdi:home-floor-negative-1"}return"mdi:home"};class c extends i.WF{render(){if(!this.floor)return i.s6;if(this.floor.icon)return i.qy`<ha-icon .icon="${this.floor.icon}"></ha-icon>`;const e=s(this.floor);return i.qy`<ha-svg-icon .path="${e}"></ha-svg-icon>`}}(0,n.Cg)([(0,o.MZ)({attribute:!1})],c.prototype,"floor",void 0),(0,n.Cg)([(0,o.MZ)()],c.prototype,"icon",void 0),c=(0,n.Cg)([(0,o.EM)("ha-floor-icon")],c)},73026(e,t,a){a.a(e,async function(e,n){try{a.r(t),a.d(t,{ClimateViewStrategy:()=>y,climateEntityFilters:()=>h});a(44114),a(18111),a(22489);var i=a(62826),o=a(5124),s=a(22441),r=a(66639),c=a(4423),l=a(18198),d=a(39985),g=e([d]);d=(g.then?(await g)():g)[0];const h=[{domain:"climate",entity_category:"none"},{domain:"humidifier",entity_category:"none"},{domain:"fan",entity_category:"none"},{domain:"water_heater",entity_category:"none"},{domain:"cover",device_class:["awning","blind","curtain","shade","shutter","window","none"],entity_category:"none"},{domain:"binary_sensor",device_class:["window"],entity_category:"none"}],p=(e,t,a)=>{const n=[],i=(0,d.L8)(t,"",!0);for(const o of e){const e=t.areas[o];if(!e)continue;const s=(0,c.r)(t,{area:e.area_id}),r=a.filter(s),l=[],d=e.temperature_entity_id;d&&t.states[d]&&l.push({...i(d),name:t.localize("component.sensor.entity_component.temperature.name")||"Temperature",features:[{type:"trend-graph"}]});const g=e.humidity_entity_id;g&&t.states[g]&&l.push({...i(g),name:t.localize("component.sensor.entity_component.humidity.name")||"Humidity",features:[{type:"trend-graph"}]});for(const e of r){if(e===d||e===g)continue;const a=t.states[e];"temperature"===a?.attributes.device_class||"humidity"===a?.attributes.device_class?l.push({...i(e),features:[{type:"trend-graph"}]}):l.push(i(e))}l.length>0&&(n.push({heading_style:"subtitle",type:"heading",heading:e.name,tap_action:t.panels.home?{action:"navigate",navigation_path:`/home/areas-${e.area_id}`}:void 0}),n.push(...l))}return n},u=(e,t)=>{const a=(0,c.r)(e,{area:null}),n=t.filter(a),i=[],o=(0,d.L8)(e,"",!0);for(const e of n)i.push(o(e));return i};class y extends o.mN{static async generate(e,t){const a=Object.values(t.areas),n=Object.values(t.floors),i=(0,r.cs)(n,a),o=[],s=Object.keys(t.states),d=h.map(e=>(0,c.r)(t,e)),g=(0,c.B)(s,d),y=i.floors.length+(i.areas.length?1:0);for(const e of i.floors){const a=e.id,n=e.areas,i=t.floors[a],s={type:"grid",column_span:2,cards:[{type:"heading",heading:y>1?i.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:i.icon||(0,l.Dc)(i)}]},r=p(n,t,g);r.length>0&&(s.cards.push(...r),o.push(s))}if(i.areas.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:y>1?t.localize("ui.panel.lovelace.strategy.home.other_areas"):t.localize("ui.panel.lovelace.strategy.home.areas")}]},a=p(i.areas,t,g);a.length>0&&(e.cards.push(...a),o.push(e))}const m=u(t,g);if(m.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:o.length>0?t.localize("ui.panel.lovelace.strategy.climate.other_devices"):t.localize("ui.panel.lovelace.strategy.climate.devices")},...m]};o.push(e)}return{type:"sections",max_columns:2,sections:o}}}y=(0,i.Cg)([(0,s.EM)("climate-view-strategy")],y),n()}catch(e){n(e)}})},71776(e,t,a){a.a(e,async function(e,n){try{a.r(t),a.d(t,{LightViewStrategy:()=>m,lightEntityFilters:()=>p});a(44114),a(18111),a(22489),a(61701);var i=a(62826),o=a(5124),s=a(22441),r=a(66639),c=a(4423),l=a(18198),d=a(39985),g=a(7723),h=e([d]);d=(h.then?(await h)():h)[0];const p=[{domain:"light",entity_category:"none"}],u=(e,t,a)=>{const n=[];for(const i of e){const e=t.areas[i];if(!e)continue;const o=(0,c.r)(t,{area:e.area_id}),s=a.filter(o),r=[],l=(0,d.L8)(t,"",!1);for(const e of s)r.push(l(e));if(r.length>0){const a={condition:"or",conditions:s.map(e=>({condition:"state",entity:e,state:"on"}))};n.push({heading_style:"subtitle",type:"heading",heading:e.name,tap_action:t.panels.home?{action:"navigate",navigation_path:`/home/areas-${e.area_id}`}:void 0,badges:[{type:"button",icon:"mdi:power",text:t.localize("ui.panel.lovelace.strategy.light.off"),tap_action:{action:"perform-action",perform_action:"light.turn_on",target:{area_id:e.area_id}},visibility:[g.B,{condition:"not",conditions:[a]}]},{type:"button",icon:"mdi:power",color:"orange",text:t.localize("ui.panel.lovelace.strategy.light.on"),tap_action:{action:"perform-action",perform_action:"light.turn_off",target:{area_id:e.area_id}},visibility:[g.B,a]}]}),n.push({type:"toggle-group",color:"amber",entities:s,visibility:[g.r],grid_options:{columns:6,rows:1}}),r.forEach(e=>{r.indexOf(e)%3==0&&0!==r.indexOf(e)&&n.push({type:"vertical-stack",cards:[],visibility:[g.r],grid_options:{columns:6,rows:1}}),n.push(e)})}}return n},y=(e,t)=>{const a=(0,c.r)(e,{area:null}),n=t.filter(a),i=[],o=(0,d.L8)(e,"",!1);for(const e of n)i.push(o(e));return i};class m extends o.mN{static async generate(e,t){const a=Object.values(t.areas),n=Object.values(t.floors),i=(0,r.cs)(n,a),o=[],s=Object.keys(t.states),d=p.map(e=>(0,c.r)(t,e)),g=(0,c.B)(s,d),h=i.floors.length+(i.areas.length?1:0);for(const e of i.floors){const a=e.id,n=e.areas,i=t.floors[a],s={type:"grid",column_span:2,cards:[{type:"heading",heading:h>1?i.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:i.icon||(0,l.Dc)(i)}]},r=u(n,t,g);r.length>0&&(s.cards.push(...r),o.push(s))}if(i.areas.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:h>1?t.localize("ui.panel.lovelace.strategy.home.other_areas"):t.localize("ui.panel.lovelace.strategy.home.areas")}]},a=u(i.areas,t,g);a.length>0&&(e.cards.push(...a),o.push(e))}const m=y(t,g);if(m.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:o.length>0?t.localize("ui.panel.lovelace.strategy.light.other_lights"):t.localize("ui.panel.lovelace.strategy.light.lights")},...m]};o.push(e)}return{type:"sections",max_columns:2,sections:o}}}m=(0,i.Cg)([(0,s.EM)("light-view-strategy")],m),n()}catch(e){n(e)}})},7723(e,t,a){a.d(t,{B:()=>i,r:()=>n});const n={condition:"view_columns",min:2},i={condition:"view_columns",max:1}},8537(e,t,a){a.a(e,async function(e,n){try{a.d(t,{It:()=>d,lS:()=>l,rh:()=>p,uN:()=>g,vV:()=>h});var i=a(78030),o=a(73026),s=a(71776),r=a(31758),c=e([s,o,r]);[s,o,r]=c.then?(await c)():c;const l=["light","climate","security","media_players","maintenance","energy","persons"],d={light:"mdi:lamps",climate:"mdi:home-thermometer",security:"mdi:security",media_players:"mdi:multimedia",maintenance:"mdi:wrench",energy:"mdi:lightning-bolt",persons:"mdi:account-multiple"},g={light:"amber",climate:"deep-orange",security:"blue-grey",media_players:"blue",maintenance:"grey",energy:"amber",persons:"green"},h={light:s.lightEntityFilters,climate:o.climateEntityFilters,security:r.securityEntityFilters,media_players:[{domain:"media_player",entity_category:"none"}],maintenance:i.maintenanceEntityFilters,energy:[],persons:[{domain:"person"}]},p=(e,t)=>e("light"===t||"climate"===t||"security"===t||"maintenance"===t?`panel.${t}`:`ui.panel.lovelace.strategy.home.summary_list.${t}`);n()}catch(e){n(e)}})},78030(e,t,a){a.r(t),a.d(t,{MaintenanceViewStrategy:()=>y,filterLowBatteryEntities:()=>g,filterUnavailableBatteryEntities:()=>h,maintenanceEntityFilters:()=>d});a(44114),a(18111),a(22489);var n=a(62826),i=a(5124),o=a(22441),s=a(66639),r=a(4423),c=a(18198),l=(a(46190),a(71727));const d=[{domain:"sensor",device_class:["battery"]},{domain:"binary_sensor",device_class:["battery"],entity_category:"none"}],g=(e,t)=>t.filter(t=>{const a=e.states[t]?.state??"";if("binary_sensor"===(0,l.m)(t))return"on"===a;const n=parseFloat(a);return!isNaN(n)&&n<=20}),h=(e,t)=>t.filter(t=>"unavailable"===e.states[t]?.state),p=(e,t)=>{const a=e[t],n=a?.device_id;return{type:"tile",entity:t,name:{type:n?"device":"entity"}}},u=(e,t,a)=>{const n=[];for(const i of e){const e=t.areas[i];if(!e)continue;const o=(0,r.r)(t,{area:e.area_id}),s=a.filter(o),c=[];for(const e of s)c.push(p(t.entities,e));c.length>0&&(n.push({heading_style:"subtitle",type:"heading",heading:e.name,tap_action:t.panels.home?{action:"navigate",navigation_path:`/home/areas-${e.area_id}`}:void 0}),n.push(...c))}return n};class y extends i.mN{static async generate(e,t){const a=Object.values(t.areas),n=Object.values(t.floors),i=(0,s.cs)(n,a),o=[],l=Object.keys(t.states),g=d.map(e=>(0,r.r)(t,e)),h=(0,r.B)(l,g),y=i.floors.length+(i.areas.length?1:0);for(const e of i.floors){const a=e.id,n=e.areas,i=t.floors[a],s={type:"grid",column_span:2,cards:[{type:"heading",heading:y>1?i.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:i.icon||(0,c.Dc)(i)}]},r=u(n,t,h);r.length>0&&(s.cards.push(...r),o.push(s))}if(i.areas.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:y>1?t.localize("ui.panel.lovelace.strategy.maintenance.other_devices"):t.localize("ui.panel.lovelace.strategy.home.areas")}]},a=u(i.areas,t,h);a.length>0&&(e.cards.push(...a),o.push(e))}const m=((e,t)=>{const a=(0,r.r)(e,{area:null}),n=t.filter(a),i=[];for(const t of n)i.push(p(e.entities,t));return i})(t,h);if(m.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:o.length>0?t.localize("ui.panel.lovelace.strategy.maintenance.other_devices"):t.localize("ui.panel.lovelace.strategy.maintenance.devices")},...m]};o.push(e)}return{type:"sections",max_columns:2,sections:o}}}y=(0,n.Cg)([(0,o.EM)("maintenance-view-strategy")],y)},31758(e,t,a){a.a(e,async function(e,n){try{a.r(t),a.d(t,{SecurityViewStrategy:()=>_,securityEntityFilters:()=>u});a(44114),a(18111),a(22489);var i=a(62826),o=a(5124),s=a(22441),r=a(66639),c=a(36312),l=a(4423),d=a(69093),g=a(18198),h=a(39985),p=e([h]);h=(p.then?(await p)():p)[0];const u=[{domain:"camera",entity_category:"none"},{domain:"alarm_control_panel",entity_category:"none"},{domain:"lock",entity_category:"none"},{domain:"cover",device_class:["door","garage","gate","window"],entity_category:"none"},{domain:"binary_sensor",device_class:["lock","door","window","garage_door","opening","carbon_monoxide","gas","moisture","safety","smoke","tamper"],entity_category:"none"},{domain:"binary_sensor",device_class:["tamper"],entity_category:"diagnostic"}],y=(e,t,a)=>{const n=[];for(const i of e){const e=t.areas[i];if(!e)continue;const o=(0,l.r)(t,{area:e.area_id}),s=a.filter(o),r=[],c=(0,h.L8)(t,"",!1);for(const e of s)r.push(c(e));r.length>0&&(n.push({heading_style:"subtitle",type:"heading",heading:e.name,tap_action:t.panels.home?{action:"navigate",navigation_path:`/home/areas-${e.area_id}`}:void 0}),n.push(...r))}return n},m=(e,t)=>{const a=(0,l.r)(e,{area:null}),n=t.filter(a),i=[],o=(0,h.L8)(e,"",!1);for(const e of n)i.push(o(e));return i};class _ extends o.mN{static async generate(e,t){const a=Object.values(t.areas),n=Object.values(t.floors),i=(0,r.cs)(n,a),o=[],s=Object.keys(t.states),h=u.map(e=>(0,l.r)(t,e)),p=(0,l.B)(s,h),_=i.floors.length+(i.areas.length?1:0);for(const e of i.floors){const a=e.id,n=e.areas,i=t.floors[a],s={type:"grid",column_span:2,cards:[{type:"heading",heading:_>1?i.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:i.icon||(0,g.Dc)(i)}]},r=y(n,t,p);r.length>0&&(s.cards.push(...r),o.push(s))}if(i.areas.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:_>1?t.localize("ui.panel.lovelace.strategy.home.other_areas"):t.localize("ui.panel.lovelace.strategy.home.areas")}]},a=y(i.areas,t,p);a.length>0&&(e.cards.push(...a),o.push(e))}const f=m(t,p);if(f.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:o.length>0?t.localize("ui.panel.lovelace.strategy.security.other_devices"):t.localize("ui.panel.lovelace.strategy.security.devices")},...f]};o.push(e)}const v=(0,c.x)(t.config,"logbook"),b=Object.keys(t.states).filter(e=>"person"===(0,d.t)(t.states[e])),H=[...p,...b],V=v&&H.length>0?{type:"grid",cards:[{type:"heading",heading:t.localize("ui.panel.lovelace.strategy.security.activity"),heading_style:"title"},{type:"logbook",target:{entity_id:H},hours_to_show:24,grid_options:{columns:12}}]}:void 0;return{type:"sections",max_columns:3,sections:o,...V&&{sidebar:{sections:[V],content_label:t.localize("ui.panel.lovelace.strategy.security.devices"),sidebar_label:t.localize("ui.panel.lovelace.strategy.security.activity")}}}}}_=(0,i.Cg)([(0,s.EM)("security-view-strategy")],_),n()}catch(e){n(e)}})}};