UNPKG

iobroker.lovelace

Version:

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

2 lines 14.3 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["72544"],{92636:function(t,e,n){n.d(e,{z:()=>i});n(19083),n(61006);const i=t=>(e,n)=>t.includes(e,n)},19631:function(t,e,n){n.a(t,(async function(t,i){try{n.d(e,{Bt:()=>u,T8:()=>l});n(19083);var s=n(16485),o=n(88977),r=n(20382),a=t([s]);s=(a.then?(await a)():a)[0];const c=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],u=t=>t.first_weekday===r.FS.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(t.language).weekInfo.firstDay%7:(0,o.L)(t.language)%7:c.includes(t.first_weekday)?c.indexOf(t.first_weekday):1,l=t=>{const e=u(t);return c[e]};i()}catch(c){i(c)}}))},33570:function(t,e,n){n.a(t,(async function(t,i){try{n.d(e,{Vu:()=>d,Zs:()=>p,mr:()=>u,xO:()=>y});var s=n(16485),o=n(27486),r=n(11104),a=n(16922),c=t([s,r]);[s,r]=c.then?(await c)():c;const u=(t,e,n)=>l(e,n.time_zone).format(t),l=(0,o.Z)(((t,e)=>new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,a.y)(t)?"h12":"h23",timeZone:(0,r.f)(t.time_zone,e)}))),d=(t,e,n)=>m(e,n.time_zone).format(t),m=(0,o.Z)(((t,e)=>new Intl.DateTimeFormat(t.language,{hour:(0,a.y)(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,a.y)(t)?"h12":"h23",timeZone:(0,r.f)(t.time_zone,e)}))),y=(t,e,n)=>f(e,n.time_zone).format(t),f=(0,o.Z)(((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",hour:(0,a.y)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,a.y)(t)?"h12":"h23",timeZone:(0,r.f)(t.time_zone,e)}))),p=(t,e,n)=>h(e,n.time_zone).format(t),h=(0,o.Z)(((t,e)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,r.f)(t.time_zone,e)})));i()}catch(u){i(u)}}))},11104:function(t,e,n){n.a(t,(async function(t,i){try{n.d(e,{f:()=>m});var s,o,r,a=n(16485),c=n(20382),u=t([a]);a=(u.then?(await u)():u)[0];const l=null===(s=Intl.DateTimeFormat)||void 0===s||null===(o=(r=s.call(Intl)).resolvedOptions)||void 0===o?void 0:o.call(r).timeZone,d=null!=l?l:"UTC",m=(t,e)=>t===c.c_.local&&l?d:e;i()}catch(l){i(l)}}))},16922:function(t,e,n){n.d(e,{y:()=>o});n(19083),n(61006);var i=n(27486),s=n(20382);const o=(0,i.Z)((t=>{if(t.time_format===s.zt.language||t.time_format===s.zt.system){const e=t.time_format===s.zt.language?t.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(e).includes("10")}return t.time_format===s.zt.am_pm}))},59847:function(t,e,n){n.d(e,{N:()=>s});var i=n(73850);const s=t=>(0,i.M)(t.entity_id)},12753:function(t,e,n){n.d(e,{N:()=>s});n(71695),n(88044),n(47021);const i=[" ",": "," - "],s=(t,e)=>{const n=t.toLowerCase(),s=e.toLowerCase();for(const r of i){const e=`${s}${r}`;if(n.startsWith(e)){const n=t.substring(e.length);if(n.length)return o(n.substr(0,n.indexOf(" ")))?n:n[0].toUpperCase()+n.slice(1)}}},o=t=>t.toLowerCase()!==t},50602:function(t,e,n){n.a(t,(async function(t,i){try{n.d(e,{SL:()=>c,l4:()=>m,sJ:()=>u,uf:()=>d});var s=n(16485),o=(n(19083),n(19423),n(11740),n(61006),n(20382)),r=n(34618),a=t([s]);s=(a.then?(await a)():a)[0];const c=t=>u(t.attributes),u=(t,e)=>!!t.unit_of_measurement||!!t.state_class||(e||[]).includes(t.device_class||""),l=t=>{switch(t.number_format){case o.y4.comma_decimal:return["en-US","en"];case o.y4.decimal_comma:return["de","es","it"];case o.y4.space_comma:return["fr","sv","cs"];case o.y4.system:return;default:return t.language}},d=(t,e,n)=>{const i=e?l(e):void 0;return Number.isNaN=Number.isNaN||function t(e){return"number"==typeof e&&t(e)},(null==e?void 0:e.number_format)===o.y4.none||Number.isNaN(Number(t))?Number.isNaN(Number(t))||""===t||(null==e?void 0:e.number_format)!==o.y4.none?"string"==typeof t?t:`${(0,r.N)(t,null==n?void 0:n.maximumFractionDigits).toString()}${"currency"===(null==n?void 0:n.style)?` ${n.currency}`:""}`:new Intl.NumberFormat("en-US",y(t,Object.assign(Object.assign({},n),{},{useGrouping:!1}))).format(Number(t)):new Intl.NumberFormat(i,y(t,n)).format(Number(t))},m=(t,e)=>{var n;const i=null==e?void 0:e.display_precision;return null!=i?{maximumFractionDigits:i,minimumFractionDigits:i}:Number.isInteger(Number(null==t||null===(n=t.attributes)||void 0===n?void 0:n.step))&&Number.isInteger(Number(null==t?void 0:t.state))?{maximumFractionDigits:0}:void 0},y=(t,e)=>{const n=Object.assign({maximumFractionDigits:2},e);if("string"!=typeof t)return n;if(!e||void 0===e.minimumFractionDigits&&void 0===e.maximumFractionDigits){const e=t.indexOf(".")>-1?t.split(".")[1].length:0;n.minimumFractionDigits=e,n.maximumFractionDigits=e}return n};i()}catch(c){i(c)}}))},34618:function(t,e,n){n.d(e,{N:()=>i});const i=(t,e=2)=>Math.round(t*10**e)/10**e},4242:function(t,e,n){n.d(e,{CE:()=>s,FH:()=>l,Nq:()=>a,Pb:()=>i,fm:()=>u,h8:()=>c,r4:()=>r,uh:()=>o});n(92745),n(9359),n(70104),n(19423),n(40251),n(81804);const i="system-admin",s="system-users",o=async t=>t.callWS({type:"config/auth/list"}),r=async(t,e,n,i)=>t.callWS({type:"config/auth/create",name:e,group_ids:n,local_only:i}),a=async(t,e,n)=>t.callWS(Object.assign(Object.assign({},n),{},{type:"config/auth/update",user_id:e})),c=async(t,e)=>t.callWS({type:"config/auth/delete",user_id:e}),u=t=>t?t.trim().split(" ").slice(0,3).map((t=>t.substring(0,1))).join(""):"?",l=(t,e,n)=>{const i=[],s=e=>t.localize(`ui.panel.config.users.${e}`);return e.is_owner&&i.push(["M12 2C6.47 2 2 6.5 2 12C2 17.5 6.5 22 12 22S22 17.5 22 12 17.5 2 12 2M12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4S20 7.58 20 12C20 16.42 16.42 20 12 20M8 14L7 8L10 10L12 7L14 10L17 8L16 14H8M8.56 16C8.22 16 8 15.78 8 15.44V15H16V15.44C16 15.78 15.78 16 15.44 16H8.56Z",s("is_owner")]),n&&e.system_generated&&i.push(["M11,7H15V9H11V11H13A2,2 0 0,1 15,13V15A2,2 0 0,1 13,17H9V15H13V13H11A2,2 0 0,1 9,11V9A2,2 0 0,1 11,7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z",s("is_system")]),e.local_only&&i.push(["M12 20C7.6 20 4 16.4 4 12S7.6 4 12 4 20 7.6 20 12 16.4 20 12 20M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M11 14H13V17H16V12H18L12 7L6 12H8V17H11V14",s("is_local")]),e.is_active||i.push(["M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z",s("is_not_active")]),i}},96530:function(t,e,n){n.d(e,{X:()=>o,y:()=>s});var i=n(92636);const s=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],o=(0,i.z)(s)},20526:function(t,e,n){n.d(e,{oU:()=>g,lY:()=>p,VG:()=>h,AP:()=>_});n(19083),n(71695),n(92745),n(61893),n(84283),n(9359),n(56475),n(1331),n(31526),n(70104),n(19423),n(92519),n(42179),n(89256),n(24931),n(88463),n(57449),n(19814),n(61006),n(81804),n(47021);var i=n(73358),s=n(73850),o=n(59847),r=n(47194);var a=n(12753),c=n(1416),u=n(82100),l=n(57816),d=n(4242),m=n(96530);const y=new Set(["automation","configurator","device_tracker","event","geo_location","notify","persistent_notification","script","sun","tag","todo","zone",...i.a5]),f=new Set(["backup","mobile_app"]),p=(t,e)=>Object.assign({type:"grid",cards:t.map((t=>({type:"tile",entity:t,show_entity_picture:["camera","image","person"].includes((0,s.M)(t))||void 0})))},e),h=(t,e,n,o=!0)=>{const u=[],l=[],d=n.title?n.title.toLowerCase():void 0,m=[];for(const i of e){const e=t[i],n=(0,s.M)(i);if("alarm_control_panel"===n){const t={type:"alarm-panel",entity:i};u.push(t)}else if("camera"===n){const t={type:"picture-entity",entity:i};u.push(t)}else if("image"===n){const t={type:"picture",image_entity:i};u.push(t)}else if("climate"===n){var y,f,p;const e={type:"thermostat",entity:i,features:(null!==(y=null===(f=t[i])||void 0===f||null===(f=f.attributes)||void 0===f||null===(f=f.hvac_modes)||void 0===f?void 0:f.length)&&void 0!==y?y:0)>1?[{type:"climate-hvac-modes",hvac_modes:null===(p=t[i])||void 0===p||null===(p=p.attributes)||void 0===p?void 0:p.hvac_modes}]:void 0};u.push(e)}else if("humidifier"===n){const t={type:"humidifier",entity:i,features:[{type:"humidifier-toggle"}]};u.push(t)}else if("media_player"===n){const t={type:"media-control",entity:i};u.push(t)}else if("plant"===n){const t={type:"plant-status",entity:i};u.push(t)}else if("weather"===n){const t={type:"weather-forecast",entity:i,show_forecast:!1};u.push(t)}else if(!o||"scene"!==n&&"script"!==n){let t;const n=d&&e&&(t=(0,a.N)((0,r.C)(e),d))?{entity:i,name:t}:i;l.push(n)}else{const t={entity:i,show_icon:!0,show_name:!0};let n;d&&e&&(n=(0,a.N)((0,r.C)(e),d))&&(t.name=n),m.push(t)}}if(l.sort(((e,n)=>{const o="string"==typeof e?e:e.entity,a="string"==typeof n?n:n.entity,u=i.zF.includes((0,s.M)(o))?"sensor":"control";return u!==(i.zF.includes((0,s.M)(a))?"sensor":"control")?"sensor"===u?1:-1:(0,c.$K)("string"==typeof e?t[e]?(0,r.C)(t[e]):"":e.name||"","string"==typeof n?t[n]?(0,r.C)(t[n]):"":n.name||"")})),0===l.length&&m.length>0)return h(t,e,n,!1);if(l.length>0||m.length>0){const t=Object.assign({type:"entities",entities:l},n);m.length>0&&(t.footer={type:"buttons",entities:m}),u.unshift(t)}return u.length<2?u:[{type:"grid",square:!1,columns:1,cards:u}]},g=(t,e)=>{const n=[];for(const i of e){const t={type:"entity",entity:i};n.push(t)}return n},_=(t,e,n,i,a,p,g,_,v)=>{const b=((t,e)=>{const n={},i=new Set(Object.values(e).filter((t=>t.entity_category||t.platform&&f.has(t.platform)||t.hidden)).map((t=>t.entity_id)));for(const s of Object.keys(t)){const e=t[s];y.has((0,o.N)(e))||i.has(e.entity_id)||(n[s]=t[s])}return n})(i,n),w={};for(const s of Object.keys(b)){const t=b[s];t.attributes.order&&(w[s]=t.attributes.order)}const C=((t,e,n,i)=>{const s=Object.assign({},i),o={},r={};for(const c of Object.values(n)){var a;const n=c.area_id||c.device_id&&(null===(a=e[c.device_id])||void 0===a?void 0:a.area_id);n&&n in t&&c.entity_id in s?(n in o||(o[n]=[]),o[n].push(s[c.entity_id]),delete s[c.entity_id]):c.device_id&&c.device_id in e&&c.entity_id in s&&(c.device_id in r||(r[c.device_id]=[]),r[c.device_id].push(s[c.entity_id]),delete s[c.entity_id])}for(const[c,u]of Object.entries(r))1===u.length&&(s[u[0].entity_id]=u[0],delete r[c]);return{areasWithEntities:o,devicesWithEntities:r,otherEntities:s}})(t,e,n,b);if(null!=g&&g.hidden)for(const s of g.hidden)delete C.areasWithEntities[s];_&&(C.devicesWithEntities={},C.otherEntities={});const N=(t=>{const e=[],n={};return Object.keys(t).forEach((i=>{const o=t[i];"group"===(0,s.M)(i)?e.push(o):n[i]=o})),e.forEach((t=>t.attributes.entity_id.forEach((t=>{delete n[t]})))),{groups:e,ungrouped:n}})(C.otherEntities);N.groups.sort(((t,e)=>w[t.entity_id]-w[e.entity_id]));const k=[];for(const s of N.groups)k.push(...h(i,s.attributes.entity_id,{title:(0,r.C)(s),show_header_toggle:"hidden"!==s.attributes.control}));const O=((t,e,n,i,s)=>{const a={};for(const r of Object.keys(s)){const t=s[r],e=(0,o.N)(t);e in a||(a[e]=[]),a[e].push(t.entity_id)}const u=[];if("person"in a){const t=[];if(1===a.person.length)u.push({type:"entities",entities:a.person});else{let e,n="";for(const i of a.person){const o=s[i];let r=o.attributes.entity_picture;if(!r){if(void 0===e){const t=getComputedStyle(document.body);e=encodeURIComponent(t.getPropertyValue("--light-primary-color").trim()),n=encodeURIComponent((t.getPropertyValue("--text-light-primary-color")||t.getPropertyValue("--primary-text-color")).trim())}r=`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' width='50' height='50' style='background-color:${e}'%3E%3Cg%3E%3Ctext font-family='roboto' x='50%25' y='50%25' text-anchor='middle' stroke='${n}' font-size='1.3em' dy='.3em'%3E${(0,d.fm)(o.attributes.friendly_name||"")}%3C/text%3E%3C/g%3E%3C/svg%3E`}t.push({type:"picture-entity",entity:i,aspect_ratio:"1",show_name:!1,image:r})}u.push({type:"grid",square:!0,columns:3,cards:t})}delete a.person}const y=[];for(const o of m.y)o in a&&(y.push(...a[o]),delete a[o]);const f={};for(const o of Object.keys(a))f[o]=(0,l.Lh)(t,o);y.length&&(a._helpers=y,f._helpers=t("ui.panel.lovelace.strategy.original-states.helpers")),Object.keys(a).sort(((t,e)=>(0,c.$K)(f[t],f[e]))).forEach((t=>{u.push(...h(s,a[t].sort(((t,e)=>(0,c.$K)((0,r.C)(s[t]),(0,r.C)(s[e])))),{title:f[t]}))}));const p={path:e,title:n,cards:u};return i&&(p.icon=i),p})(a,"default_view","Home",undefined,N.ungrouped),E=[],x=Object.keys(C.areasWithEntities).sort((0,u.a)(t,null==g?void 0:g.order));for(const s of x){const e=C.areasWithEntities[s],n=t[s];E.push(...h(i,e.map((t=>t.entity_id)),{title:n.name}))}const F=[],M=Object.entries(C.devicesWithEntities).sort(((t,n)=>{const i=e[t[0]],s=e[n[0]];return(0,c.$K)(i.name_by_user||i.name||"",s.name_by_user||s.name||"")}));for(const[s,o]of M){const t=e[s];F.push(...h(i,o.map((t=>t.entity_id)),{title:t.name_by_user||t.name||a("ui.panel.config.devices.unnamed_device",{type:a(`ui.panel.config.devices.type.${t.entry_type||"device"}`)})}))}let S;if(p&&!v){const t=p.energy_sources.find((t=>"grid"===t.type));t&&t.flow_from.length>0&&(S={title:a("ui.panel.lovelace.cards.energy.energy_distribution.title_today"),type:"energy-distribution",link_dashboard:!0})}return O.cards.unshift(...E,...k,...S?[S]:[]),O.cards.push(...F),O}},96751:function(t,e,n){n.a(t,(async function(t,i){try{n.r(e),n.d(e,{OriginalStatesViewStrategy:()=>m});var s=n(61701),o=(n(19083),n(71695),n(92745),n(40251),n(61006),n(47021),n(94277)),r=n(57243),a=n(50778),c=n(72344),u=n(1118),l=n(20526),d=t([u]);u=(d.then?(await d)():d)[0];let m=(0,s.Z)([(0,a.Mo)("original-states-view-strategy")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",static:!0,key:"generate",value:async function(t,e){if(e.config.state===o.UE)return{cards:[{type:"starting"}]};if(e.config.recovery_mode)return{cards:[{type:"recovery-mode"}]};const[n,i]=await Promise.all([e.loadBackendTranslation("title"),(0,c.p)(e,"energy")?(0,u.ZC)(e).catch((()=>{})):void 0]),s=(0,l.AP)(e.areas,e.devices,e.entities,e.states,n,i,t.areas,t.hide_entities_without_area,t.hide_energy);return e.config.components.includes("geo_location")&&s&&s.cards&&s.cards.push({type:"map",geo_location_sources:["all"]}),0===s.cards.length&&s.cards.push({type:"empty-state"}),s}}]}}),r.fl);i()}catch(m){i(m)}}))}}]); //# sourceMappingURL=72544.88c206954f0c93e0.js.map