iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 8.55 kB
JavaScript
;(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[20984],{380:function(e,n,t){t.a(e,async function(e,i){try{t.d(n,{D:function(){return l},P:function(){return u}});t(74423);var r=t(74487),o=t(27734),s=t(46927),a=t(96029),c=e([r]);r=(c.then?(await c)():c)[0];const u=e=>e.first_weekday===s.zt.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(e.language).weekInfo.firstDay%7:(0,o.S)(e.language)%7:a.Z.includes(e.first_weekday)?a.Z.indexOf(e.first_weekday):1,l=e=>{const n=u(e);return a.Z[n]};i()}catch(u){i(u)}})},30162:function(e,n,t){t.a(e,async function(e,i){try{t.d(n,{LW:function(){return _},Xs:function(){return d},fU:function(){return u},ie:function(){return m}});var r=t(74487),o=t(22786),s=t(8480),a=t(69543),c=e([r,s]);[r,s]=c.then?(await c)():c;const u=(e,n,t)=>l(n,t.time_zone).format(e),l=(0,o.A)((e,n)=>new Intl.DateTimeFormat(e.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,a.J)(e)?"h12":"h23",timeZone:(0,s.wj)(e.time_zone,n)})),m=(e,n,t)=>g(n,t.time_zone).format(e),g=(0,o.A)((e,n)=>new Intl.DateTimeFormat(e.language,{hour:(0,a.J)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,a.J)(e)?"h12":"h23",timeZone:(0,s.wj)(e.time_zone,n)})),d=(e,n,t)=>y(n,t.time_zone).format(e),y=(0,o.A)((e,n)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:(0,a.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,a.J)(e)?"h12":"h23",timeZone:(0,s.wj)(e.time_zone,n)})),_=(e,n,t)=>f(n,t.time_zone).format(e),f=(0,o.A)((e,n)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,s.wj)(e.time_zone,n)}));i()}catch(u){i(u)}})},8480:function(e,n,t){t.a(e,async function(e,i){try{t.d(n,{fL:function(){return d},n2:function(){return y},wj:function(){return _}});var r,o,s,a=t(74487),c=t(29079),u=t(46927),l=e([a]);a=(l.then?(await l)():l)[0];const m=null===(r=Intl.DateTimeFormat)||void 0===r||null===(o=(s=r.call(Intl)).resolvedOptions)||void 0===o?void 0:o.call(s).timeZone,g=m&&("UTC"===m||"Etc/UTC"===m||m in c)?m:void 0,d=14881==t.j?void 0!==g:null,y=null!=g?g:"UTC",_=(e,n)=>e===u.Wj.local&&g?y:n;i()}catch(m){i(m)}})},69543:function(e,n,t){t.d(n,{J:function(){return o}});t(74423);var i=t(22786),r=t(46927);const o=(0,i.A)(e=>{if(e.time_format===r.Hg.language||e.time_format===r.Hg.system){const n=e.time_format===r.Hg.language?e.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(n).includes("10")}return e.time_format===r.Hg.am_pm})},96029:function(e,n,t){t.d(n,{Tq:function(){return s},Z:function(){return r},ZV:function(){return i},sj:function(){return o}});const i=["sun","mon","tue","wed","thu","fri","sat"],r=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],o={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"}},20058:function(e,n,t){t.a(e,async function(e,i){try{t.d(n,{QL:function(){return m},ZQ:function(){return g},ZV:function(){return l},ty:function(){return c},x:function(){return a}});var r=t(74487),o=(t(74423),t(18111),t(61701),t(46927)),s=e([r]);r=(s.then?(await s)():s)[0];const a=e=>c(e.attributes),c=(e,n)=>!!e.unit_of_measurement||!!e.state_class||(n||[]).includes(e.device_class||""),u=e=>{switch(e.number_format){case o.jG.comma_decimal:return["en-US","en"];case o.jG.decimal_comma:return["de","es","it"];case o.jG.space_comma:return["fr","sv","cs"];case o.jG.quote_decimal:return["de-CH"];case o.jG.system:return;default:return e.language}},l=(e,n,t)=>m(e,n,t).map(e=>e.value).join(""),m=(e,n,t)=>{const i=n?u(n):void 0;return(null==n?void 0:n.number_format)===o.jG.none||Number.isNaN(Number(e))?Number.isNaN(Number(e))||""===e||(null==n?void 0:n.number_format)!==o.jG.none?[{type:"literal",value:e}]:new Intl.NumberFormat("en-US",d(e,Object.assign(Object.assign({},t),{},{useGrouping:!1}))).formatToParts(Number(e)):new Intl.NumberFormat(i,d(e,t)).formatToParts(Number(e))},g=(e,n)=>{var t;const i=null==n?void 0:n.display_precision;return null!=i?{maximumFractionDigits:i,minimumFractionDigits:i}:Number.isInteger(Number(null==e||null===(t=e.attributes)||void 0===t?void 0:t.step))&&Number.isInteger(Number(null==e?void 0:e.state))?{maximumFractionDigits:0}:void 0},d=(e,n)=>{const t=Object.assign({maximumFractionDigits:2},n);if("string"!=typeof e)return t;if(!n||void 0===n.minimumFractionDigits&&void 0===n.maximumFractionDigits){const n=e.indexOf(".")>-1?e.split(".")[1].length:0;t.minimumFractionDigits=n,t.maximumFractionDigits=n}return t};i()}catch(a){i(a)}})},94129:function(e,n,t){t.d(n,{b:function(){return r},e:function(){return i}});const i="energy_dashboard",r="energy_dashboard_now"},86242:function(e,n,t){t.a(e,async function(e,i){try{t.r(n),t.d(n,{EnergyViewStrategy:function(){return g}});t(44114),t(18111),t(20116),t(13579),t(3362);var r=t(40445),o=t(5124),s=t(67576),a=t(38114),c=t(94129),u=t(7936),l=t(7723),m=e([a]);a=(m.then?(await m)():m)[0];class g extends o.mN{static async generate(e,n){const t=e.collection_key||c.e,i={type:"sections",sections:[],sidebar:{sections:[{cards:[]}],visibility:[l.r]},footer:{card:{type:"energy-date-selection",collection_key:t,opening_direction:"right",vertical_opening_direction:"up"}}},r=(0,a.tb)(n,{key:t});r.prefs||await r.refresh();const o=r.prefs;if(!o||0===o.device_consumption.length&&0===o.energy_sources.length)return i;const s=o.energy_sources.find(e=>!("grid"!==e.type||!e.stat_energy_from&&!e.stat_energy_to)),m=o.energy_sources.some(e=>"grid"===e.type&&!!e.stat_energy_to),g=o.energy_sources.some(e=>"solar"===e.type),d=o.energy_sources.some(e=>"battery"===e.type),y=[],_=[],f=i.sidebar.sections[0];if(s||d||g){const e={title:n.localize("ui.panel.energy.cards.energy_distribution_title"),type:"energy-distribution",collection_key:t};f.cards.push(e),i.sections.push({type:"grid",column_span:1,cards:[e],visibility:[l.B]})}if(s&&m){const e={type:"energy-grid-balance",collection_key:t};f.cards.push(e),i.sections.push({type:"grid",column_span:1,visibility:[l.B],cards:[e]})}if(m){const e={type:"energy-grid-neutrality-gauge",collection_key:t};_.push(e)}if(g){if(m){const e={type:"energy-solar-consumed-gauge",collection_key:t};_.push(e)}if(s){const e={type:"energy-self-sufficiency-gauge",collection_key:t};_.push(e)}}if(s){const e={type:"energy-carbon-consumed-gauge",collection_key:t};_.push(e)}if(_.length&&(f.cards.push({type:"grid",columns:1===_.length?1:2,cards:_}),i.sections.push({type:"grid",column_span:1,visibility:[l.B],cards:1===_.length?[_[0]]:_.map(e=>Object.assign(Object.assign({},e),{},{grid_options:{columns:6}}))})),y.push({type:"energy-compare",collection_key:t,grid_options:{columns:36}}),(s||d)&&y.push({title:n.localize("ui.panel.energy.cards.energy_usage_graph_title"),type:"energy-usage-graph",collection_key:t,grid_options:{columns:36}}),g&&y.push({title:n.localize("ui.panel.energy.cards.energy_solar_graph_title"),type:"energy-solar-graph",collection_key:t,grid_options:{columns:36}}),(s||g||d)&&y.push({title:n.localize("ui.panel.energy.cards.energy_sources_table_title"),type:"energy-sources-table",collection_key:t,types:["grid","solar","battery"],grid_options:{columns:36}}),o.device_consumption.length){const e=(0,u.V)(o.device_consumption,n,e=>e.stat_consumption);y.push({title:n.localize("ui.panel.energy.cards.energy_devices_detail_graph_title"),type:"energy-devices-detail-graph",collection_key:t,grid_options:{columns:36}}),y.push({title:n.localize("ui.panel.energy.cards.energy_devices_graph_title"),type:"energy-devices-graph",collection_key:t,grid_options:{columns:36}}),y.push({title:n.localize("ui.panel.energy.cards.energy_sankey_title"),type:"energy-sankey",collection_key:t,group_by_floor:e,group_by_area:e,grid_options:{columns:36}})}return i.sections.push({type:"grid",column_span:3,cards:y}),i}}g=(0,r.Cg)([(0,s.EM)("energy-view-strategy")],g),i()}catch(g){i(g)}})},7936:function(e,n,t){t.d(n,{V:function(){return r}});t(18111),t(61701),t(13579),t(45367),t(92731),t(62953);var i=t(28455);function r(e,n,t){if(!e.some(e=>e.included_in_stat))return!0;const r=new Map(e.map(e=>[e.stat_consumption,e]));for(const o of e){if(!o.included_in_stat)continue;const e=r.get(o.included_in_stat);if(!e)continue;const s=t(o),a=t(e);if(!s||!a)continue;const c=(0,i.EX)(s,n.entities,n.devices),u=(0,i.EX)(a,n.entities,n.devices);if(c&&u&&c!==u)return!1}return!0}},7723:function(e,n,t){t.d(n,{B:function(){return r},r:function(){return i}});const i={condition:"view_columns",min:2},r={condition:"view_columns",max:1}}}]);