myio-js-library 0.1.150 → 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 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);
@@ -5098,12 +5065,14 @@ function paint(root, state) {
5098
5065
  effContainer.style.display = "none";
5099
5066
  }
5100
5067
  const opTimeVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .val");
5101
- opTimeVal.textContent = entityObject.operationHours;
5068
+ if (opTimeVal) {
5069
+ opTimeVal.textContent = entityObject.operationHours ?? "-";
5070
+ }
5102
5071
  const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
5103
- const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
5104
- powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
5105
- const telemetryVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(3) .val");
5106
- telemetryVal.textContent = formatUpdateDate(entityObject.lastActivityTime);
5072
+ if (powerVal) {
5073
+ const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
5074
+ powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
5075
+ }
5107
5076
  }
5108
5077
  function bindEvents(root, state, callbacks) {
5109
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);
@@ -4990,12 +4957,14 @@ function paint(root, state) {
4990
4957
  effContainer.style.display = "none";
4991
4958
  }
4992
4959
  const opTimeVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .val");
4993
- opTimeVal.textContent = entityObject.operationHours;
4960
+ if (opTimeVal) {
4961
+ opTimeVal.textContent = entityObject.operationHours ?? "-";
4962
+ }
4994
4963
  const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
4995
- const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
4996
- powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
4997
- const telemetryVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(3) .val");
4998
- telemetryVal.textContent = formatUpdateDate(entityObject.lastActivityTime);
4964
+ if (powerVal) {
4965
+ const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
4966
+ powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
4967
+ }
4999
4968
  }
5000
4969
  function bindEvents(root, state, callbacks) {
5001
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);
@@ -4988,12 +4955,14 @@
4988
4955
  effContainer.style.display = "none";
4989
4956
  }
4990
4957
  const opTimeVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .val");
4991
- opTimeVal.textContent = entityObject.operationHours;
4958
+ if (opTimeVal) {
4959
+ opTimeVal.textContent = entityObject.operationHours ?? "-";
4960
+ }
4992
4961
  const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
4993
- const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
4994
- powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
4995
- const telemetryVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(3) .val");
4996
- telemetryVal.textContent = formatUpdateDate(entityObject.lastActivityTime);
4962
+ if (powerVal) {
4963
+ const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
4964
+ powerVal.textContent = instantPower !== null ? `${Number(instantPower).toFixed(2)} kW` : "-";
4965
+ }
4997
4966
  }
4998
4967
  function bindEvents(root, state, callbacks) {
4999
4968
  const { entityObject } = state;