myio-js-library 0.1.72 → 0.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -13
- package/dist/index.d.cts +1 -0
- package/dist/index.js +12 -13
- package/dist/myio-js-library.umd.js +12 -13
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11401,11 +11401,13 @@ async function fetchTelemetryData(token, deviceId, startDate, endDate, queryPara
|
|
|
11401
11401
|
const data = await response.json();
|
|
11402
11402
|
return data;
|
|
11403
11403
|
}
|
|
11404
|
-
function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, aggregation) {
|
|
11404
|
+
function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, aggregation, timezoneOffset) {
|
|
11405
11405
|
const seriesKeys = keys.split(",").map((k) => k.trim());
|
|
11406
11406
|
const seriesData = [];
|
|
11407
11407
|
let globalPeak = null;
|
|
11408
11408
|
let isEmpty = true;
|
|
11409
|
+
const tzOffset = timezoneOffset !== void 0 ? timezoneOffset : -3;
|
|
11410
|
+
const tzOffsetMs = tzOffset * 60 * 60 * 1e3;
|
|
11409
11411
|
const colors = ["#4A148C", "#2196F3", "#4CAF50", "#FF9800", "#F44336", "#9C27B0", "#795548", "#607D8B"];
|
|
11410
11412
|
seriesKeys.forEach((key, index) => {
|
|
11411
11413
|
const rawSeries = rawData[key] || [];
|
|
@@ -11421,7 +11423,7 @@ function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, ag
|
|
|
11421
11423
|
for (let i = 0; i < sortedData.length; i++) {
|
|
11422
11424
|
const current = sortedData[i];
|
|
11423
11425
|
const value = parseFloat(current.value) * correctionFactor;
|
|
11424
|
-
const timestamp = current.ts;
|
|
11426
|
+
const timestamp = current.ts + tzOffsetMs;
|
|
11425
11427
|
points.push({
|
|
11426
11428
|
x: timestamp,
|
|
11427
11429
|
y: value
|
|
@@ -11439,8 +11441,9 @@ function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, ag
|
|
|
11439
11441
|
const deltaHours = (currentTs - previousTs) / (1e3 * 60 * 60);
|
|
11440
11442
|
if (deltaWh > 0 && deltaHours > 0) {
|
|
11441
11443
|
const demandKw = deltaWh / 1e3 / deltaHours * correctionFactor;
|
|
11444
|
+
const timestamp = currentTs + tzOffsetMs;
|
|
11442
11445
|
points.push({
|
|
11443
|
-
x:
|
|
11446
|
+
x: timestamp,
|
|
11444
11447
|
y: demandKw
|
|
11445
11448
|
});
|
|
11446
11449
|
}
|
|
@@ -11830,8 +11833,10 @@ async function openDemandModal(params) {
|
|
|
11830
11833
|
params.telemetryQuery?.keys || "consumption",
|
|
11831
11834
|
params.correctionFactor || 1,
|
|
11832
11835
|
locale,
|
|
11833
|
-
params.telemetryQuery?.agg || "MAX"
|
|
11836
|
+
params.telemetryQuery?.agg || "MAX",
|
|
11834
11837
|
// Pass aggregation type
|
|
11838
|
+
params.timezoneOffset
|
|
11839
|
+
// Pass timezone offset (default: -3)
|
|
11835
11840
|
);
|
|
11836
11841
|
if (chartData.isEmpty) {
|
|
11837
11842
|
errorEl.style.display = "flex";
|
|
@@ -11871,9 +11876,7 @@ async function openDemandModal(params) {
|
|
|
11871
11876
|
return date.toLocaleDateString(locale, {
|
|
11872
11877
|
day: "2-digit",
|
|
11873
11878
|
month: "2-digit",
|
|
11874
|
-
year: "numeric"
|
|
11875
|
-
hour: "2-digit",
|
|
11876
|
-
minute: "2-digit"
|
|
11879
|
+
year: "numeric"
|
|
11877
11880
|
});
|
|
11878
11881
|
},
|
|
11879
11882
|
label: function(context) {
|
|
@@ -11913,9 +11916,7 @@ async function openDemandModal(params) {
|
|
|
11913
11916
|
return date.toLocaleDateString(locale, {
|
|
11914
11917
|
day: "2-digit",
|
|
11915
11918
|
month: "2-digit",
|
|
11916
|
-
year: "numeric"
|
|
11917
|
-
hour: "2-digit",
|
|
11918
|
-
minute: "2-digit"
|
|
11919
|
+
year: "numeric"
|
|
11919
11920
|
});
|
|
11920
11921
|
},
|
|
11921
11922
|
label: function(context) {
|
|
@@ -11951,10 +11952,8 @@ async function openDemandModal(params) {
|
|
|
11951
11952
|
callback: function(value) {
|
|
11952
11953
|
const date = new Date(value);
|
|
11953
11954
|
return date.toLocaleDateString(locale, {
|
|
11954
|
-
month: "2-digit",
|
|
11955
11955
|
day: "2-digit",
|
|
11956
|
-
|
|
11957
|
-
minute: "2-digit"
|
|
11956
|
+
month: "2-digit"
|
|
11958
11957
|
});
|
|
11959
11958
|
}
|
|
11960
11959
|
}
|
package/dist/index.d.cts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11327,11 +11327,13 @@ async function fetchTelemetryData(token, deviceId, startDate, endDate, queryPara
|
|
|
11327
11327
|
const data = await response.json();
|
|
11328
11328
|
return data;
|
|
11329
11329
|
}
|
|
11330
|
-
function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, aggregation) {
|
|
11330
|
+
function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, aggregation, timezoneOffset) {
|
|
11331
11331
|
const seriesKeys = keys.split(",").map((k) => k.trim());
|
|
11332
11332
|
const seriesData = [];
|
|
11333
11333
|
let globalPeak = null;
|
|
11334
11334
|
let isEmpty = true;
|
|
11335
|
+
const tzOffset = timezoneOffset !== void 0 ? timezoneOffset : -3;
|
|
11336
|
+
const tzOffsetMs = tzOffset * 60 * 60 * 1e3;
|
|
11335
11337
|
const colors = ["#4A148C", "#2196F3", "#4CAF50", "#FF9800", "#F44336", "#9C27B0", "#795548", "#607D8B"];
|
|
11336
11338
|
seriesKeys.forEach((key, index) => {
|
|
11337
11339
|
const rawSeries = rawData[key] || [];
|
|
@@ -11347,7 +11349,7 @@ function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, ag
|
|
|
11347
11349
|
for (let i = 0; i < sortedData.length; i++) {
|
|
11348
11350
|
const current = sortedData[i];
|
|
11349
11351
|
const value = parseFloat(current.value) * correctionFactor;
|
|
11350
|
-
const timestamp = current.ts;
|
|
11352
|
+
const timestamp = current.ts + tzOffsetMs;
|
|
11351
11353
|
points.push({
|
|
11352
11354
|
x: timestamp,
|
|
11353
11355
|
y: value
|
|
@@ -11365,8 +11367,9 @@ function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, ag
|
|
|
11365
11367
|
const deltaHours = (currentTs - previousTs) / (1e3 * 60 * 60);
|
|
11366
11368
|
if (deltaWh > 0 && deltaHours > 0) {
|
|
11367
11369
|
const demandKw = deltaWh / 1e3 / deltaHours * correctionFactor;
|
|
11370
|
+
const timestamp = currentTs + tzOffsetMs;
|
|
11368
11371
|
points.push({
|
|
11369
|
-
x:
|
|
11372
|
+
x: timestamp,
|
|
11370
11373
|
y: demandKw
|
|
11371
11374
|
});
|
|
11372
11375
|
}
|
|
@@ -11756,8 +11759,10 @@ async function openDemandModal(params) {
|
|
|
11756
11759
|
params.telemetryQuery?.keys || "consumption",
|
|
11757
11760
|
params.correctionFactor || 1,
|
|
11758
11761
|
locale,
|
|
11759
|
-
params.telemetryQuery?.agg || "MAX"
|
|
11762
|
+
params.telemetryQuery?.agg || "MAX",
|
|
11760
11763
|
// Pass aggregation type
|
|
11764
|
+
params.timezoneOffset
|
|
11765
|
+
// Pass timezone offset (default: -3)
|
|
11761
11766
|
);
|
|
11762
11767
|
if (chartData.isEmpty) {
|
|
11763
11768
|
errorEl.style.display = "flex";
|
|
@@ -11797,9 +11802,7 @@ async function openDemandModal(params) {
|
|
|
11797
11802
|
return date.toLocaleDateString(locale, {
|
|
11798
11803
|
day: "2-digit",
|
|
11799
11804
|
month: "2-digit",
|
|
11800
|
-
year: "numeric"
|
|
11801
|
-
hour: "2-digit",
|
|
11802
|
-
minute: "2-digit"
|
|
11805
|
+
year: "numeric"
|
|
11803
11806
|
});
|
|
11804
11807
|
},
|
|
11805
11808
|
label: function(context) {
|
|
@@ -11839,9 +11842,7 @@ async function openDemandModal(params) {
|
|
|
11839
11842
|
return date.toLocaleDateString(locale, {
|
|
11840
11843
|
day: "2-digit",
|
|
11841
11844
|
month: "2-digit",
|
|
11842
|
-
year: "numeric"
|
|
11843
|
-
hour: "2-digit",
|
|
11844
|
-
minute: "2-digit"
|
|
11845
|
+
year: "numeric"
|
|
11845
11846
|
});
|
|
11846
11847
|
},
|
|
11847
11848
|
label: function(context) {
|
|
@@ -11877,10 +11878,8 @@ async function openDemandModal(params) {
|
|
|
11877
11878
|
callback: function(value) {
|
|
11878
11879
|
const date = new Date(value);
|
|
11879
11880
|
return date.toLocaleDateString(locale, {
|
|
11880
|
-
month: "2-digit",
|
|
11881
11881
|
day: "2-digit",
|
|
11882
|
-
|
|
11883
|
-
minute: "2-digit"
|
|
11882
|
+
month: "2-digit"
|
|
11884
11883
|
});
|
|
11885
11884
|
}
|
|
11886
11885
|
}
|
|
@@ -11316,11 +11316,13 @@
|
|
|
11316
11316
|
const data = await response.json();
|
|
11317
11317
|
return data;
|
|
11318
11318
|
}
|
|
11319
|
-
function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, aggregation) {
|
|
11319
|
+
function processMultiSeriesChartData(rawData, keys, correctionFactor, locale, aggregation, timezoneOffset) {
|
|
11320
11320
|
const seriesKeys = keys.split(",").map((k) => k.trim());
|
|
11321
11321
|
const seriesData = [];
|
|
11322
11322
|
let globalPeak = null;
|
|
11323
11323
|
let isEmpty = true;
|
|
11324
|
+
const tzOffset = timezoneOffset !== void 0 ? timezoneOffset : -3;
|
|
11325
|
+
const tzOffsetMs = tzOffset * 60 * 60 * 1e3;
|
|
11324
11326
|
const colors = ["#4A148C", "#2196F3", "#4CAF50", "#FF9800", "#F44336", "#9C27B0", "#795548", "#607D8B"];
|
|
11325
11327
|
seriesKeys.forEach((key, index) => {
|
|
11326
11328
|
const rawSeries = rawData[key] || [];
|
|
@@ -11336,7 +11338,7 @@
|
|
|
11336
11338
|
for (let i = 0; i < sortedData.length; i++) {
|
|
11337
11339
|
const current = sortedData[i];
|
|
11338
11340
|
const value = parseFloat(current.value) * correctionFactor;
|
|
11339
|
-
const timestamp = current.ts;
|
|
11341
|
+
const timestamp = current.ts + tzOffsetMs;
|
|
11340
11342
|
points.push({
|
|
11341
11343
|
x: timestamp,
|
|
11342
11344
|
y: value
|
|
@@ -11354,8 +11356,9 @@
|
|
|
11354
11356
|
const deltaHours = (currentTs - previousTs) / (1e3 * 60 * 60);
|
|
11355
11357
|
if (deltaWh > 0 && deltaHours > 0) {
|
|
11356
11358
|
const demandKw = deltaWh / 1e3 / deltaHours * correctionFactor;
|
|
11359
|
+
const timestamp = currentTs + tzOffsetMs;
|
|
11357
11360
|
points.push({
|
|
11358
|
-
x:
|
|
11361
|
+
x: timestamp,
|
|
11359
11362
|
y: demandKw
|
|
11360
11363
|
});
|
|
11361
11364
|
}
|
|
@@ -11745,8 +11748,10 @@
|
|
|
11745
11748
|
params.telemetryQuery?.keys || "consumption",
|
|
11746
11749
|
params.correctionFactor || 1,
|
|
11747
11750
|
locale,
|
|
11748
|
-
params.telemetryQuery?.agg || "MAX"
|
|
11751
|
+
params.telemetryQuery?.agg || "MAX",
|
|
11749
11752
|
// Pass aggregation type
|
|
11753
|
+
params.timezoneOffset
|
|
11754
|
+
// Pass timezone offset (default: -3)
|
|
11750
11755
|
);
|
|
11751
11756
|
if (chartData.isEmpty) {
|
|
11752
11757
|
errorEl.style.display = "flex";
|
|
@@ -11786,9 +11791,7 @@
|
|
|
11786
11791
|
return date.toLocaleDateString(locale, {
|
|
11787
11792
|
day: "2-digit",
|
|
11788
11793
|
month: "2-digit",
|
|
11789
|
-
year: "numeric"
|
|
11790
|
-
hour: "2-digit",
|
|
11791
|
-
minute: "2-digit"
|
|
11794
|
+
year: "numeric"
|
|
11792
11795
|
});
|
|
11793
11796
|
},
|
|
11794
11797
|
label: function(context) {
|
|
@@ -11828,9 +11831,7 @@
|
|
|
11828
11831
|
return date.toLocaleDateString(locale, {
|
|
11829
11832
|
day: "2-digit",
|
|
11830
11833
|
month: "2-digit",
|
|
11831
|
-
year: "numeric"
|
|
11832
|
-
hour: "2-digit",
|
|
11833
|
-
minute: "2-digit"
|
|
11834
|
+
year: "numeric"
|
|
11834
11835
|
});
|
|
11835
11836
|
},
|
|
11836
11837
|
label: function(context) {
|
|
@@ -11866,10 +11867,8 @@
|
|
|
11866
11867
|
callback: function(value) {
|
|
11867
11868
|
const date = new Date(value);
|
|
11868
11869
|
return date.toLocaleDateString(locale, {
|
|
11869
|
-
month: "2-digit",
|
|
11870
11870
|
day: "2-digit",
|
|
11871
|
-
|
|
11872
|
-
minute: "2-digit"
|
|
11871
|
+
month: "2-digit"
|
|
11873
11872
|
});
|
|
11874
11873
|
}
|
|
11875
11874
|
}
|