UNPKG

iobroker.lovelace

Version:

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

1 lines 4.19 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[27800],{4423:function(e,t,n){n.d(t,{B:function(){return c},r:function(){return r}});n(44114),n(18111),n(13579),n(17642),n(58004),n(33853),n(45876),n(32475),n(15024),n(31698),n(62953);var i=n(44537),o=n(71727),a=n(28455);const s=e=>{if(void 0!==e)return null===e?new Set([null]):new Set((0,i.e)(e))},r=(e,t)=>{const n=t.domain?new Set((0,i.e)(t.domain)):void 0,r=t.hidden_domains?new Set((0,i.e)(t.hidden_domains)):void 0,c=t.device_class?new Set((0,i.e)(t.device_class)):void 0,l=s(t.floor),d=s(t.area),u=s(t.device),f=t.entity_category?new Set((0,i.e)(t.entity_category)):void 0,h=t.label?new Set((0,i.e)(t.label)):void 0,v=t.hidden_platform?new Set((0,i.e)(t.hidden_platform)):void 0;return t=>{const i=e.states[t];if(!i)return!1;if(n||r){const e=(0,o.m)(t);if(n&&!n.has(e))return!1;if(r&&r.has(e))return!1}if(c){const e=i.attributes.device_class||"none";if(!c.has(e))return!1}const{area:s,floor:m,device:_,entity:p}=(0,a.ln)(i,e.entities,e.devices,e.areas,e.floors);if(p&&p.hidden)return!1;if(l){var g;const e=null!==(g=null==m?void 0:m.floor_id)&&void 0!==g?g:null;if(!l.has(e))return!1}if(d){var y;const e=null!==(y=null==s?void 0:s.area_id)&&void 0!==y?y:null;if(!d.has(e))return!1}if(u){var b;const e=null!==(b=null==_?void 0:_.id)&&void 0!==b?b:null;if(!u.has(e))return!1}if(h){if(!p)return!1;if(!p.labels.some(e=>h.has(e)))return!1}if(f){const e=(null==p?void 0:p.entity_category)||"none";if(!f.has(e))return!1}if(v){if(!p)return!1;if(p.platform&&v.has(p.platform))return!1}return!0}},c=(e,t)=>{const n=new Set,i=[];for(const o of t)for(const t of e)o(t)&&!n.has(t)&&(n.add(t),i.push(t));return i}},63004:function(e,t,n){n.d(t,{O:function(){return o},q:function(){return i}});const i=(e,t,n)=>Math.min(Math.max(e,t),n),o=(e,t,n)=>{let i;return i=null!=t?Math.max(e,t):e,i=null!=n?Math.min(i,n):i,i}},48441:function(e,t,n){n.d(t,{B:function(){return i}});n(62953);const i=[{area:null,hidden_platform:["automation","script","hassio","backup","mobile_app","zone","person"],hidden_domains:["ai_task","automation","configurator","device_tracker","event","geo_location","notify","persistent_notification","script","sun","tag","todo","zone",...n(46190).gt]}]},78859:function(e,t,n){n.r(t),n.d(t,{HomeOtherDevicesViewStrategy:function(){return u}});n(44114),n(18111),n(22489),n(61701),n(3362),n(62953);var i=n(40445),o=n(5124),a=n(67576),s=n(37981),r=n(28455),c=n(4423),l=n(63004),d=n(48441);class u extends o.mN{static async generate(e,t){const n=Object.keys(t.states),i=d.B.map(e=>(0,c.r)(t,e)),o=(0,c.B)(n,i),a=[],u={};for(const s of o){const e=t.states[s];if(!e)continue;const{device:n}=(0,r.ln)(e,t.entities,t.devices,t.areas,t.floors);n&&(n.id in u||(u[n.id]=[]),u[n.id].push(s))}const f=Object.entries(u).map(([e,t])=>({device_id:e,entities:t})),h=(0,c.r)(t,{entity_category:"none"});for(const r of f){var v,m;if(0===r.entities.length)continue;const n=r.entities.filter(e=>h(e));if(0===n.length)continue;const i=r.device_id,o=t.devices[i];let c="";o&&(c=(0,s.xn)(o)||t.localize("ui.panel.lovelace.strategy.home.unnamed_device")),a.push({type:"grid",cards:[{type:"heading",heading:c,tap_action:o&&null!==(v=t.user)&&void 0!==v&&v.is_admin?{action:"navigate",navigation_path:`/config/devices/device/${o.id}`}:{action:"none"},badges:[...e.home_panel&&o&&null!==(m=t.user)&&void 0!==m&&m.is_admin?[{type:"button",icon:"mdi:home-plus",text:t.localize("ui.panel.lovelace.strategy.home-other-devices.assign_area"),tap_action:{action:"fire-dom-event",home_panel:{type:"assign_area",device_id:o.id}}}]:[]]},{type:"entities",entities:n.map(e=>({entity:e,name:{type:"entity"}}))}]})}const _=(0,l.q)(a.length,2,3);return 0===a.length?{type:"panel",cards:[{type:"empty-state",icon:"mdi:check-all",icon_color:"primary",content_only:!0,title:t.localize("ui.panel.lovelace.strategy.home-other-devices.all_organized_title"),content:t.localize("ui.panel.lovelace.strategy.home-other-devices.all_organized_content")}]}:(1===a.length&&(a[0].column_span=2),{type:"sections",header:{badges_position:"bottom"},max_columns:_,sections:a})}}u=(0,i.Cg)([(0,a.EM)("home-other-devices-view-strategy")],u)}}]);