myio-js-library 0.1.149 → 0.1.151
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 +7 -52
- package/dist/index.js +7 -52
- package/dist/myio-js-library.umd.js +7 -52
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4824,39 +4824,6 @@ function formatValueByDomain(value, domain) {
|
|
|
4824
4824
|
}
|
|
4825
4825
|
return formatEnergy(value);
|
|
4826
4826
|
}
|
|
4827
|
-
function formatUpdateDate(timeVal) {
|
|
4828
|
-
let telemetryTimeFormatted = "N/A";
|
|
4829
|
-
let timeSinceLastTelemetry = "";
|
|
4830
|
-
if (timeVal) {
|
|
4831
|
-
try {
|
|
4832
|
-
const telemetryDate = new Date(timeVal);
|
|
4833
|
-
telemetryTimeFormatted = telemetryDate.toLocaleString("pt-BR", {
|
|
4834
|
-
day: "2-digit",
|
|
4835
|
-
month: "2-digit",
|
|
4836
|
-
year: "numeric",
|
|
4837
|
-
hour: "2-digit",
|
|
4838
|
-
minute: "2-digit"
|
|
4839
|
-
});
|
|
4840
|
-
const now = /* @__PURE__ */ new Date();
|
|
4841
|
-
const diffMs = now.getTime() - telemetryDate.getTime();
|
|
4842
|
-
const diffMinutes = Math.floor(diffMs / (1e3 * 60));
|
|
4843
|
-
const diffHours = Math.floor(diffMinutes / 60);
|
|
4844
|
-
const diffDays = Math.floor(diffHours / 24);
|
|
4845
|
-
if (diffDays > 0) {
|
|
4846
|
-
timeSinceLastTelemetry = `(${diffDays}d atr\xE1s)`;
|
|
4847
|
-
} else if (diffHours > 0) {
|
|
4848
|
-
timeSinceLastTelemetry = `(${diffHours}h atr\xE1s)`;
|
|
4849
|
-
} else if (diffMinutes > 0) {
|
|
4850
|
-
timeSinceLastTelemetry = `(${diffMinutes}min atr\xE1s)`;
|
|
4851
|
-
} else {
|
|
4852
|
-
timeSinceLastTelemetry = "(agora)";
|
|
4853
|
-
}
|
|
4854
|
-
return timeSinceLastTelemetry;
|
|
4855
|
-
} catch (e) {
|
|
4856
|
-
telemetryTimeFormatted = "Formato inv\xE1lido";
|
|
4857
|
-
}
|
|
4858
|
-
}
|
|
4859
|
-
}
|
|
4860
4827
|
function calculateConsumptionPercentage(target, consumption) {
|
|
4861
4828
|
const numericTarget = Number(target);
|
|
4862
4829
|
const numericConsumption = Number(consumption);
|
|
@@ -5048,20 +5015,6 @@ function buildDOM(state) {
|
|
|
5048
5015
|
powerVal.className = "val";
|
|
5049
5016
|
powerMetric.appendChild(powerVal);
|
|
5050
5017
|
footer.appendChild(powerMetric);
|
|
5051
|
-
const telemetryMetric = document.createElement("div");
|
|
5052
|
-
telemetryMetric.className = "metric";
|
|
5053
|
-
const telemetryIcon = document.createElement("i");
|
|
5054
|
-
telemetryIcon.className = "ico ico-sync";
|
|
5055
|
-
telemetryIcon.innerHTML = Icons.dot;
|
|
5056
|
-
telemetryMetric.appendChild(telemetryIcon);
|
|
5057
|
-
const telemetryLabel = document.createElement("div");
|
|
5058
|
-
telemetryLabel.className = "label";
|
|
5059
|
-
telemetryLabel.textContent = i18n.last_telemetry || "\xDAlt. Telemetria";
|
|
5060
|
-
telemetryMetric.appendChild(telemetryLabel);
|
|
5061
|
-
const telemetryVal = document.createElement("div");
|
|
5062
|
-
telemetryVal.className = "val";
|
|
5063
|
-
telemetryMetric.appendChild(telemetryVal);
|
|
5064
|
-
footer.appendChild(telemetryMetric);
|
|
5065
5018
|
root.appendChild(footer);
|
|
5066
5019
|
return root;
|
|
5067
5020
|
}
|
|
@@ -5112,12 +5065,14 @@ function paint(root, state) {
|
|
|
5112
5065
|
effContainer.style.display = "none";
|
|
5113
5066
|
}
|
|
5114
5067
|
const opTimeVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .val");
|
|
5115
|
-
opTimeVal
|
|
5068
|
+
if (opTimeVal) {
|
|
5069
|
+
opTimeVal.textContent = entityObject.operationHours ?? "-";
|
|
5070
|
+
}
|
|
5116
5071
|
const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5072
|
+
if (powerVal) {
|
|
5073
|
+
const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
|
|
5074
|
+
powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
|
|
5075
|
+
}
|
|
5121
5076
|
}
|
|
5122
5077
|
function bindEvents(root, state, callbacks) {
|
|
5123
5078
|
const { entityObject } = state;
|
package/dist/index.js
CHANGED
|
@@ -4716,39 +4716,6 @@ function formatValueByDomain(value, domain) {
|
|
|
4716
4716
|
}
|
|
4717
4717
|
return formatEnergy(value);
|
|
4718
4718
|
}
|
|
4719
|
-
function formatUpdateDate(timeVal) {
|
|
4720
|
-
let telemetryTimeFormatted = "N/A";
|
|
4721
|
-
let timeSinceLastTelemetry = "";
|
|
4722
|
-
if (timeVal) {
|
|
4723
|
-
try {
|
|
4724
|
-
const telemetryDate = new Date(timeVal);
|
|
4725
|
-
telemetryTimeFormatted = telemetryDate.toLocaleString("pt-BR", {
|
|
4726
|
-
day: "2-digit",
|
|
4727
|
-
month: "2-digit",
|
|
4728
|
-
year: "numeric",
|
|
4729
|
-
hour: "2-digit",
|
|
4730
|
-
minute: "2-digit"
|
|
4731
|
-
});
|
|
4732
|
-
const now = /* @__PURE__ */ new Date();
|
|
4733
|
-
const diffMs = now.getTime() - telemetryDate.getTime();
|
|
4734
|
-
const diffMinutes = Math.floor(diffMs / (1e3 * 60));
|
|
4735
|
-
const diffHours = Math.floor(diffMinutes / 60);
|
|
4736
|
-
const diffDays = Math.floor(diffHours / 24);
|
|
4737
|
-
if (diffDays > 0) {
|
|
4738
|
-
timeSinceLastTelemetry = `(${diffDays}d atr\xE1s)`;
|
|
4739
|
-
} else if (diffHours > 0) {
|
|
4740
|
-
timeSinceLastTelemetry = `(${diffHours}h atr\xE1s)`;
|
|
4741
|
-
} else if (diffMinutes > 0) {
|
|
4742
|
-
timeSinceLastTelemetry = `(${diffMinutes}min atr\xE1s)`;
|
|
4743
|
-
} else {
|
|
4744
|
-
timeSinceLastTelemetry = "(agora)";
|
|
4745
|
-
}
|
|
4746
|
-
return timeSinceLastTelemetry;
|
|
4747
|
-
} catch (e) {
|
|
4748
|
-
telemetryTimeFormatted = "Formato inv\xE1lido";
|
|
4749
|
-
}
|
|
4750
|
-
}
|
|
4751
|
-
}
|
|
4752
4719
|
function calculateConsumptionPercentage(target, consumption) {
|
|
4753
4720
|
const numericTarget = Number(target);
|
|
4754
4721
|
const numericConsumption = Number(consumption);
|
|
@@ -4940,20 +4907,6 @@ function buildDOM(state) {
|
|
|
4940
4907
|
powerVal.className = "val";
|
|
4941
4908
|
powerMetric.appendChild(powerVal);
|
|
4942
4909
|
footer.appendChild(powerMetric);
|
|
4943
|
-
const telemetryMetric = document.createElement("div");
|
|
4944
|
-
telemetryMetric.className = "metric";
|
|
4945
|
-
const telemetryIcon = document.createElement("i");
|
|
4946
|
-
telemetryIcon.className = "ico ico-sync";
|
|
4947
|
-
telemetryIcon.innerHTML = Icons.dot;
|
|
4948
|
-
telemetryMetric.appendChild(telemetryIcon);
|
|
4949
|
-
const telemetryLabel = document.createElement("div");
|
|
4950
|
-
telemetryLabel.className = "label";
|
|
4951
|
-
telemetryLabel.textContent = i18n.last_telemetry || "\xDAlt. Telemetria";
|
|
4952
|
-
telemetryMetric.appendChild(telemetryLabel);
|
|
4953
|
-
const telemetryVal = document.createElement("div");
|
|
4954
|
-
telemetryVal.className = "val";
|
|
4955
|
-
telemetryMetric.appendChild(telemetryVal);
|
|
4956
|
-
footer.appendChild(telemetryMetric);
|
|
4957
4910
|
root.appendChild(footer);
|
|
4958
4911
|
return root;
|
|
4959
4912
|
}
|
|
@@ -5004,12 +4957,14 @@ function paint(root, state) {
|
|
|
5004
4957
|
effContainer.style.display = "none";
|
|
5005
4958
|
}
|
|
5006
4959
|
const opTimeVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .val");
|
|
5007
|
-
opTimeVal
|
|
4960
|
+
if (opTimeVal) {
|
|
4961
|
+
opTimeVal.textContent = entityObject.operationHours ?? "-";
|
|
4962
|
+
}
|
|
5008
4963
|
const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
4964
|
+
if (powerVal) {
|
|
4965
|
+
const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
|
|
4966
|
+
powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
|
|
4967
|
+
}
|
|
5013
4968
|
}
|
|
5014
4969
|
function bindEvents(root, state, callbacks) {
|
|
5015
4970
|
const { entityObject } = state;
|
|
@@ -4714,39 +4714,6 @@
|
|
|
4714
4714
|
}
|
|
4715
4715
|
return formatEnergy(value);
|
|
4716
4716
|
}
|
|
4717
|
-
function formatUpdateDate(timeVal) {
|
|
4718
|
-
let telemetryTimeFormatted = "N/A";
|
|
4719
|
-
let timeSinceLastTelemetry = "";
|
|
4720
|
-
if (timeVal) {
|
|
4721
|
-
try {
|
|
4722
|
-
const telemetryDate = new Date(timeVal);
|
|
4723
|
-
telemetryTimeFormatted = telemetryDate.toLocaleString("pt-BR", {
|
|
4724
|
-
day: "2-digit",
|
|
4725
|
-
month: "2-digit",
|
|
4726
|
-
year: "numeric",
|
|
4727
|
-
hour: "2-digit",
|
|
4728
|
-
minute: "2-digit"
|
|
4729
|
-
});
|
|
4730
|
-
const now = /* @__PURE__ */ new Date();
|
|
4731
|
-
const diffMs = now.getTime() - telemetryDate.getTime();
|
|
4732
|
-
const diffMinutes = Math.floor(diffMs / (1e3 * 60));
|
|
4733
|
-
const diffHours = Math.floor(diffMinutes / 60);
|
|
4734
|
-
const diffDays = Math.floor(diffHours / 24);
|
|
4735
|
-
if (diffDays > 0) {
|
|
4736
|
-
timeSinceLastTelemetry = `(${diffDays}d atr\xE1s)`;
|
|
4737
|
-
} else if (diffHours > 0) {
|
|
4738
|
-
timeSinceLastTelemetry = `(${diffHours}h atr\xE1s)`;
|
|
4739
|
-
} else if (diffMinutes > 0) {
|
|
4740
|
-
timeSinceLastTelemetry = `(${diffMinutes}min atr\xE1s)`;
|
|
4741
|
-
} else {
|
|
4742
|
-
timeSinceLastTelemetry = "(agora)";
|
|
4743
|
-
}
|
|
4744
|
-
return timeSinceLastTelemetry;
|
|
4745
|
-
} catch (e) {
|
|
4746
|
-
telemetryTimeFormatted = "Formato inv\xE1lido";
|
|
4747
|
-
}
|
|
4748
|
-
}
|
|
4749
|
-
}
|
|
4750
4717
|
function calculateConsumptionPercentage(target, consumption) {
|
|
4751
4718
|
const numericTarget = Number(target);
|
|
4752
4719
|
const numericConsumption = Number(consumption);
|
|
@@ -4938,20 +4905,6 @@
|
|
|
4938
4905
|
powerVal.className = "val";
|
|
4939
4906
|
powerMetric.appendChild(powerVal);
|
|
4940
4907
|
footer.appendChild(powerMetric);
|
|
4941
|
-
const telemetryMetric = document.createElement("div");
|
|
4942
|
-
telemetryMetric.className = "metric";
|
|
4943
|
-
const telemetryIcon = document.createElement("i");
|
|
4944
|
-
telemetryIcon.className = "ico ico-sync";
|
|
4945
|
-
telemetryIcon.innerHTML = Icons.dot;
|
|
4946
|
-
telemetryMetric.appendChild(telemetryIcon);
|
|
4947
|
-
const telemetryLabel = document.createElement("div");
|
|
4948
|
-
telemetryLabel.className = "label";
|
|
4949
|
-
telemetryLabel.textContent = i18n.last_telemetry || "\xDAlt. Telemetria";
|
|
4950
|
-
telemetryMetric.appendChild(telemetryLabel);
|
|
4951
|
-
const telemetryVal = document.createElement("div");
|
|
4952
|
-
telemetryVal.className = "val";
|
|
4953
|
-
telemetryMetric.appendChild(telemetryVal);
|
|
4954
|
-
footer.appendChild(telemetryMetric);
|
|
4955
4908
|
root.appendChild(footer);
|
|
4956
4909
|
return root;
|
|
4957
4910
|
}
|
|
@@ -5002,12 +4955,14 @@
|
|
|
5002
4955
|
effContainer.style.display = "none";
|
|
5003
4956
|
}
|
|
5004
4957
|
const opTimeVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .val");
|
|
5005
|
-
opTimeVal
|
|
4958
|
+
if (opTimeVal) {
|
|
4959
|
+
opTimeVal.textContent = entityObject.operationHours ?? "-";
|
|
4960
|
+
}
|
|
5006
4961
|
const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
4962
|
+
if (powerVal) {
|
|
4963
|
+
const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
|
|
4964
|
+
powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
|
|
4965
|
+
}
|
|
5011
4966
|
}
|
|
5012
4967
|
function bindEvents(root, state, callbacks) {
|
|
5013
4968
|
const { entityObject } = state;
|