UNPKG

iobroker.lovelace

Version:

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

1 lines 6.63 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[19343],{380:function(e,t,n){n.a(e,async function(e,r){try{n.d(t,{D:function(){return m},P:function(){return c}});n(74423);var i=n(74487),a=n(27734),o=n(46927),u=n(96029),s=e([i]);i=(s.then?(await s)():s)[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:u.Z.includes(e.first_weekday)?u.Z.indexOf(e.first_weekday):1,m=e=>{const t=c(e);return u.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 f},Xs:function(){return y},fU:function(){return c},ie:function(){return l}});var i=n(74487),a=n(22786),o=n(8480),u=n(69543),s=e([i,o]);[i,o]=s.then?(await s)():s;const c=(e,t,n)=>m(t,n.time_zone).format(e),m=(0,a.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,u.J)(e)?"h12":"h23",timeZone:(0,o.wj)(e.time_zone,t)})),l=(e,t,n)=>d(t,n.time_zone).format(e),d=(0,a.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:(0,u.J)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,u.J)(e)?"h12":"h23",timeZone:(0,o.wj)(e.time_zone,t)})),y=(e,t,n)=>g(t,n.time_zone).format(e),g=(0,a.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:(0,u.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,u.J)(e)?"h12":"h23",timeZone:(0,o.wj)(e.time_zone,t)})),f=(e,t,n)=>h(t,n.time_zone).format(e),h=(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 g},wj:function(){return f}});var i,a,o,u=n(74487),s=n(29079),c=n(46927),m=e([u]);u=(m.then?(await m)():m)[0];const l=null===(i=Intl.DateTimeFormat)||void 0===i||null===(a=(o=i.call(Intl)).resolvedOptions)||void 0===a?void 0:a.call(o).timeZone,d=l&&("UTC"===l||"Etc/UTC"===l||l in s)?l:void 0,y=14881==n.j?void 0!==d:null,g=null!=d?d:"UTC",f=(e,t)=>e===c.Wj.local&&d?g:t;r()}catch(l){r(l)}})},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 l},ZQ:function(){return d},ZV:function(){return m},ty:function(){return s},x:function(){return u}});var i=n(74487),a=(n(74423),n(18111),n(61701),n(46927)),o=e([i]);i=(o.then?(await o)():o)[0];const u=e=>s(e.attributes),s=(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}},m=(e,t,n)=>l(e,t,n).map(e=>e.value).join(""),l=(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))},d=(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(u){r(u)}})},94129:function(e,t,n){n.d(t,{b:function(){return i},e:function(){return r}});const r="energy_dashboard",i="energy_dashboard_now"},94429:function(e,t,n){n.a(e,async function(e,r){try{n.r(t),n.d(t,{EnergyDashboardStrategy:function(){return p}});n(74423),n(44114),n(13609),n(18111),n(13579),n(3362),n(62953);var i=n(40445),a=n(5124),o=n(67576),u=n(38114),s=n(94129),c=e([u]);u=(c.then?(await c)():c)[0];const l={path:"overview",strategy:{type:"energy-overview",collection_key:s.e}},d={path:"electricity",strategy:{type:"energy",collection_key:s.e}},y={path:"water",strategy:{type:"water",collection_key:s.e}},g={path:"gas",strategy:{type:"gas",collection_key:s.e}},f={path:"now",strategy:{type:"power",collection_key:s.b}},h={type:"panel",path:"setup",cards:[{type:"custom:energy-setup-wizard-card"}]},_={energy_sources:[],device_consumption:[],device_consumption_water:[]};class p extends a.mN{static async generate(e,t){var r;const i=await w(t);if(!i||0===i.device_consumption.length&&0===i.energy_sources.length)return await Promise.all([n.e(71380),n.e(60411)]).then(n.bind(n,97431)),{views:[h]};const a=i.energy_sources.some(e=>["grid","solar","battery"].includes(e.type)),o=i.energy_sources.some(e=>!("solar"!==e.type||!e.stat_rate)||(!("battery"!==e.type||!e.stat_rate)||"grid"===e.type&&(!!e.stat_rate||!!e.power_config))),u=i.device_consumption.some(e=>e.stat_rate),s=o||u,c=i.energy_sources.some(e=>"water"===e.type)||(null===(r=i.device_consumption_water)||void 0===r?void 0:r.length)>0,m=i.energy_sources.some(e=>"gas"===e.type),_=i.device_consumption.length>0,p=[];return(a||_)&&p.push(d),m&&p.push(g),c&&p.push(y),s&&p.push(f),(o||[a,m,c].filter(Boolean).length>1)&&p.unshift(l),{views:p.map(e=>Object.assign(Object.assign({},e),{},{title:e.title||t.localize(`ui.panel.energy.title.${e.path}`)}))}}}async function w(e){const t=(0,u.tb)(e,{key:s.e});try{await t.refresh()}catch(n){if("not_found"===n.code)return _;throw n}return t.prefs||_}p.noEditor=!0,p=(0,i.Cg)([(0,o.EM)("energy-dashboard-strategy")],p),r()}catch(m){r(m)}})}}]);