myio-js-library 0.1.154 → 0.1.156
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 +30 -19
- package/dist/index.js +30 -19
- package/dist/myio-js-library.umd.js +30 -19
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -620,7 +620,7 @@ __export(index_exports, {
|
|
|
620
620
|
formatEnergy: () => formatEnergy,
|
|
621
621
|
formatNumberReadable: () => formatNumberReadable,
|
|
622
622
|
formatTankHeadFromCm: () => formatTankHeadFromCm,
|
|
623
|
-
formatTemperature: () =>
|
|
623
|
+
formatTemperature: () => formatTemperature2,
|
|
624
624
|
formatWaterByGroup: () => formatWaterByGroup,
|
|
625
625
|
formatWaterVolumeM3: () => formatWaterVolumeM3,
|
|
626
626
|
getAuthCacheStats: () => getAuthCacheStats,
|
|
@@ -4862,6 +4862,8 @@ function normalizeParams(params) {
|
|
|
4862
4862
|
enableSelection: Boolean(params.enableSelection),
|
|
4863
4863
|
enableDragDrop: Boolean(params.enableDragDrop),
|
|
4864
4864
|
useNewComponents: Boolean(params.useNewComponents),
|
|
4865
|
+
// RFC-0091: Configurable delay time for connection status check (default 15 minutes)
|
|
4866
|
+
delayTimeConnectionInMins: params.delayTimeConnectionInMins ?? 15,
|
|
4865
4867
|
callbacks: {
|
|
4866
4868
|
handleActionDashboard: params.handleActionDashboard,
|
|
4867
4869
|
handleActionReport: params.handleActionReport,
|
|
@@ -4892,8 +4894,17 @@ function formatValueByDomain(value, domain) {
|
|
|
4892
4894
|
if (domain === "water") {
|
|
4893
4895
|
return formatWaterVolumeM3(value);
|
|
4894
4896
|
}
|
|
4897
|
+
if (domain === "temperature") {
|
|
4898
|
+
return formatTemperature(value);
|
|
4899
|
+
}
|
|
4895
4900
|
return formatEnergy(value);
|
|
4896
4901
|
}
|
|
4902
|
+
function formatTemperature(temp) {
|
|
4903
|
+
if (temp === null || temp === void 0 || isNaN(temp)) {
|
|
4904
|
+
return "\u2014";
|
|
4905
|
+
}
|
|
4906
|
+
return `${temp.toFixed(0)}\xB0C`;
|
|
4907
|
+
}
|
|
4897
4908
|
function calculateConsumptionPercentage(target, consumption) {
|
|
4898
4909
|
const numericTarget = Number(target);
|
|
4899
4910
|
const numericConsumption = Number(consumption);
|
|
@@ -5107,23 +5118,23 @@ function buildDOM(state) {
|
|
|
5107
5118
|
root.appendChild(footer);
|
|
5108
5119
|
return root;
|
|
5109
5120
|
}
|
|
5110
|
-
function verifyOfflineStatus(entityObject) {
|
|
5121
|
+
function verifyOfflineStatus(entityObject, delayTimeInMins = 15) {
|
|
5111
5122
|
const lastConnectionTime = new Date(entityObject.lastConnectTime || 0);
|
|
5112
5123
|
const lastDisconnectTime = new Date(entityObject.lastDisconnectTime || 0);
|
|
5113
5124
|
const now = /* @__PURE__ */ new Date();
|
|
5114
|
-
const
|
|
5125
|
+
const delayTimeInMs = delayTimeInMins * 60 * 1e3;
|
|
5115
5126
|
const timeSinceConnection = now.getTime() - lastConnectionTime.getTime();
|
|
5116
5127
|
if (lastDisconnectTime.getTime() > lastConnectionTime.getTime()) {
|
|
5117
5128
|
return false;
|
|
5118
5129
|
}
|
|
5119
|
-
if (timeSinceConnection <
|
|
5130
|
+
if (timeSinceConnection < delayTimeInMs) {
|
|
5120
5131
|
return false;
|
|
5121
5132
|
}
|
|
5122
5133
|
return true;
|
|
5123
5134
|
}
|
|
5124
5135
|
function paint(root, state) {
|
|
5125
|
-
const { entityObject, i18n } = state;
|
|
5126
|
-
if (verifyOfflineStatus(entityObject) === false) {
|
|
5136
|
+
const { entityObject, i18n, delayTimeConnectionInMins } = state;
|
|
5137
|
+
if (verifyOfflineStatus(entityObject, delayTimeConnectionInMins) === false) {
|
|
5127
5138
|
entityObject.deviceStatus = DeviceStatusType.NO_INFO;
|
|
5128
5139
|
}
|
|
5129
5140
|
const stateClass = getCardStateClass(entityObject.deviceStatus);
|
|
@@ -19978,7 +19989,7 @@ function getSelectedPeriodsLabel(selectedPeriods) {
|
|
|
19978
19989
|
}
|
|
19979
19990
|
return `${selectedPeriods.length} per\xEDodos selecionados`;
|
|
19980
19991
|
}
|
|
19981
|
-
function
|
|
19992
|
+
function formatTemperature2(value, decimals = 1) {
|
|
19982
19993
|
return `${value.toFixed(decimals)}\xB0C`;
|
|
19983
19994
|
}
|
|
19984
19995
|
function exportTemperatureCSV(data, deviceLabel, stats, startDate, endDate) {
|
|
@@ -19992,11 +20003,11 @@ function exportTemperatureCSV(data, deviceLabel, stats, startDate, endDate) {
|
|
|
19992
20003
|
`;
|
|
19993
20004
|
csvContent += `Per\xEDodo: ${startDate} at\xE9 ${endDate}
|
|
19994
20005
|
`;
|
|
19995
|
-
csvContent += `M\xE9dia: ${
|
|
20006
|
+
csvContent += `M\xE9dia: ${formatTemperature2(stats.avg)}
|
|
19996
20007
|
`;
|
|
19997
|
-
csvContent += `M\xEDnima: ${
|
|
20008
|
+
csvContent += `M\xEDnima: ${formatTemperature2(stats.min)}
|
|
19998
20009
|
`;
|
|
19999
|
-
csvContent += `M\xE1xima: ${
|
|
20010
|
+
csvContent += `M\xE1xima: ${formatTemperature2(stats.max)}
|
|
20000
20011
|
`;
|
|
20001
20012
|
csvContent += `Total de leituras: ${stats.count}
|
|
20002
20013
|
`;
|
|
@@ -20287,7 +20298,7 @@ function renderModal(container, state, modalId, error) {
|
|
|
20287
20298
|
">
|
|
20288
20299
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">Temperatura Atual</span>
|
|
20289
20300
|
<div style="font-weight: 700; font-size: 24px; color: ${statusColor}; margin-top: 4px;">
|
|
20290
|
-
${state.currentTemperature !== null ?
|
|
20301
|
+
${state.currentTemperature !== null ? formatTemperature2(state.currentTemperature) : "N/A"}
|
|
20291
20302
|
</div>
|
|
20292
20303
|
<div style="font-size: 11px; color: ${statusColor}; margin-top: 2px;">${statusText}</div>
|
|
20293
20304
|
</div>
|
|
@@ -20298,7 +20309,7 @@ function renderModal(container, state, modalId, error) {
|
|
|
20298
20309
|
">
|
|
20299
20310
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">M\xE9dia do Per\xEDodo</span>
|
|
20300
20311
|
<div id="${modalId}-avg" style="font-weight: 600; font-size: 20px; color: ${colors.text}; margin-top: 4px;">
|
|
20301
|
-
${state.stats.count > 0 ?
|
|
20312
|
+
${state.stats.count > 0 ? formatTemperature2(state.stats.avg) : "N/A"}
|
|
20302
20313
|
</div>
|
|
20303
20314
|
<div style="font-size: 11px; color: ${colors.textMuted}; margin-top: 2px;">${startDateStr} - ${endDateStr}</div>
|
|
20304
20315
|
</div>
|
|
@@ -20309,7 +20320,7 @@ function renderModal(container, state, modalId, error) {
|
|
|
20309
20320
|
">
|
|
20310
20321
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">Min / Max</span>
|
|
20311
20322
|
<div id="${modalId}-minmax" style="font-weight: 600; font-size: 20px; color: ${colors.text}; margin-top: 4px;">
|
|
20312
|
-
${state.stats.count > 0 ? `${
|
|
20323
|
+
${state.stats.count > 0 ? `${formatTemperature2(state.stats.min)} / ${formatTemperature2(state.stats.max)}` : "N/A"}
|
|
20313
20324
|
</div>
|
|
20314
20325
|
<div style="font-size: 11px; color: ${colors.textMuted}; margin-top: 2px;">${state.stats.count} leituras</div>
|
|
20315
20326
|
</div>
|
|
@@ -20609,7 +20620,7 @@ function setupChartTooltip(canvas, container, chartData, state, colors) {
|
|
|
20609
20620
|
}
|
|
20610
20621
|
tooltip.innerHTML = `
|
|
20611
20622
|
<div style="font-weight: 600; margin-bottom: 6px; color: ${colors.primary};">
|
|
20612
|
-
${
|
|
20623
|
+
${formatTemperature2(point.y)}
|
|
20613
20624
|
</div>
|
|
20614
20625
|
<div style="font-size: 11px; color: ${colors.textMuted};">
|
|
20615
20626
|
\u{1F4C5} ${dateStr}
|
|
@@ -20872,7 +20883,7 @@ function renderModal2(container, state, modalId) {
|
|
|
20872
20883
|
<span style="width: 12px; height: 12px; border-radius: 50%; background: ${dd.color};"></span>
|
|
20873
20884
|
<span style="color: ${colors.text}; font-size: 13px;">${dd.device.label}</span>
|
|
20874
20885
|
<span style="color: ${colors.textMuted}; font-size: 11px; margin-left: auto;">
|
|
20875
|
-
${dd.stats.count > 0 ?
|
|
20886
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.avg) : "N/A"}
|
|
20876
20887
|
</span>
|
|
20877
20888
|
</div>
|
|
20878
20889
|
`).join("");
|
|
@@ -20888,15 +20899,15 @@ function renderModal2(container, state, modalId) {
|
|
|
20888
20899
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 4px; font-size: 11px;">
|
|
20889
20900
|
<span style="color: ${colors.textMuted};">M\xE9dia:</span>
|
|
20890
20901
|
<span style="color: ${colors.text}; font-weight: 500;">
|
|
20891
|
-
${dd.stats.count > 0 ?
|
|
20902
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.avg) : "N/A"}
|
|
20892
20903
|
</span>
|
|
20893
20904
|
<span style="color: ${colors.textMuted};">Min:</span>
|
|
20894
20905
|
<span style="color: ${colors.text};">
|
|
20895
|
-
${dd.stats.count > 0 ?
|
|
20906
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.min) : "N/A"}
|
|
20896
20907
|
</span>
|
|
20897
20908
|
<span style="color: ${colors.textMuted};">Max:</span>
|
|
20898
20909
|
<span style="color: ${colors.text};">
|
|
20899
|
-
${dd.stats.count > 0 ?
|
|
20910
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.max) : "N/A"}
|
|
20900
20911
|
</span>
|
|
20901
20912
|
<span style="color: ${colors.textMuted};">Leituras:</span>
|
|
20902
20913
|
<span style="color: ${colors.text};">${dd.stats.count}</span>
|
|
@@ -21432,7 +21443,7 @@ function setupComparisonChartTooltip(canvas, container, chartData, state, colors
|
|
|
21432
21443
|
<span style="font-weight: 600;">${point.deviceLabel}</span>
|
|
21433
21444
|
</div>
|
|
21434
21445
|
<div style="font-weight: 600; font-size: 16px; color: ${point.deviceColor}; margin-bottom: 4px;">
|
|
21435
|
-
${
|
|
21446
|
+
${formatTemperature2(point.y)}
|
|
21436
21447
|
</div>
|
|
21437
21448
|
<div style="font-size: 11px; color: ${colors.textMuted};">
|
|
21438
21449
|
\u{1F4C5} ${dateStr}
|
package/dist/index.js
CHANGED
|
@@ -4754,6 +4754,8 @@ function normalizeParams(params) {
|
|
|
4754
4754
|
enableSelection: Boolean(params.enableSelection),
|
|
4755
4755
|
enableDragDrop: Boolean(params.enableDragDrop),
|
|
4756
4756
|
useNewComponents: Boolean(params.useNewComponents),
|
|
4757
|
+
// RFC-0091: Configurable delay time for connection status check (default 15 minutes)
|
|
4758
|
+
delayTimeConnectionInMins: params.delayTimeConnectionInMins ?? 15,
|
|
4757
4759
|
callbacks: {
|
|
4758
4760
|
handleActionDashboard: params.handleActionDashboard,
|
|
4759
4761
|
handleActionReport: params.handleActionReport,
|
|
@@ -4784,8 +4786,17 @@ function formatValueByDomain(value, domain) {
|
|
|
4784
4786
|
if (domain === "water") {
|
|
4785
4787
|
return formatWaterVolumeM3(value);
|
|
4786
4788
|
}
|
|
4789
|
+
if (domain === "temperature") {
|
|
4790
|
+
return formatTemperature(value);
|
|
4791
|
+
}
|
|
4787
4792
|
return formatEnergy(value);
|
|
4788
4793
|
}
|
|
4794
|
+
function formatTemperature(temp) {
|
|
4795
|
+
if (temp === null || temp === void 0 || isNaN(temp)) {
|
|
4796
|
+
return "\u2014";
|
|
4797
|
+
}
|
|
4798
|
+
return `${temp.toFixed(0)}\xB0C`;
|
|
4799
|
+
}
|
|
4789
4800
|
function calculateConsumptionPercentage(target, consumption) {
|
|
4790
4801
|
const numericTarget = Number(target);
|
|
4791
4802
|
const numericConsumption = Number(consumption);
|
|
@@ -4999,23 +5010,23 @@ function buildDOM(state) {
|
|
|
4999
5010
|
root.appendChild(footer);
|
|
5000
5011
|
return root;
|
|
5001
5012
|
}
|
|
5002
|
-
function verifyOfflineStatus(entityObject) {
|
|
5013
|
+
function verifyOfflineStatus(entityObject, delayTimeInMins = 15) {
|
|
5003
5014
|
const lastConnectionTime = new Date(entityObject.lastConnectTime || 0);
|
|
5004
5015
|
const lastDisconnectTime = new Date(entityObject.lastDisconnectTime || 0);
|
|
5005
5016
|
const now = /* @__PURE__ */ new Date();
|
|
5006
|
-
const
|
|
5017
|
+
const delayTimeInMs = delayTimeInMins * 60 * 1e3;
|
|
5007
5018
|
const timeSinceConnection = now.getTime() - lastConnectionTime.getTime();
|
|
5008
5019
|
if (lastDisconnectTime.getTime() > lastConnectionTime.getTime()) {
|
|
5009
5020
|
return false;
|
|
5010
5021
|
}
|
|
5011
|
-
if (timeSinceConnection <
|
|
5022
|
+
if (timeSinceConnection < delayTimeInMs) {
|
|
5012
5023
|
return false;
|
|
5013
5024
|
}
|
|
5014
5025
|
return true;
|
|
5015
5026
|
}
|
|
5016
5027
|
function paint(root, state) {
|
|
5017
|
-
const { entityObject, i18n } = state;
|
|
5018
|
-
if (verifyOfflineStatus(entityObject) === false) {
|
|
5028
|
+
const { entityObject, i18n, delayTimeConnectionInMins } = state;
|
|
5029
|
+
if (verifyOfflineStatus(entityObject, delayTimeConnectionInMins) === false) {
|
|
5019
5030
|
entityObject.deviceStatus = DeviceStatusType.NO_INFO;
|
|
5020
5031
|
}
|
|
5021
5032
|
const stateClass = getCardStateClass(entityObject.deviceStatus);
|
|
@@ -19870,7 +19881,7 @@ function getSelectedPeriodsLabel(selectedPeriods) {
|
|
|
19870
19881
|
}
|
|
19871
19882
|
return `${selectedPeriods.length} per\xEDodos selecionados`;
|
|
19872
19883
|
}
|
|
19873
|
-
function
|
|
19884
|
+
function formatTemperature2(value, decimals = 1) {
|
|
19874
19885
|
return `${value.toFixed(decimals)}\xB0C`;
|
|
19875
19886
|
}
|
|
19876
19887
|
function exportTemperatureCSV(data, deviceLabel, stats, startDate, endDate) {
|
|
@@ -19884,11 +19895,11 @@ function exportTemperatureCSV(data, deviceLabel, stats, startDate, endDate) {
|
|
|
19884
19895
|
`;
|
|
19885
19896
|
csvContent += `Per\xEDodo: ${startDate} at\xE9 ${endDate}
|
|
19886
19897
|
`;
|
|
19887
|
-
csvContent += `M\xE9dia: ${
|
|
19898
|
+
csvContent += `M\xE9dia: ${formatTemperature2(stats.avg)}
|
|
19888
19899
|
`;
|
|
19889
|
-
csvContent += `M\xEDnima: ${
|
|
19900
|
+
csvContent += `M\xEDnima: ${formatTemperature2(stats.min)}
|
|
19890
19901
|
`;
|
|
19891
|
-
csvContent += `M\xE1xima: ${
|
|
19902
|
+
csvContent += `M\xE1xima: ${formatTemperature2(stats.max)}
|
|
19892
19903
|
`;
|
|
19893
19904
|
csvContent += `Total de leituras: ${stats.count}
|
|
19894
19905
|
`;
|
|
@@ -20179,7 +20190,7 @@ function renderModal(container, state, modalId, error) {
|
|
|
20179
20190
|
">
|
|
20180
20191
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">Temperatura Atual</span>
|
|
20181
20192
|
<div style="font-weight: 700; font-size: 24px; color: ${statusColor}; margin-top: 4px;">
|
|
20182
|
-
${state.currentTemperature !== null ?
|
|
20193
|
+
${state.currentTemperature !== null ? formatTemperature2(state.currentTemperature) : "N/A"}
|
|
20183
20194
|
</div>
|
|
20184
20195
|
<div style="font-size: 11px; color: ${statusColor}; margin-top: 2px;">${statusText}</div>
|
|
20185
20196
|
</div>
|
|
@@ -20190,7 +20201,7 @@ function renderModal(container, state, modalId, error) {
|
|
|
20190
20201
|
">
|
|
20191
20202
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">M\xE9dia do Per\xEDodo</span>
|
|
20192
20203
|
<div id="${modalId}-avg" style="font-weight: 600; font-size: 20px; color: ${colors.text}; margin-top: 4px;">
|
|
20193
|
-
${state.stats.count > 0 ?
|
|
20204
|
+
${state.stats.count > 0 ? formatTemperature2(state.stats.avg) : "N/A"}
|
|
20194
20205
|
</div>
|
|
20195
20206
|
<div style="font-size: 11px; color: ${colors.textMuted}; margin-top: 2px;">${startDateStr} - ${endDateStr}</div>
|
|
20196
20207
|
</div>
|
|
@@ -20201,7 +20212,7 @@ function renderModal(container, state, modalId, error) {
|
|
|
20201
20212
|
">
|
|
20202
20213
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">Min / Max</span>
|
|
20203
20214
|
<div id="${modalId}-minmax" style="font-weight: 600; font-size: 20px; color: ${colors.text}; margin-top: 4px;">
|
|
20204
|
-
${state.stats.count > 0 ? `${
|
|
20215
|
+
${state.stats.count > 0 ? `${formatTemperature2(state.stats.min)} / ${formatTemperature2(state.stats.max)}` : "N/A"}
|
|
20205
20216
|
</div>
|
|
20206
20217
|
<div style="font-size: 11px; color: ${colors.textMuted}; margin-top: 2px;">${state.stats.count} leituras</div>
|
|
20207
20218
|
</div>
|
|
@@ -20501,7 +20512,7 @@ function setupChartTooltip(canvas, container, chartData, state, colors) {
|
|
|
20501
20512
|
}
|
|
20502
20513
|
tooltip.innerHTML = `
|
|
20503
20514
|
<div style="font-weight: 600; margin-bottom: 6px; color: ${colors.primary};">
|
|
20504
|
-
${
|
|
20515
|
+
${formatTemperature2(point.y)}
|
|
20505
20516
|
</div>
|
|
20506
20517
|
<div style="font-size: 11px; color: ${colors.textMuted};">
|
|
20507
20518
|
\u{1F4C5} ${dateStr}
|
|
@@ -20764,7 +20775,7 @@ function renderModal2(container, state, modalId) {
|
|
|
20764
20775
|
<span style="width: 12px; height: 12px; border-radius: 50%; background: ${dd.color};"></span>
|
|
20765
20776
|
<span style="color: ${colors.text}; font-size: 13px;">${dd.device.label}</span>
|
|
20766
20777
|
<span style="color: ${colors.textMuted}; font-size: 11px; margin-left: auto;">
|
|
20767
|
-
${dd.stats.count > 0 ?
|
|
20778
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.avg) : "N/A"}
|
|
20768
20779
|
</span>
|
|
20769
20780
|
</div>
|
|
20770
20781
|
`).join("");
|
|
@@ -20780,15 +20791,15 @@ function renderModal2(container, state, modalId) {
|
|
|
20780
20791
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 4px; font-size: 11px;">
|
|
20781
20792
|
<span style="color: ${colors.textMuted};">M\xE9dia:</span>
|
|
20782
20793
|
<span style="color: ${colors.text}; font-weight: 500;">
|
|
20783
|
-
${dd.stats.count > 0 ?
|
|
20794
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.avg) : "N/A"}
|
|
20784
20795
|
</span>
|
|
20785
20796
|
<span style="color: ${colors.textMuted};">Min:</span>
|
|
20786
20797
|
<span style="color: ${colors.text};">
|
|
20787
|
-
${dd.stats.count > 0 ?
|
|
20798
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.min) : "N/A"}
|
|
20788
20799
|
</span>
|
|
20789
20800
|
<span style="color: ${colors.textMuted};">Max:</span>
|
|
20790
20801
|
<span style="color: ${colors.text};">
|
|
20791
|
-
${dd.stats.count > 0 ?
|
|
20802
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.max) : "N/A"}
|
|
20792
20803
|
</span>
|
|
20793
20804
|
<span style="color: ${colors.textMuted};">Leituras:</span>
|
|
20794
20805
|
<span style="color: ${colors.text};">${dd.stats.count}</span>
|
|
@@ -21324,7 +21335,7 @@ function setupComparisonChartTooltip(canvas, container, chartData, state, colors
|
|
|
21324
21335
|
<span style="font-weight: 600;">${point.deviceLabel}</span>
|
|
21325
21336
|
</div>
|
|
21326
21337
|
<div style="font-weight: 600; font-size: 16px; color: ${point.deviceColor}; margin-bottom: 4px;">
|
|
21327
|
-
${
|
|
21338
|
+
${formatTemperature2(point.y)}
|
|
21328
21339
|
</div>
|
|
21329
21340
|
<div style="font-size: 11px; color: ${colors.textMuted};">
|
|
21330
21341
|
\u{1F4C5} ${dateStr}
|
|
@@ -22100,7 +22111,7 @@ export {
|
|
|
22100
22111
|
formatEnergy,
|
|
22101
22112
|
formatNumberReadable,
|
|
22102
22113
|
formatTankHeadFromCm,
|
|
22103
|
-
formatTemperature,
|
|
22114
|
+
formatTemperature2 as formatTemperature,
|
|
22104
22115
|
formatWaterByGroup,
|
|
22105
22116
|
formatWaterVolumeM3,
|
|
22106
22117
|
getAuthCacheStats,
|
|
@@ -4746,6 +4746,8 @@
|
|
|
4746
4746
|
enableSelection: Boolean(params.enableSelection),
|
|
4747
4747
|
enableDragDrop: Boolean(params.enableDragDrop),
|
|
4748
4748
|
useNewComponents: Boolean(params.useNewComponents),
|
|
4749
|
+
// RFC-0091: Configurable delay time for connection status check (default 15 minutes)
|
|
4750
|
+
delayTimeConnectionInMins: params.delayTimeConnectionInMins ?? 15,
|
|
4749
4751
|
callbacks: {
|
|
4750
4752
|
handleActionDashboard: params.handleActionDashboard,
|
|
4751
4753
|
handleActionReport: params.handleActionReport,
|
|
@@ -4776,8 +4778,17 @@
|
|
|
4776
4778
|
if (domain === "water") {
|
|
4777
4779
|
return formatWaterVolumeM3(value);
|
|
4778
4780
|
}
|
|
4781
|
+
if (domain === "temperature") {
|
|
4782
|
+
return formatTemperature(value);
|
|
4783
|
+
}
|
|
4779
4784
|
return formatEnergy(value);
|
|
4780
4785
|
}
|
|
4786
|
+
function formatTemperature(temp) {
|
|
4787
|
+
if (temp === null || temp === void 0 || isNaN(temp)) {
|
|
4788
|
+
return "\u2014";
|
|
4789
|
+
}
|
|
4790
|
+
return `${temp.toFixed(0)}\xB0C`;
|
|
4791
|
+
}
|
|
4781
4792
|
function calculateConsumptionPercentage(target, consumption) {
|
|
4782
4793
|
const numericTarget = Number(target);
|
|
4783
4794
|
const numericConsumption = Number(consumption);
|
|
@@ -4991,23 +5002,23 @@
|
|
|
4991
5002
|
root.appendChild(footer);
|
|
4992
5003
|
return root;
|
|
4993
5004
|
}
|
|
4994
|
-
function verifyOfflineStatus(entityObject) {
|
|
5005
|
+
function verifyOfflineStatus(entityObject, delayTimeInMins = 15) {
|
|
4995
5006
|
const lastConnectionTime = new Date(entityObject.lastConnectTime || 0);
|
|
4996
5007
|
const lastDisconnectTime = new Date(entityObject.lastDisconnectTime || 0);
|
|
4997
5008
|
const now = /* @__PURE__ */ new Date();
|
|
4998
|
-
const
|
|
5009
|
+
const delayTimeInMs = delayTimeInMins * 60 * 1e3;
|
|
4999
5010
|
const timeSinceConnection = now.getTime() - lastConnectionTime.getTime();
|
|
5000
5011
|
if (lastDisconnectTime.getTime() > lastConnectionTime.getTime()) {
|
|
5001
5012
|
return false;
|
|
5002
5013
|
}
|
|
5003
|
-
if (timeSinceConnection <
|
|
5014
|
+
if (timeSinceConnection < delayTimeInMs) {
|
|
5004
5015
|
return false;
|
|
5005
5016
|
}
|
|
5006
5017
|
return true;
|
|
5007
5018
|
}
|
|
5008
5019
|
function paint(root, state) {
|
|
5009
|
-
const { entityObject, i18n } = state;
|
|
5010
|
-
if (verifyOfflineStatus(entityObject) === false) {
|
|
5020
|
+
const { entityObject, i18n, delayTimeConnectionInMins } = state;
|
|
5021
|
+
if (verifyOfflineStatus(entityObject, delayTimeConnectionInMins) === false) {
|
|
5011
5022
|
entityObject.deviceStatus = DeviceStatusType.NO_INFO;
|
|
5012
5023
|
}
|
|
5013
5024
|
const stateClass = getCardStateClass(entityObject.deviceStatus);
|
|
@@ -19688,7 +19699,7 @@ ${rangeText}`;
|
|
|
19688
19699
|
}
|
|
19689
19700
|
return `${selectedPeriods.length} per\xEDodos selecionados`;
|
|
19690
19701
|
}
|
|
19691
|
-
function
|
|
19702
|
+
function formatTemperature2(value, decimals = 1) {
|
|
19692
19703
|
return `${value.toFixed(decimals)}\xB0C`;
|
|
19693
19704
|
}
|
|
19694
19705
|
function exportTemperatureCSV(data, deviceLabel, stats, startDate, endDate) {
|
|
@@ -19702,11 +19713,11 @@ ${rangeText}`;
|
|
|
19702
19713
|
`;
|
|
19703
19714
|
csvContent += `Per\xEDodo: ${startDate} at\xE9 ${endDate}
|
|
19704
19715
|
`;
|
|
19705
|
-
csvContent += `M\xE9dia: ${
|
|
19716
|
+
csvContent += `M\xE9dia: ${formatTemperature2(stats.avg)}
|
|
19706
19717
|
`;
|
|
19707
|
-
csvContent += `M\xEDnima: ${
|
|
19718
|
+
csvContent += `M\xEDnima: ${formatTemperature2(stats.min)}
|
|
19708
19719
|
`;
|
|
19709
|
-
csvContent += `M\xE1xima: ${
|
|
19720
|
+
csvContent += `M\xE1xima: ${formatTemperature2(stats.max)}
|
|
19710
19721
|
`;
|
|
19711
19722
|
csvContent += `Total de leituras: ${stats.count}
|
|
19712
19723
|
`;
|
|
@@ -19997,7 +20008,7 @@ ${rangeText}`;
|
|
|
19997
20008
|
">
|
|
19998
20009
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">Temperatura Atual</span>
|
|
19999
20010
|
<div style="font-weight: 700; font-size: 24px; color: ${statusColor}; margin-top: 4px;">
|
|
20000
|
-
${state.currentTemperature !== null ?
|
|
20011
|
+
${state.currentTemperature !== null ? formatTemperature2(state.currentTemperature) : "N/A"}
|
|
20001
20012
|
</div>
|
|
20002
20013
|
<div style="font-size: 11px; color: ${statusColor}; margin-top: 2px;">${statusText}</div>
|
|
20003
20014
|
</div>
|
|
@@ -20008,7 +20019,7 @@ ${rangeText}`;
|
|
|
20008
20019
|
">
|
|
20009
20020
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">M\xE9dia do Per\xEDodo</span>
|
|
20010
20021
|
<div id="${modalId}-avg" style="font-weight: 600; font-size: 20px; color: ${colors.text}; margin-top: 4px;">
|
|
20011
|
-
${state.stats.count > 0 ?
|
|
20022
|
+
${state.stats.count > 0 ? formatTemperature2(state.stats.avg) : "N/A"}
|
|
20012
20023
|
</div>
|
|
20013
20024
|
<div style="font-size: 11px; color: ${colors.textMuted}; margin-top: 2px;">${startDateStr} - ${endDateStr}</div>
|
|
20014
20025
|
</div>
|
|
@@ -20019,7 +20030,7 @@ ${rangeText}`;
|
|
|
20019
20030
|
">
|
|
20020
20031
|
<span style="color: ${colors.textMuted}; font-size: 12px; font-weight: 500;">Min / Max</span>
|
|
20021
20032
|
<div id="${modalId}-minmax" style="font-weight: 600; font-size: 20px; color: ${colors.text}; margin-top: 4px;">
|
|
20022
|
-
${state.stats.count > 0 ? `${
|
|
20033
|
+
${state.stats.count > 0 ? `${formatTemperature2(state.stats.min)} / ${formatTemperature2(state.stats.max)}` : "N/A"}
|
|
20023
20034
|
</div>
|
|
20024
20035
|
<div style="font-size: 11px; color: ${colors.textMuted}; margin-top: 2px;">${state.stats.count} leituras</div>
|
|
20025
20036
|
</div>
|
|
@@ -20319,7 +20330,7 @@ ${rangeText}`;
|
|
|
20319
20330
|
}
|
|
20320
20331
|
tooltip.innerHTML = `
|
|
20321
20332
|
<div style="font-weight: 600; margin-bottom: 6px; color: ${colors.primary};">
|
|
20322
|
-
${
|
|
20333
|
+
${formatTemperature2(point.y)}
|
|
20323
20334
|
</div>
|
|
20324
20335
|
<div style="font-size: 11px; color: ${colors.textMuted};">
|
|
20325
20336
|
\u{1F4C5} ${dateStr}
|
|
@@ -20582,7 +20593,7 @@ ${rangeText}`;
|
|
|
20582
20593
|
<span style="width: 12px; height: 12px; border-radius: 50%; background: ${dd.color};"></span>
|
|
20583
20594
|
<span style="color: ${colors.text}; font-size: 13px;">${dd.device.label}</span>
|
|
20584
20595
|
<span style="color: ${colors.textMuted}; font-size: 11px; margin-left: auto;">
|
|
20585
|
-
${dd.stats.count > 0 ?
|
|
20596
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.avg) : "N/A"}
|
|
20586
20597
|
</span>
|
|
20587
20598
|
</div>
|
|
20588
20599
|
`).join("");
|
|
@@ -20598,15 +20609,15 @@ ${rangeText}`;
|
|
|
20598
20609
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 4px; font-size: 11px;">
|
|
20599
20610
|
<span style="color: ${colors.textMuted};">M\xE9dia:</span>
|
|
20600
20611
|
<span style="color: ${colors.text}; font-weight: 500;">
|
|
20601
|
-
${dd.stats.count > 0 ?
|
|
20612
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.avg) : "N/A"}
|
|
20602
20613
|
</span>
|
|
20603
20614
|
<span style="color: ${colors.textMuted};">Min:</span>
|
|
20604
20615
|
<span style="color: ${colors.text};">
|
|
20605
|
-
${dd.stats.count > 0 ?
|
|
20616
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.min) : "N/A"}
|
|
20606
20617
|
</span>
|
|
20607
20618
|
<span style="color: ${colors.textMuted};">Max:</span>
|
|
20608
20619
|
<span style="color: ${colors.text};">
|
|
20609
|
-
${dd.stats.count > 0 ?
|
|
20620
|
+
${dd.stats.count > 0 ? formatTemperature2(dd.stats.max) : "N/A"}
|
|
20610
20621
|
</span>
|
|
20611
20622
|
<span style="color: ${colors.textMuted};">Leituras:</span>
|
|
20612
20623
|
<span style="color: ${colors.text};">${dd.stats.count}</span>
|
|
@@ -21142,7 +21153,7 @@ ${rangeText}`;
|
|
|
21142
21153
|
<span style="font-weight: 600;">${point.deviceLabel}</span>
|
|
21143
21154
|
</div>
|
|
21144
21155
|
<div style="font-weight: 600; font-size: 16px; color: ${point.deviceColor}; margin-bottom: 4px;">
|
|
21145
|
-
${
|
|
21156
|
+
${formatTemperature2(point.y)}
|
|
21146
21157
|
</div>
|
|
21147
21158
|
<div style="font-size: 11px; color: ${colors.textMuted};">
|
|
21148
21159
|
\u{1F4C5} ${dateStr}
|
|
@@ -21917,7 +21928,7 @@ ${rangeText}`;
|
|
|
21917
21928
|
exports.formatEnergy = formatEnergy;
|
|
21918
21929
|
exports.formatNumberReadable = formatNumberReadable;
|
|
21919
21930
|
exports.formatTankHeadFromCm = formatTankHeadFromCm;
|
|
21920
|
-
exports.formatTemperature =
|
|
21931
|
+
exports.formatTemperature = formatTemperature2;
|
|
21921
21932
|
exports.formatWaterByGroup = formatWaterByGroup;
|
|
21922
21933
|
exports.formatWaterVolumeM3 = formatWaterVolumeM3;
|
|
21923
21934
|
exports.getAuthCacheStats = getAuthCacheStats;
|