iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 5.79 kB
JavaScript
export const __rspack_esm_id=19343;export const __rspack_esm_ids=[19343];export const __webpack_modules__={380(e,t,n){n.d(t,{D:()=>s,P:()=>o});n(74423);var a=n(67932),r=n(46927),i=n(96029);const o=e=>e.first_weekday===r.zt.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(e.language).weekInfo.firstDay%7:(0,a.S)(e.language)%7:i.Z.includes(e.first_weekday)?i.Z.indexOf(e.first_weekday):1,s=e=>{const t=o(e);return i.Z[t]}},30162(e,t,n){n.a(e,async function(e,a){try{n.d(t,{LW:()=>_,Xs:()=>l,fU:()=>u,ie:()=>d});var r=n(74487),i=n(22786),o=n(8480),s=n(69543),m=e([r,o]);[r,o]=m.then?(await m)():m;const u=(e,t,n)=>c(t,n.time_zone).format(e),c=(0,i.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)})),d=(e,t,n)=>y(t,n.time_zone).format(e),y=(0,i.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)})),l=(e,t,n)=>g(t,n.time_zone).format(e),g=(0,i.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)=>p(t,n.time_zone).format(e),p=(0,i.A)((e,t)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,o.wj)(e.time_zone,t)}));a()}catch(e){a(e)}})},8480(e,t,n){n.a(e,async function(e,a){try{n.d(t,{fL:()=>c,n2:()=>d,wj:()=>y});var r=n(74487),i=n(29079),o=n(46927),s=e([r]);r=(s.then?(await s)():s)[0];const m=Intl.DateTimeFormat?.().resolvedOptions?.().timeZone,u=m&&("UTC"===m||"Etc/UTC"===m||m in i)?m:void 0,c=14881==n.j?void 0!==u:null,d=u??"UTC",y=(e,t)=>e===o.Wj.local&&u?d:t;a()}catch(e){a(e)}})},69543(e,t,n){n.d(t,{J:()=>i});n(74423);var a=n(22786),r=n(46927);const i=(0,a.A)(e=>{if(e.time_format===r.Hg.language||e.time_format===r.Hg.system){const t=e.time_format===r.Hg.language?e.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(t).includes("10")}return e.time_format===r.Hg.am_pm})},96029(e,t,n){n.d(t,{Tq:()=>o,Z:()=>r,ZV:()=>a,sj:()=>i});const a=["sun","mon","tue","wed","thu","fri","sat"],r=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],i={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(e,t,n){n.a(e,async function(e,a){try{n.d(t,{QL:()=>d,ZQ:()=>y,ZV:()=>c,ty:()=>m,x:()=>s});var r=n(74487),i=(n(74423),n(18111),n(61701),n(46927)),o=e([r]);r=(o.then?(await o)():o)[0];const s=e=>m(e.attributes),m=(e,t)=>!!e.unit_of_measurement||!!e.state_class||(t||[]).includes(e.device_class||""),u=e=>{switch(e.number_format){case i.jG.comma_decimal:return["en-US","en"];case i.jG.decimal_comma:return["de","es","it"];case i.jG.space_comma:return["fr","sv","cs"];case i.jG.quote_decimal:return["de-CH"];case i.jG.system:return;default:return e.language}},c=(e,t,n)=>d(e,t,n).map(e=>e.value).join(""),d=(e,t,n)=>{const a=t?u(t):void 0;return t?.number_format===i.jG.none||Number.isNaN(Number(e))?Number.isNaN(Number(e))||""===e||t?.number_format!==i.jG.none?[{type:"literal",value:e}]:new Intl.NumberFormat("en-US",l(e,{...n,useGrouping:!1})).formatToParts(Number(e)):new Intl.NumberFormat(a,l(e,n)).formatToParts(Number(e))},y=(e,t)=>{const n=t?.display_precision;return null!=n?{maximumFractionDigits:n,minimumFractionDigits:n}:Number.isInteger(Number(e?.attributes?.step))&&Number.isInteger(Number(e?.state))?{maximumFractionDigits:0}:void 0},l=(e,t)=>{const n={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};a()}catch(e){a(e)}})},94129(e,t,n){n.d(t,{b:()=>r,e:()=>a});const a="energy_dashboard",r="energy_dashboard_now"},94429(e,t,n){n.a(e,async function(e,a){try{n.r(t),n.d(t,{EnergyDashboardStrategy:()=>h});n(74423),n(44114),n(18111),n(13579);var r=n(62826),i=n(5124),o=n(22441),s=n(38114),m=n(94129),u=e([s]);s=(u.then?(await u)():u)[0];const c={path:"overview",strategy:{type:"energy-overview",collection_key:m.e}},d={path:"electricity",strategy:{type:"energy",collection_key:m.e}},y={path:"water",strategy:{type:"water",collection_key:m.e}},l={path:"gas",strategy:{type:"gas",collection_key:m.e}},g={path:"now",strategy:{type:"power",collection_key:m.b}},_={type:"panel",path:"setup",cards:[{type:"custom:energy-setup-wizard-card"}]},p={energy_sources:[],device_consumption:[],device_consumption_water:[]};class h extends i.mN{static async generate(e,t){const a=await f(t);if(!a||0===a.device_consumption.length&&0===a.energy_sources.length)return await Promise.all([n.e(71380),n.e(60411)]).then(n.bind(n,97431)),{views:[_]};const r=a.energy_sources.some(e=>["grid","solar","battery"].includes(e.type)),i=a.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))),o=a.device_consumption.some(e=>e.stat_rate),s=i||o,m=a.energy_sources.some(e=>"water"===e.type)||a.device_consumption_water?.length>0,u=a.energy_sources.some(e=>"gas"===e.type),p=a.device_consumption.length>0,h=[];return(r||p)&&h.push(d),u&&h.push(l),m&&h.push(y),s&&h.push(g),(i||[r,u,m].filter(Boolean).length>1)&&h.unshift(c),{views:h.map(e=>({...e,title:e.title||t.localize(`ui.panel.energy.title.${e.path}`)}))}}}async function f(e){const t=(0,s.tb)(e,{key:m.e});try{await t.refresh()}catch(e){if("not_found"===e.code)return p;throw e}return t.prefs||p}h.noEditor=!0,h=(0,r.Cg)([(0,o.EM)("energy-dashboard-strategy")],h),a()}catch(w){a(w)}})}};