UNPKG

iobroker.lovelace

Version:

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

1 lines 16.8 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[94530],{380:function(t,e,n){n.a(t,async function(t,i){try{n.d(e,{D:function(){return l},P:function(){return u}});n(74423);var o=n(74487),r=n(27734),s=n(46927),a=n(96029),c=t([o]);o=(c.then?(await c)():c)[0];const u=t=>t.first_weekday===s.zt.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(t.language).weekInfo.firstDay%7:(0,r.S)(t.language)%7:a.Z.includes(t.first_weekday)?a.Z.indexOf(t.first_weekday):1,l=t=>{const e=u(t);return a.Z[e]};i()}catch(u){i(u)}})},30162:function(t,e,n){n.a(t,async function(t,i){try{n.d(e,{LW:function(){return g},Xs:function(){return f},fU:function(){return u},ie:function(){return d}});var o=n(74487),r=n(22786),s=n(8480),a=n(69543),c=t([o,s]);[o,s]=c.then?(await c)():c;const u=(t,e,n)=>l(e,n.time_zone).format(t),l=(0,r.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,a.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),d=(t,e,n)=>m(e,n.time_zone).format(t),m=(0,r.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:(0,a.J)(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,a.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),f=(t,e,n)=>y(e,n.time_zone).format(t),y=(0,r.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",hour:(0,a.J)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,a.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),g=(t,e,n)=>p(e,n.time_zone).format(t),p=(0,r.A)((t,e)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,s.wj)(t.time_zone,e)}));i()}catch(u){i(u)}})},8480:function(t,e,n){n.a(t,async function(t,i){try{n.d(e,{fL:function(){return f},n2:function(){return y},wj:function(){return g}});var o,r,s,a=n(74487),c=n(29079),u=n(46927),l=t([a]);a=(l.then?(await l)():l)[0];const d=null===(o=Intl.DateTimeFormat)||void 0===o||null===(r=(s=o.call(Intl)).resolvedOptions)||void 0===r?void 0:r.call(s).timeZone,m=d&&("UTC"===d||"Etc/UTC"===d||d in c)?d:void 0,f=14881==n.j?void 0!==m:null,y=null!=m?m:"UTC",g=(t,e)=>t===u.Wj.local&&m?y:e;i()}catch(d){i(d)}})},69543:function(t,e,n){n.d(e,{J:function(){return r}});n(74423);var i=n(22786),o=n(46927);const r=(0,i.A)(t=>{if(t.time_format===o.Hg.language||t.time_format===o.Hg.system){const e=t.time_format===o.Hg.language?t.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(e).includes("10")}return t.time_format===o.Hg.am_pm})},96029:function(t,e,n){n.d(e,{Tq:function(){return s},Z:function(){return o},ZV:function(){return i},sj:function(){return r}});const i=["sun","mon","tue","wed","thu","fri","sat"],o=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],r={0:"sun",1:"mon",2:"tue",3:"wed",4:"thu",5:"fri",6:"sat"},s={sun:"sunday",mon:"monday",tue:"tuesday",wed:"wednesday",thu:"thursday",fri:"friday",sat:"saturday"}},69093:function(t,e,n){n.d(e,{t:function(){return o}});var i=n(71727);const o=t=>(0,i.m)(t.entity_id)},20058:function(t,e,n){n.a(t,async function(t,i){try{n.d(e,{QL:function(){return d},ZQ:function(){return m},ZV:function(){return l},ty:function(){return c},x:function(){return a}});var o=n(74487),r=(n(74423),n(18111),n(61701),n(46927)),s=t([o]);o=(s.then?(await s)():s)[0];const a=t=>c(t.attributes),c=(t,e)=>!!t.unit_of_measurement||!!t.state_class||(e||[]).includes(t.device_class||""),u=t=>{switch(t.number_format){case r.jG.comma_decimal:return["en-US","en"];case r.jG.decimal_comma:return["de","es","it"];case r.jG.space_comma:return["fr","sv","cs"];case r.jG.quote_decimal:return["de-CH"];case r.jG.system:return;default:return t.language}},l=(t,e,n)=>d(t,e,n).map(t=>t.value).join(""),d=(t,e,n)=>{const i=e?u(e):void 0;return(null==e?void 0:e.number_format)===r.jG.none||Number.isNaN(Number(t))?Number.isNaN(Number(t))||""===t||(null==e?void 0:e.number_format)!==r.jG.none?[{type:"literal",value:t}]:new Intl.NumberFormat("en-US",f(t,Object.assign(Object.assign({},n),{},{useGrouping:!1}))).formatToParts(Number(t)):new Intl.NumberFormat(i,f(t,n)).formatToParts(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},f=(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(a){i(a)}})},95350:function(t,e,n){n.d(e,{$h:function(){return m},FP:function(){return p},Og:function(){return r},QC:function(){return d},QQ:function(){return a},S1:function(){return s},Ud:function(){return h},fK:function(){return u},l7:function(){return l},nQ:function(){return y},p$:function(){return c}});n(3362),n(62953);if(66649!=n.j)var i=n(90889);var o=n(9899);const r=66649!=n.j?{bluetooth:"config/bluetooth",dhcp:"config/dhcp",matter:"config/matter",mqtt:"config/mqtt",ssdp:"config/ssdp",thread:"config/thread",zeroconf:"config/zeroconf",zha:"config/zha/dashboard",zwave_js:"config/zwave_js/dashboard"}:null;var s=66649!=n.j?function(t){return t[t.CRITICAL=50]="CRITICAL",t[t.ERROR=40]="ERROR",t[t.WARNING=30]="WARNING",t[t.INFO=20]="INFO",t[t.DEBUG=10]="DEBUG",t[t.NOTSET=0]="NOTSET",t}({}):null;const a=(t,e)=>e.issue_tracker||`https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+${t}%22`,c=(t,e,n)=>t(`component.${e}.title`)||(null==n?void 0:n.name)||e,u=(t,e)=>{const n={type:"manifest/list"};return e&&(n.integrations=e),t.callWS(n)},l=async(t,e)=>{const n=await t.sendMessagePromise({type:"manifest/list"}),i={};for(const o of n)i[o.domain]=o;return e(i),()=>{}},d=(t,e)=>t.callWS({type:"manifest/get",integration:e}),m=t=>t.callWS({type:"integration/setup_info"}),f=t=>t.sendMessagePromise({type:"logger/log_info"}),y=(t,e,n,i)=>t.callWS({type:"logger/integration_log_level",integration:e,level:n,persistence:i}),g=(t,e)=>t.subscribeEvents((0,o.s)(()=>f(t).then(t=>e.setState(t,!0)),200,!0),"logging_changed"),p=(t,e)=>(0,i.N)("_integration_log_info",f,g,t,e),h=(t,e)=>t.callWS({type:"integration/wait",domain:e})},28669:function(t,e,n){n.d(e,{TK:function(){return a},_2:function(){return u},eR:function(){return o},hG:function(){return c},hU:function(){return r},kg:function(){return s},wj:function(){return i},xg:function(){return y}});n(44114),n(18111),n(61701),n(3362),n(42762);const i="system-admin",o="system-users",r=async t=>t.callWS({type:"config/auth/list"}),s=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=66649!=n.j?"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":null,d=66649!=n.j?"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":null,m=66649!=n.j?"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":null,f=66649!=n.j?"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":null,y=(t,e,n)=>{const i=[],o=e=>t.localize(`ui.panel.config.users.${e}`);return e.is_owner&&i.push([l,o("is_owner")]),n&&e.system_generated&&i.push([d,o("is_system")]),e.local_only&&i.push([m,o("is_local")]),e.is_active||i.push([f,o("is_not_active")]),i}},24367:function(t,e,n){n.d(e,{L:function(){return o},z:function(){return r}});var i=n(23832);const o=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],r=(0,i.g)(o)},40747:function(t,e,n){n.d(e,{KT:function(){return p},Bi:function(){return g},ZI:function(){return y},Yp:function(){return h}});n(74423),n(44114),n(26910),n(13609),n(18111),n(22489),n(20116),n(7588),n(61701),n(17642),n(58004),n(33853),n(45876),n(32475),n(15024),n(31698),n(42762),n(62953);var i=n(46190),o=n(71727),r=n(69093),s=n(28978);var a=n(79461),c=n(52220),u=n(95350),l=n(28669),d=n(24367);const m=new Set(["ai_task","automation","configurator","device_tracker","event","geo_location","notify","persistent_notification","script","sun","tag","todo","zone",...i.gt]),f=new Set(["backup","mobile_app"]),y=(t,e)=>Object.assign({type:"grid",cards:t.map(t=>({type:"tile",entity:t,show_entity_picture:["camera","image","person"].includes((0,o.m)(t))||void 0}))},e),g=(t,e,n,r=!0)=>{const u=[],l=t.states,d=[],m=n.title?n.title.toLowerCase():void 0,f=[];for(const i of e){const t=l[i],e=(0,o.m)(i);if("alarm_control_panel"===e){const t={type:"alarm-panel",entity:i};u.push(t)}else if("camera"===e){const t={type:"picture-entity",entity:i};u.push(t)}else if("image"===e){const t={type:"picture",image_entity:i};u.push(t)}else if("climate"===e){var y,p,h;const t={type:"thermostat",entity:i,features:(null!==(y=null===(p=l[i])||void 0===p||null===(p=p.attributes)||void 0===p||null===(p=p.hvac_modes)||void 0===p?void 0:p.length)&&void 0!==y?y:0)>1?[{type:"climate-hvac-modes",hvac_modes:null===(h=l[i])||void 0===h||null===(h=h.attributes)||void 0===h?void 0:h.hvac_modes}]:void 0};u.push(t)}else if("humidifier"===e){const t={type:"humidifier",entity:i,features:[{type:"humidifier-toggle"}]};u.push(t)}else if("media_player"===e){const t={type:"media-control",entity:i};u.push(t)}else if("plant"===e){const t={type:"plant-status",entity:i};u.push(t)}else if("weather"===e){const t={type:"weather-forecast",entity:i,show_forecast:!1};u.push(t)}else if(!r||"scene"!==e&&"script"!==e){let e;const n=m&&t&&(e=(0,a.p)((0,s.u)(t),m))?{entity:i,name:e}:i;d.push(n)}else{const e={entity:i,show_icon:!0,show_name:!0};let n;m&&t&&(n=(0,a.p)((0,s.u)(t),m))&&(e.name=n),f.push(e)}}if(d.sort((e,n)=>{const r="string"==typeof e?e:e.entity,a="string"==typeof n?n:n.entity,u=i.JF.includes((0,o.m)(r))?"sensor":"control";return u!==(i.JF.includes((0,o.m)(a))?"sensor":"control")?"sensor"===u?1:-1:(0,c.xL)("string"==typeof e?l[e]?(0,s.u)(l[e]):"":l[e.entity]?t.formatEntityName(l[e.entity],e.name):"","string"==typeof n?l[n]?(0,s.u)(l[n]):"":l[n.entity]?t.formatEntityName(l[n.entity],n.name):"")}),0===d.length&&f.length>0)return g(t,e,n,!1);if(d.length>0||f.length>0){const t=Object.assign({type:"entities",entities:d},n);f.length>0&&(t.footer={type:"buttons",entities:f}),u.unshift(t)}return u.length<2?u:[{type:"grid",square:!1,columns:1,cards:u}]},p=(t,e)=>{const n=[];for(const i of e){const t={type:"entity",entity:i};n.push(t)}return n},h=(t,e,n,i,a,y)=>{const p=t.states,h=t.areas,_=t.devices,v=t.entities,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 o of Object.keys(t)){const e=t[o];m.has((0,r.t)(e))||i.has(e.entity_id)||(n[o]=t[o])}return n})(p,v),w={};for(const o of Object.keys(b)){const t=b[o];t.attributes.order&&(w[o]=t.attributes.order)}const j=((t,e,n,i)=>{const o=Object.assign({},i),r={},s={};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 o?(n in r||(r[n]=[]),r[n].push(o[c.entity_id]),delete o[c.entity_id]):c.device_id&&c.device_id in e&&c.entity_id in o&&(c.device_id in s||(s[c.device_id]=[]),s[c.device_id].push(o[c.entity_id]),delete o[c.entity_id])}for(const[c,u]of Object.entries(s))1===u.length&&(o[u[0].entity_id]=u[0],delete s[c]);return{areasWithEntities:r,devicesWithEntities:s,otherEntities:o}})(h,_,v,b);if(null!=i&&i.hidden)for(const o of i.hidden)delete j.areasWithEntities[o];a&&(j.devicesWithEntities={},j.otherEntities={});const C=(t=>{const e=[],n={};return Object.keys(t).forEach(i=>{const r=t[i];"group"===(0,o.m)(i)?e.push(r):n[i]=r}),e.forEach(t=>t.attributes.entity_id.forEach(t=>{delete n[t]})),{groups:e,ungrouped:n}})(j.otherEntities);C.groups.sort((t,e)=>w[t.entity_id]-w[e.entity_id]);const O=[];for(const o of C.groups)O.push(...g(t,o.attributes.entity_id,{title:(0,s.u)(o),show_header_toggle:"hidden"!==o.attributes.control}));const E=((t,e,n,i,o,a)=>{const m={},{localize:f}=t;for(const s of Object.keys(a)){const t=a[s],e=(0,r.t)(t);e in m||(m[e]=[]),m[e].push(t.entity_id)}const y=[];if("person"in m){const t=[];if(1===m.person.length)y.push({type:"entities",entities:m.person});else{let e,n="";for(const i of m.person){const o=a[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,l._2)(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})}y.push({type:"grid",square:!0,columns:3,cards:t})}delete m.person}const p=[];for(const r of d.L)r in m&&(p.push(...m[r]),delete m[r]);const h={};for(const r of Object.keys(m))h[r]=(0,u.p$)(f,r);p.length&&(m._helpers=p,h._helpers=f("ui.panel.lovelace.strategy.original-states.helpers")),Object.keys(m).sort((t,e)=>(0,c.xL)(h[t],h[e])).forEach(e=>{y.push(...g(t,m[e].sort((t,e)=>(0,c.xL)((0,s.u)(a[t]),(0,s.u)(a[e]))),{title:h[e]}))});const _={path:e,title:n,cards:y};return i&&(_.icon=i),o&&(_.show_icon_and_title=o),_})(t,"default_view","Home",void 0,void 0,C.ungrouped),N=[],S=Object.keys(h);if(null!=i&&i.order){const t=i.order;S.sort((0,c.u1)(t))}for(const o of S){if(!(o in j.areasWithEntities))continue;const e=j.areasWithEntities[o],n=h[o];N.push(...g(t,e.map(t=>t.entity_id),{title:n.name}))}const k=[],x=Object.entries(j.devicesWithEntities).sort((t,e)=>{const n=_[t[0]],i=_[e[0]];return(0,c.xL)(n.name_by_user||n.name||"",i.name_by_user||i.name||"")});for(const[o,r]of x){const n=_[o];k.push(...g(t,r.map(t=>t.entity_id),{title:n.name_by_user||n.name||e("ui.panel.config.devices.unnamed_device",{type:e(`ui.panel.config.devices.type.${n.entry_type||"device"}`)})}))}let A;if(n&&!y){const t=n.energy_sources.find(t=>"grid"===t.type);t&&t.stat_energy_from&&(A={title:e("ui.panel.lovelace.cards.energy.energy_distribution.title_today"),type:"energy-distribution",link_dashboard:!0})}return E.cards.unshift(...N,...O,...A?[A]:[]),E.cards.push(...k),E}},16330:function(t,e,n){n.a(t,async function(t,i){try{n.r(e),n.d(e,{OriginalStatesViewStrategy:function(){return f}});n(44114),n(18111),n(13579),n(3362),n(62953);var o=n(40445),r=n(58888),s=n(5124),a=n(67576),c=n(36312),u=n(38114),l=n(40747),d=n(71727),m=t([u]);u=(m.then?(await m)():m)[0];class f extends s.mN{static async generate(t,e){if(e.config.state===r.m2)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.x)(e.config,"energy")?(0,u.bs)(e).catch(()=>{}):void 0]),o=(0,l.Yp)(e,n,i,t.areas,t.hide_entities_without_area,t.hide_energy);var s;return Object.values(e.states).some(t=>"geo_location"===(0,d.m)(t.entity_id))&&o&&o.cards&&o.cards.push({type:"map",geo_location_sources:["all"]}),0===o.cards.length?{type:"panel",cards:[Object.assign({type:"empty-state",icon:"mdi:home-assistant",icon_color:"primary",content_only:!0,title:e.localize("ui.panel.lovelace.strategy.original-states.empty_state_title"),content:e.localize("ui.panel.lovelace.strategy.original-states.empty_state_content")},null!==(s=e.user)&&void 0!==s&&s.is_admin?{buttons:[{text:e.localize("ui.panel.lovelace.strategy.original-states.empty_state_action"),appearance:"filled",variant:"brand",tap_action:{action:"navigate",navigation_path:"/config/integrations/dashboard"}}]}:{})]}:o}}f=(0,o.Cg)([(0,a.EM)("original-states-view-strategy")],f),i()}catch(f){i(f)}})}}]);