UNPKG

iobroker.lovelace

Version:

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

1 lines 7.09 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[51016],{380:function(e,t,n){n.a(e,async function(e,r){try{n.d(t,{D:function(){return l},P:function(){return c}});n(74423);var i=n(74487),a=n(27734),o=n(46927),s=n(96029),u=e([i]);i=(u.then?(await u)():u)[0];const c=e=>e.first_weekday===o.zt.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(e.language).weekInfo.firstDay%7:(0,a.S)(e.language)%7:s.Z.includes(e.first_weekday)?s.Z.indexOf(e.first_weekday):1,l=e=>{const t=c(e);return s.Z[t]};r()}catch(c){r(c)}})},30162:function(e,t,n){n.a(e,async function(e,r){try{n.d(t,{LW:function(){return _},Xs:function(){return y},fU:function(){return c},ie:function(){return m}});var i=n(74487),a=n(22786),o=n(8480),s=n(69543),u=e([i,o]);[i,o]=u.then?(await u)():u;const c=(e,t,n)=>l(t,n.time_zone).format(e),l=(0,a.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,o.wj)(e.time_zone,t)})),m=(e,t,n)=>g(t,n.time_zone).format(e),g=(0,a.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:(0,s.J)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,o.wj)(e.time_zone,t)})),y=(e,t,n)=>d(t,n.time_zone).format(e),d=(0,a.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:(0,s.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,o.wj)(e.time_zone,t)})),_=(e,t,n)=>f(t,n.time_zone).format(e),f=(0,a.A)((e,t)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,o.wj)(e.time_zone,t)}));r()}catch(c){r(c)}})},8480:function(e,t,n){n.a(e,async function(e,r){try{n.d(t,{fL:function(){return y},n2:function(){return d},wj:function(){return _}});var i,a,o,s=n(74487),u=n(29079),c=n(46927),l=e([s]);s=(l.then?(await l)():l)[0];const m=null===(i=Intl.DateTimeFormat)||void 0===i||null===(a=(o=i.call(Intl)).resolvedOptions)||void 0===a?void 0:a.call(o).timeZone,g=m&&("UTC"===m||"Etc/UTC"===m||m in u)?m:void 0,y=14881==n.j?void 0!==g:null,d=null!=g?g:"UTC",_=(e,t)=>e===c.Wj.local&&g?d:t;r()}catch(m){r(m)}})},69543:function(e,t,n){n.d(t,{J:function(){return a}});n(74423);var r=n(22786),i=n(46927);const a=(0,r.A)(e=>{if(e.time_format===i.Hg.language||e.time_format===i.Hg.system){const t=e.time_format===i.Hg.language?e.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(t).includes("10")}return e.time_format===i.Hg.am_pm})},96029:function(e,t,n){n.d(t,{Tq:function(){return o},Z:function(){return i},ZV:function(){return r},sj:function(){return a}});const r=["sun","mon","tue","wed","thu","fri","sat"],i=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],a={0:"sun",1:"mon",2:"tue",3:"wed",4:"thu",5:"fri",6:"sat"},o={sun:"sunday",mon:"monday",tue:"tuesday",wed:"wednesday",thu:"thursday",fri:"friday",sat:"saturday"}},20058:function(e,t,n){n.a(e,async function(e,r){try{n.d(t,{QL:function(){return m},ZQ:function(){return g},ZV:function(){return l},ty:function(){return u},x:function(){return s}});var i=n(74487),a=(n(74423),n(18111),n(61701),n(46927)),o=e([i]);i=(o.then?(await o)():o)[0];const s=e=>u(e.attributes),u=(e,t)=>!!e.unit_of_measurement||!!e.state_class||(t||[]).includes(e.device_class||""),c=e=>{switch(e.number_format){case a.jG.comma_decimal:return["en-US","en"];case a.jG.decimal_comma:return["de","es","it"];case a.jG.space_comma:return["fr","sv","cs"];case a.jG.quote_decimal:return["de-CH"];case a.jG.system:return;default:return e.language}},l=(e,t,n)=>m(e,t,n).map(e=>e.value).join(""),m=(e,t,n)=>{const r=t?c(t):void 0;return(null==t?void 0:t.number_format)===a.jG.none||Number.isNaN(Number(e))?Number.isNaN(Number(e))||""===e||(null==t?void 0:t.number_format)!==a.jG.none?[{type:"literal",value:e}]:new Intl.NumberFormat("en-US",y(e,Object.assign(Object.assign({},n),{},{useGrouping:!1}))).formatToParts(Number(e)):new Intl.NumberFormat(r,y(e,n)).formatToParts(Number(e))},g=(e,t)=>{var n;const r=null==t?void 0:t.display_precision;return null!=r?{maximumFractionDigits:r,minimumFractionDigits:r}:Number.isInteger(Number(null==e||null===(n=e.attributes)||void 0===n?void 0:n.step))&&Number.isInteger(Number(null==e?void 0:e.state))?{maximumFractionDigits:0}:void 0},y=(e,t)=>{const n=Object.assign({maximumFractionDigits:2},t);if("string"!=typeof e)return n;if(!t||void 0===t.minimumFractionDigits&&void 0===t.maximumFractionDigits){const t=e.indexOf(".")>-1?e.split(".")[1].length:0;n.minimumFractionDigits=t,n.maximumFractionDigits=t}return n};r()}catch(s){r(s)}})},94129:function(e,t,n){n.d(t,{b:function(){return i},e:function(){return r}});const r="energy_dashboard",i="energy_dashboard_now"},3260:function(e,t,n){n.a(e,async function(e,r){try{n.r(t),n.d(t,{EnergyOverviewViewStrategy:function(){return l}});n(44114),n(18111),n(20116),n(13579),n(3362);var i=n(40445),a=n(5124),o=n(67576),s=n(38114),u=n(94129),c=e([s]);s=(c.then?(await c)():c)[0];class l extends a.mN{static async generate(e,t){var n;const r=e.collection_key||u.e,i={type:"sections",sections:[],dense_section_placement:!0,max_columns:3,footer:{card:{type:"energy-date-selection",collection_key:r,opening_direction:"right",vertical_opening_direction:"up"}}},a=(0,s.tb)(t,{key:r});a.prefs||await a.refresh();const o=a.prefs;if(!o||0===o.device_consumption.length&&0===o.energy_sources.length)return i;const c=o.energy_sources.find(e=>!("grid"!==e.type||!e.stat_energy_from&&!e.stat_energy_to)),l=o.energy_sources.some(e=>"gas"===e.type),m=o.energy_sources.some(e=>"battery"===e.type),g=o.energy_sources.some(e=>"solar"===e.type),y=o.energy_sources.some(e=>"water"===e.type),d=null===(n=o.device_consumption_water)||void 0===n?void 0:n.length,_=o.energy_sources.find(e=>!("solar"!==e.type||!e.stat_rate)||(!("battery"!==e.type||!e.stat_rate)||"grid"===e.type&&(!!e.stat_rate||!!e.power_config)));return(c||m||g)&&i.sections.push({type:"grid",cards:[{title:t.localize("ui.panel.energy.cards.energy_distribution_title"),type:"energy-distribution",collection_key:r}]}),o.energy_sources.length&&i.sections.push({type:"grid",cards:[{title:t.localize("ui.panel.energy.cards.energy_sources_table_title"),type:"energy-sources-table",collection_key:r,show_only_totals:!0}]}),_&&i.sections.push({type:"grid",cards:[{title:t.localize("ui.panel.energy.cards.power_sources_graph_title"),type:"power-sources-graph",collection_key:r,show_legend:!1}]}),(c||m)&&i.sections.push({type:"grid",cards:[{title:t.localize("ui.panel.energy.cards.energy_usage_graph_title"),type:"energy-usage-graph",collection_key:r}]}),l&&i.sections.push({type:"grid",cards:[{title:t.localize("ui.panel.energy.cards.energy_gas_graph_title"),type:"energy-gas-graph",collection_key:r}]}),(y||d)&&i.sections.push({type:"grid",cards:[y?{title:t.localize("ui.panel.energy.cards.energy_water_graph_title"),type:"energy-water-graph",collection_key:r}:{title:t.localize("ui.panel.energy.cards.water_sankey_title"),type:"water-sankey",collection_key:r}]}),i}}l=(0,i.Cg)([(0,o.EM)("energy-overview-view-strategy")],l),r()}catch(l){r(l)}})}}]);