myio-js-library 0.1.547 → 0.1.548

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
@@ -899,7 +899,7 @@ module.exports = __toCommonJS(src_exports);
899
899
  // package.json
900
900
  var package_default = {
901
901
  name: "myio-js-library",
902
- version: "0.1.547",
902
+ version: "0.1.548",
903
903
  description: "A clean, standalone JS SDK for MYIO projects",
904
904
  license: "MIT",
905
905
  repository: "github:gh-myio/myio-js-library",
@@ -18649,6 +18649,12 @@ function renderCardComponentV5({
18649
18649
  temperatureMax,
18650
18650
  temperatureStatus,
18651
18651
  // 'ok' | 'above' | 'below' | undefined
18652
+ // Temperatura atual vinda do Ingestion = média das últimas 2 h; true = nenhuma leitura na janela
18653
+ temperatureNoRecentReading = false,
18654
+ temperatureSource,
18655
+ // 'ingestion-avg-2h' | 'thingsboard' | undefined
18656
+ temperatureFetchedAt,
18657
+ // ms da consulta (rótulo "Atualizado às HH:MM")
18652
18658
  // Per-device exclude_groups_totals attribute (SERVER_SCOPE) — drives the orange marker
18653
18659
  excludeGroupsTotals
18654
18660
  } = entityObject;
@@ -18808,7 +18814,14 @@ function renderCardComponentV5({
18808
18814
  const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
18809
18815
  const tankLevelCm = isTankDevice2 ? Number(waterLevel ?? val) : null;
18810
18816
  const _pctDecimals = resolvePercentDecimals(percentDecimals);
18817
+ const showNoTempReading = !!temperatureNoRecentReading && isTemperatureDevice2(deviceType);
18818
+ const tempValueTitle = (() => {
18819
+ if (!isTemperatureDevice2(deviceType) || temperatureSource !== "ingestion-avg-2h") return "";
18820
+ const at = temperatureFetchedAt ? ` \xB7 Atualizado \xE0s ${new Date(temperatureFetchedAt).toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" })}` : "";
18821
+ return showNoTempReading ? `Nenhuma leitura nas \xFAltimas 2 h${at}` : `Temperatura (m\xE9dia das \xFAltimas 2 h)${at}`;
18822
+ })();
18811
18823
  const formatCardValue = (value, deviceType2) => {
18824
+ if (showNoTempReading) return "Sem leitura recente";
18812
18825
  if (isTankDevice2) {
18813
18826
  return `${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%`;
18814
18827
  }
@@ -19111,7 +19124,7 @@ function renderCardComponentV5({
19111
19124
  }
19112
19125
  return "ok";
19113
19126
  };
19114
- const tempStatus = isTermostatoDevice ? calculateTempStatus2() : null;
19127
+ const tempStatus = isTermostatoDevice && !showNoTempReading ? calculateTempStatus2() : null;
19115
19128
  const deviceImageUrl = getDeviceImageUrl(deviceType, percentageForDisplay, {
19116
19129
  tempStatus,
19117
19130
  isOffline
@@ -19131,7 +19144,7 @@ function renderCardComponentV5({
19131
19144
  }
19132
19145
  return null;
19133
19146
  };
19134
- const tempDeviationPercent = isTermostatoDevice ? calculateTempDeviationPercent() : null;
19147
+ const tempDeviationPercent = isTermostatoDevice && !showNoTempReading ? calculateTempDeviationPercent() : null;
19135
19148
  const cardHTML = `
19136
19149
  <div class="device-card-centered clickable ${cardEntity.status === "offline" ? "offline" : ""}"
19137
19150
  data-entity-id="${entityId}"
@@ -19176,7 +19189,7 @@ function renderCardComponentV5({
19176
19189
  <span class="flash-icon ${shouldFlashIcon2 ? "flash" : ""}">
19177
19190
  ${icon2}
19178
19191
  </span>
19179
- <span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
19192
+ <span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>
19180
19193
  </div>
19181
19194
  </div>
19182
19195
  ${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  // package.json
11
11
  var package_default = {
12
12
  name: "myio-js-library",
13
- version: "0.1.547",
13
+ version: "0.1.548",
14
14
  description: "A clean, standalone JS SDK for MYIO projects",
15
15
  license: "MIT",
16
16
  repository: "github:gh-myio/myio-js-library",
@@ -17035,6 +17035,12 @@ function renderCardComponentV5({
17035
17035
  temperatureMax,
17036
17036
  temperatureStatus,
17037
17037
  // 'ok' | 'above' | 'below' | undefined
17038
+ // Temperatura atual vinda do Ingestion = média das últimas 2 h; true = nenhuma leitura na janela
17039
+ temperatureNoRecentReading = false,
17040
+ temperatureSource,
17041
+ // 'ingestion-avg-2h' | 'thingsboard' | undefined
17042
+ temperatureFetchedAt,
17043
+ // ms da consulta (rótulo "Atualizado às HH:MM")
17038
17044
  // Per-device exclude_groups_totals attribute (SERVER_SCOPE) — drives the orange marker
17039
17045
  excludeGroupsTotals
17040
17046
  } = entityObject;
@@ -17194,7 +17200,14 @@ function renderCardComponentV5({
17194
17200
  const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
17195
17201
  const tankLevelCm = isTankDevice2 ? Number(waterLevel ?? val) : null;
17196
17202
  const _pctDecimals = resolvePercentDecimals(percentDecimals);
17203
+ const showNoTempReading = !!temperatureNoRecentReading && isTemperatureDevice2(deviceType);
17204
+ const tempValueTitle = (() => {
17205
+ if (!isTemperatureDevice2(deviceType) || temperatureSource !== "ingestion-avg-2h") return "";
17206
+ const at = temperatureFetchedAt ? ` \xB7 Atualizado \xE0s ${new Date(temperatureFetchedAt).toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" })}` : "";
17207
+ return showNoTempReading ? `Nenhuma leitura nas \xFAltimas 2 h${at}` : `Temperatura (m\xE9dia das \xFAltimas 2 h)${at}`;
17208
+ })();
17197
17209
  const formatCardValue = (value, deviceType2) => {
17210
+ if (showNoTempReading) return "Sem leitura recente";
17198
17211
  if (isTankDevice2) {
17199
17212
  return `${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%`;
17200
17213
  }
@@ -17497,7 +17510,7 @@ function renderCardComponentV5({
17497
17510
  }
17498
17511
  return "ok";
17499
17512
  };
17500
- const tempStatus = isTermostatoDevice ? calculateTempStatus2() : null;
17513
+ const tempStatus = isTermostatoDevice && !showNoTempReading ? calculateTempStatus2() : null;
17501
17514
  const deviceImageUrl = getDeviceImageUrl(deviceType, percentageForDisplay, {
17502
17515
  tempStatus,
17503
17516
  isOffline
@@ -17517,7 +17530,7 @@ function renderCardComponentV5({
17517
17530
  }
17518
17531
  return null;
17519
17532
  };
17520
- const tempDeviationPercent = isTermostatoDevice ? calculateTempDeviationPercent() : null;
17533
+ const tempDeviationPercent = isTermostatoDevice && !showNoTempReading ? calculateTempDeviationPercent() : null;
17521
17534
  const cardHTML = `
17522
17535
  <div class="device-card-centered clickable ${cardEntity.status === "offline" ? "offline" : ""}"
17523
17536
  data-entity-id="${entityId}"
@@ -17562,7 +17575,7 @@ function renderCardComponentV5({
17562
17575
  <span class="flash-icon ${shouldFlashIcon2 ? "flash" : ""}">
17563
17576
  ${icon2}
17564
17577
  </span>
17565
- <span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
17578
+ <span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>
17566
17579
  </div>
17567
17580
  </div>
17568
17581
  ${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
@@ -5455,7 +5455,7 @@
5455
5455
 
5456
5456
  // package.json
5457
5457
  var package_default = {
5458
- version: "0.1.547"};
5458
+ version: "0.1.548"};
5459
5459
 
5460
5460
  // src/utils/format/energy.ts
5461
5461
  function formatPower(value, decimals = 2) {
@@ -22372,6 +22372,12 @@
22372
22372
  temperatureMax,
22373
22373
  temperatureStatus,
22374
22374
  // 'ok' | 'above' | 'below' | undefined
22375
+ // Temperatura atual vinda do Ingestion = média das últimas 2 h; true = nenhuma leitura na janela
22376
+ temperatureNoRecentReading = false,
22377
+ temperatureSource,
22378
+ // 'ingestion-avg-2h' | 'thingsboard' | undefined
22379
+ temperatureFetchedAt,
22380
+ // ms da consulta (rótulo "Atualizado às HH:MM")
22375
22381
  // Per-device exclude_groups_totals attribute (SERVER_SCOPE) — drives the orange marker
22376
22382
  excludeGroupsTotals
22377
22383
  } = entityObject;
@@ -22531,7 +22537,14 @@
22531
22537
  const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
22532
22538
  const tankLevelCm = isTankDevice2 ? Number(waterLevel ?? val) : null;
22533
22539
  const _pctDecimals = resolvePercentDecimals(percentDecimals);
22540
+ const showNoTempReading = !!temperatureNoRecentReading && isTemperatureDevice2(deviceType);
22541
+ const tempValueTitle = (() => {
22542
+ if (!isTemperatureDevice2(deviceType) || temperatureSource !== "ingestion-avg-2h") return "";
22543
+ const at = temperatureFetchedAt ? ` \xB7 Atualizado \xE0s ${new Date(temperatureFetchedAt).toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" })}` : "";
22544
+ return showNoTempReading ? `Nenhuma leitura nas \xFAltimas 2 h${at}` : `Temperatura (m\xE9dia das \xFAltimas 2 h)${at}`;
22545
+ })();
22534
22546
  const formatCardValue = (value, deviceType2) => {
22547
+ if (showNoTempReading) return "Sem leitura recente";
22535
22548
  if (isTankDevice2) {
22536
22549
  return `${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%`;
22537
22550
  }
@@ -22834,7 +22847,7 @@
22834
22847
  }
22835
22848
  return "ok";
22836
22849
  };
22837
- const tempStatus = isTermostatoDevice ? calculateTempStatus2() : null;
22850
+ const tempStatus = isTermostatoDevice && !showNoTempReading ? calculateTempStatus2() : null;
22838
22851
  const deviceImageUrl = getDeviceImageUrl(deviceType, percentageForDisplay, {
22839
22852
  tempStatus,
22840
22853
  isOffline
@@ -22854,7 +22867,7 @@
22854
22867
  }
22855
22868
  return null;
22856
22869
  };
22857
- const tempDeviationPercent = isTermostatoDevice ? calculateTempDeviationPercent() : null;
22870
+ const tempDeviationPercent = isTermostatoDevice && !showNoTempReading ? calculateTempDeviationPercent() : null;
22858
22871
  const cardHTML = `
22859
22872
  <div class="device-card-centered clickable ${cardEntity.status === "offline" ? "offline" : ""}"
22860
22873
  data-entity-id="${entityId}"
@@ -22899,7 +22912,7 @@
22899
22912
  <span class="flash-icon ${shouldFlashIcon2 ? "flash" : ""}">
22900
22913
  ${icon2}
22901
22914
  </span>
22902
- <span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
22915
+ <span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>
22903
22916
  </div>
22904
22917
  </div>
22905
22918
  ${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}