UNPKG

iobroker.lovelace

Version:

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

1 lines 14.6 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[3650],{66639:function(e,t,n){n.d(t,{Vu:function(){return o},Xz:function(){return i},cs:function(){return a}});n(44114),n(18111),n(61701),n(45367),n(92731),n(62953);const a=(e,t)=>{const n=new Map,a=[];for(const i of t)i.floor_id?(n.has(i.floor_id)||n.set(i.floor_id,[]),n.get(i.floor_id).push(i.area_id)):a.push(i.area_id);return{floors:e.map(e=>({id:e.floor_id,areas:n.get(e.floor_id)||[]})),areas:a}},i=e=>{const t=[];for(const n of e.floors)t.push(...n.areas);return t.push(...e.areas),t},o=e=>e.floors.map(e=>e.id)},18198:function(e,t,n){n.d(t,{Dc:function(){return u},Si:function(){return l}});var a=n(40445),i=n(5124),o=n(67576);n(47680),n(67094);let s,r,c=e=>e;const l=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"},u=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 d extends i.WF{render(){if(!this.floor)return i.s6;if(this.floor.icon)return(0,i.qy)(s||(s=c`<ha-icon .icon="${0}"></ha-icon>`),this.floor.icon);const e=l(this.floor);return(0,i.qy)(r||(r=c`<ha-svg-icon .path="${0}"></ha-svg-icon>`),e)}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"floor",void 0),(0,a.Cg)([(0,o.MZ)()],d.prototype,"icon",void 0),d=(0,a.Cg)([(0,o.EM)("ha-floor-icon")],d)},73026:function(e,t,n){n.a(e,async function(e,a){try{n.r(t),n.d(t,{ClimateViewStrategy:function(){return y},climateEntityFilters:function(){return g}});n(44114),n(18111),n(22489),n(3362),n(62953);var i=n(40445),o=n(5124),s=n(67576),r=n(66639),c=n(4423),l=n(18198),u=n(39985),d=e([u]);u=(d.then?(await d)():d)[0];const g=[{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"}],h=(e,t,n)=>{const a=[],i=(0,u.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=n.filter(s),l=[],u=e.temperature_entity_id;u&&t.states[u]&&l.push(Object.assign(Object.assign({},i(u)),{},{name:t.localize("component.sensor.entity_component.temperature.name")||"Temperature",features:[{type:"trend-graph"}]}));const d=e.humidity_entity_id;d&&t.states[d]&&l.push(Object.assign(Object.assign({},i(d)),{},{name:t.localize("component.sensor.entity_component.humidity.name")||"Humidity",features:[{type:"trend-graph"}]}));for(const n of r){if(n===u||n===d)continue;const e=t.states[n];"temperature"===(null==e?void 0:e.attributes.device_class)||"humidity"===(null==e?void 0:e.attributes.device_class)?l.push(Object.assign(Object.assign({},i(n)),{},{features:[{type:"trend-graph"}]})):l.push(i(n))}l.length>0&&(a.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}),a.push(...l))}return a},p=(e,t)=>{const n=(0,c.r)(e,{area:null}),a=t.filter(n),i=[],o=(0,u.L8)(e,"",!0);for(const s of a)i.push(o(s));return i};class y extends o.mN{static async generate(e,t){const n=Object.values(t.areas),a=Object.values(t.floors),i=(0,r.cs)(a,n),o=[],s=Object.keys(t.states),u=g.map(e=>(0,c.r)(t,e)),d=(0,c.B)(s,u),y=i.floors.length+(i.areas.length?1:0);for(const r of i.floors){const e=r.id,n=r.areas,a=t.floors[e],i={type:"grid",column_span:2,cards:[{type:"heading",heading:y>1?a.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:a.icon||(0,l.Dc)(a)}]},s=h(n,t,d);s.length>0&&(i.cards.push(...s),o.push(i))}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")}]},n=h(i.areas,t,d);n.length>0&&(e.cards.push(...n),o.push(e))}const m=p(t,d);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),a()}catch(g){a(g)}})},71776:function(e,t,n){n.a(e,async function(e,a){try{n.r(t),n.d(t,{LightViewStrategy:function(){return m},lightEntityFilters:function(){return h}});n(44114),n(18111),n(22489),n(61701),n(3362),n(62953);var i=n(40445),o=n(5124),s=n(67576),r=n(66639),c=n(4423),l=n(18198),u=n(39985),d=n(7723),g=e([u]);u=(g.then?(await g)():g)[0];const h=[{domain:"light",entity_category:"none"}],p=(e,t,n)=>{const a=[];for(const i of e){const e=t.areas[i];if(!e)continue;const o=(0,c.r)(t,{area:e.area_id}),s=n.filter(o),r=[],l=(0,u.L8)(t,"",!1);for(const t of s)r.push(l(t));if(r.length>0){const n={condition:"or",conditions:s.map(e=>({condition:"state",entity:e,state:"on"}))};a.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:[d.B,{condition:"not",conditions:[n]}]},{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:[d.B,n]}]}),a.push({type:"toggle-group",color:"amber",entities:s,visibility:[d.r],grid_options:{columns:6,rows:1}}),r.forEach(e=>{r.indexOf(e)%3==0&&0!==r.indexOf(e)&&a.push({type:"vertical-stack",cards:[],visibility:[d.r],grid_options:{columns:6,rows:1}}),a.push(e)})}}return a},y=(e,t)=>{const n=(0,c.r)(e,{area:null}),a=t.filter(n),i=[],o=(0,u.L8)(e,"",!1);for(const s of a)i.push(o(s));return i};class m extends o.mN{static async generate(e,t){const n=Object.values(t.areas),a=Object.values(t.floors),i=(0,r.cs)(a,n),o=[],s=Object.keys(t.states),u=h.map(e=>(0,c.r)(t,e)),d=(0,c.B)(s,u),g=i.floors.length+(i.areas.length?1:0);for(const r of i.floors){const e=r.id,n=r.areas,a=t.floors[e],i={type:"grid",column_span:2,cards:[{type:"heading",heading:g>1?a.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:a.icon||(0,l.Dc)(a)}]},s=p(n,t,d);s.length>0&&(i.cards.push(...s),o.push(i))}if(i.areas.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:g>1?t.localize("ui.panel.lovelace.strategy.home.other_areas"):t.localize("ui.panel.lovelace.strategy.home.areas")}]},n=p(i.areas,t,d);n.length>0&&(e.cards.push(...n),o.push(e))}const m=y(t,d);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),a()}catch(h){a(h)}})},7723:function(e,t,n){n.d(t,{B:function(){return i},r:function(){return a}});const a={condition:"view_columns",min:2},i={condition:"view_columns",max:1}},8537:function(e,t,n){n.a(e,async function(e,a){try{n.d(t,{It:function(){return u},lS:function(){return l},rh:function(){return h},uN:function(){return d},vV:function(){return g}});var i=n(78030),o=n(73026),s=n(71776),r=n(31758),c=e([s,o,r]);[s,o,r]=c.then?(await c)():c;const l=["light","climate","security","media_players","maintenance","energy","persons"],u={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"},d={light:"amber",climate:"deep-orange",security:"blue-grey",media_players:"blue",maintenance:"grey",energy:"amber",persons:"green"},g={light:s.lightEntityFilters,climate:o.climateEntityFilters,security:r.securityEntityFilters,media_players:[{domain:"media_player",entity_category:"none"}],maintenance:i.maintenanceEntityFilters,energy:[],persons:[{domain:"person"}]},h=(e,t)=>e("light"===t||"climate"===t||"security"===t||"maintenance"===t?`panel.${t}`:`ui.panel.lovelace.strategy.home.summary_list.${t}`);a()}catch(l){a(l)}})},78030:function(e,t,n){n.r(t),n.d(t,{MaintenanceViewStrategy:function(){return y},filterLowBatteryEntities:function(){return d},filterUnavailableBatteryEntities:function(){return g},maintenanceEntityFilters:function(){return u}});n(44114),n(18111),n(22489),n(3362),n(62953);var a=n(40445),i=n(5124),o=n(67576),s=n(66639),r=n(4423),c=n(18198),l=(n(46190),n(71727));const u=[{domain:"sensor",device_class:["battery"]},{domain:"binary_sensor",device_class:["battery"],entity_category:"none"}],d=(e,t)=>t.filter(t=>{var n,a;const i=null!==(n=null===(a=e.states[t])||void 0===a?void 0:a.state)&&void 0!==n?n:"";if("binary_sensor"===(0,l.m)(t))return"on"===i;const o=parseFloat(i);return!isNaN(o)&&o<=20}),g=(e,t)=>t.filter(t=>{var n;return"unavailable"===(null===(n=e.states[t])||void 0===n?void 0:n.state)}),h=(e,t)=>{const n=e[t];return{type:"tile",entity:t,name:{type:(null==n?void 0:n.device_id)?"device":"entity"}}},p=(e,t,n)=>{const a=[];for(const i of e){const e=t.areas[i];if(!e)continue;const o=(0,r.r)(t,{area:e.area_id}),s=n.filter(o),c=[];for(const n of s)c.push(h(t.entities,n));c.length>0&&(a.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}),a.push(...c))}return a};class y extends i.mN{static async generate(e,t){const n=Object.values(t.areas),a=Object.values(t.floors),i=(0,s.cs)(a,n),o=[],l=Object.keys(t.states),d=u.map(e=>(0,r.r)(t,e)),g=(0,r.B)(l,d),y=i.floors.length+(i.areas.length?1:0);for(const s of i.floors){const e=s.id,n=s.areas,a=t.floors[e],i={type:"grid",column_span:2,cards:[{type:"heading",heading:y>1?a.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:a.icon||(0,c.Dc)(a)}]},r=p(n,t,g);r.length>0&&(i.cards.push(...r),o.push(i))}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")}]},n=p(i.areas,t,g);n.length>0&&(e.cards.push(...n),o.push(e))}const m=((e,t)=>{const n=(0,r.r)(e,{area:null}),a=t.filter(n),i=[];for(const o of a)i.push(h(e.entities,o));return i})(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.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,a.Cg)([(0,o.EM)("maintenance-view-strategy")],y)},31758:function(e,t,n){n.a(e,async function(e,a){try{n.r(t),n.d(t,{SecurityViewStrategy:function(){return f},securityEntityFilters:function(){return p}});n(44114),n(18111),n(22489),n(3362),n(62953);var i=n(40445),o=n(5124),s=n(67576),r=n(66639),c=n(36312),l=n(4423),u=n(69093),d=n(18198),g=n(39985),h=e([g]);g=(h.then?(await h)():h)[0];const p=[{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,n)=>{const a=[];for(const i of e){const e=t.areas[i];if(!e)continue;const o=(0,l.r)(t,{area:e.area_id}),s=n.filter(o),r=[],c=(0,g.L8)(t,"",!1);for(const t of s)r.push(c(t));r.length>0&&(a.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}),a.push(...r))}return a},m=(e,t)=>{const n=(0,l.r)(e,{area:null}),a=t.filter(n),i=[],o=(0,g.L8)(e,"",!1);for(const s of a)i.push(o(s));return i};class f extends o.mN{static async generate(e,t){const n=Object.values(t.areas),a=Object.values(t.floors),i=(0,r.cs)(a,n),o=[],s=Object.keys(t.states),g=p.map(e=>(0,l.r)(t,e)),h=(0,l.B)(s,g),f=i.floors.length+(i.areas.length?1:0);for(const r of i.floors){const e=r.id,n=r.areas,a=t.floors[e],i={type:"grid",column_span:2,cards:[{type:"heading",heading:f>1?a.name:t.localize("ui.panel.lovelace.strategy.home.areas"),icon:a.icon||(0,d.Dc)(a)}]},s=y(n,t,h);s.length>0&&(i.cards.push(...s),o.push(i))}if(i.areas.length>0){const e={type:"grid",column_span:2,cards:[{type:"heading",heading:f>1?t.localize("ui.panel.lovelace.strategy.home.other_areas"):t.localize("ui.panel.lovelace.strategy.home.areas")}]},n=y(i.areas,t,h);n.length>0&&(e.cards.push(...n),o.push(e))}const _=m(t,h);if(_.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")},..._]};o.push(e)}const v=(0,c.x)(t.config,"logbook"),b=Object.keys(t.states).filter(e=>"person"===(0,u.t)(t.states[e])),H=[...h,...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 Object.assign({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")}})}}f=(0,i.Cg)([(0,s.EM)("security-view-strategy")],f),a()}catch(p){a(p)}})}}]);