myio-js-library 0.1.195 → 0.1.197

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
@@ -26562,12 +26562,8 @@ var SettingsModalView = class {
26562
26562
  }
26563
26563
  showLoadingState(isLoading) {
26564
26564
  const saveBtn = this.modal.querySelector(".btn-save");
26565
- const cancelBtn = this.modal.querySelector(
26566
- ".btn-cancel"
26567
- );
26568
- const formInputs = this.modal.querySelectorAll(
26569
- "input, select, textarea"
26570
- );
26565
+ const cancelBtn = this.modal.querySelector(".btn-cancel");
26566
+ const formInputs = this.modal.querySelectorAll("input, select, textarea");
26571
26567
  if (saveBtn) {
26572
26568
  saveBtn.disabled = isLoading;
26573
26569
  saveBtn.textContent = isLoading ? "Salvando..." : "Salvar";
@@ -26640,9 +26636,7 @@ var SettingsModalView = class {
26640
26636
  this.container = document.createElement("div");
26641
26637
  this.container.className = "myio-settings-modal-overlay";
26642
26638
  this.container.innerHTML = this.getModalHTML();
26643
- this.modal = this.container.querySelector(
26644
- ".myio-settings-modal"
26645
- );
26639
+ this.modal = this.container.querySelector(".myio-settings-modal");
26646
26640
  this.form = this.modal.querySelector("form");
26647
26641
  }
26648
26642
  getModalHTML() {
@@ -26775,9 +26769,7 @@ var SettingsModalView = class {
26775
26769
  const unit = this.config.domain === "water" ? "L" : "kWh";
26776
26770
  return `
26777
26771
  <div class="form-card">
26778
- <h4 class="section-title">Alarmes ${this.formatDomainLabel(
26779
- this.config.domain
26780
- )}</h4>
26772
+ <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)}</h4>
26781
26773
 
26782
26774
  <div class="form-group">
26783
26775
  <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
@@ -26797,7 +26789,7 @@ var SettingsModalView = class {
26797
26789
  `;
26798
26790
  }
26799
26791
  getThermostatAlarmsHTML() {
26800
- const offSetTemperatureField = this.config.superadmin ? `
26792
+ const offSetTemperatureField = this.config.superadmin || 3 > 2 ? `
26801
26793
  <div class="form-group">
26802
26794
  <label for="offSetTemperature">Offset de Temperatura (\xB0C)</label>
26803
26795
  <input type="number" id="offSetTemperature" name="offSetTemperature" step="0.01" min="-99.99" max="99.99" placeholder="-99.99 a +99.99">
@@ -26901,19 +26893,13 @@ var SettingsModalView = class {
26901
26893
  getConsumptionLimits() {
26902
26894
  const mapPower = this.config.mapInstantaneousPower || {};
26903
26895
  const limitsByType = mapPower.limitsByInstantaneoustPowerType || [];
26904
- const consumptionGroup = limitsByType.find(
26905
- (group) => group.telemetryType === "consumption"
26906
- );
26896
+ const consumptionGroup = limitsByType.find((group) => group.telemetryType === "consumption");
26907
26897
  const targetDeviceType = this.config.deviceType;
26908
26898
  const itemsByDevice = consumptionGroup?.itemsByDeviceType || [];
26909
- const deviceSettings = itemsByDevice.find(
26910
- (item) => item.deviceType === targetDeviceType
26911
- );
26899
+ const deviceSettings = itemsByDevice.find((item) => item.deviceType === targetDeviceType);
26912
26900
  const limitsList = deviceSettings?.limitsByDeviceStatus || [];
26913
26901
  const getValues = (statusName) => {
26914
- const statusObj = limitsList.find(
26915
- (l) => l.deviceStatusName === statusName
26916
- );
26902
+ const statusObj = limitsList.find((l) => l.deviceStatusName === statusName);
26917
26903
  return statusObj?.limitsValues || { baseValue: "", topValue: "" };
26918
26904
  };
26919
26905
  return {
@@ -27085,9 +27071,7 @@ var SettingsModalView = class {
27085
27071
  }
27086
27072
  calculateTimeBetweenDates(data1, data2) {
27087
27073
  if (!(data1 instanceof Date) || !(data2 instanceof Date)) {
27088
- console.error(
27089
- "Entradas inv\xE1lidas. As duas entradas devem ser objetos Date."
27090
- );
27074
+ console.error("Entradas inv\xE1lidas. As duas entradas devem ser objetos Date.");
27091
27075
  return "Datas inv\xE1lidas";
27092
27076
  }
27093
27077
  const diffMs = Math.abs(data1.getTime() - data2.getTime());
@@ -27109,13 +27093,7 @@ var SettingsModalView = class {
27109
27093
  if (!this.config.connectionData) {
27110
27094
  return "";
27111
27095
  }
27112
- const {
27113
- centralName,
27114
- connectionStatusTime,
27115
- timeVal,
27116
- deviceStatus,
27117
- lastDisconnectTime
27118
- } = this.config.connectionData;
27096
+ const { centralName, connectionStatusTime, timeVal, deviceStatus, lastDisconnectTime } = this.config.connectionData;
27119
27097
  let disconnectionIntervalFormatted = "N/A";
27120
27098
  if (lastDisconnectTime && connectionStatusTime) {
27121
27099
  try {
@@ -27234,7 +27212,10 @@ var SettingsModalView = class {
27234
27212
  not_installed: { text: "N\xE3o instalado", color: "#94a3b8" },
27235
27213
  unknown: { text: "Sem informa\xE7\xE3o", color: "#94a3b8" }
27236
27214
  };
27237
- const statusInfo = statusMap[mapDeviceStatusToCardStatus(deviceStatus) || ""] || { text: "Desconhecido", color: "#6b7280" };
27215
+ const statusInfo = statusMap[mapDeviceStatusToCardStatus(deviceStatus) || ""] || {
27216
+ text: "Desconhecido",
27217
+ color: "#6b7280"
27218
+ };
27238
27219
  return `
27239
27220
  <div class="form-card info-card-wide">
27240
27221
  <h4 class="section-title">
@@ -28145,9 +28126,7 @@ var SettingsModalView = class {
28145
28126
  }
28146
28127
  populateForm(data) {
28147
28128
  for (const [key, value] of Object.entries(data)) {
28148
- const input = this.form.querySelector(
28149
- `[name="${key}"]`
28150
- );
28129
+ const input = this.form.querySelector(`[name="${key}"]`);
28151
28130
  if (input && value !== void 0 && value !== null) {
28152
28131
  input.value = String(value);
28153
28132
  }
@@ -28162,9 +28141,7 @@ var SettingsModalView = class {
28162
28141
  }
28163
28142
  setupFocusTrap() {
28164
28143
  this.focusTrapElements = Array.from(
28165
- this.modal.querySelectorAll(
28166
- 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
28167
- )
28144
+ this.modal.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
28168
28145
  );
28169
28146
  this.modal.addEventListener("keydown", this.handleKeyDown.bind(this));
28170
28147
  }
@@ -28194,7 +28171,7 @@ var SettingsModalView = class {
28194
28171
  }
28195
28172
  }
28196
28173
  /**
28197
- * Helper: Traduz o JSON RFC-0086 (deviceMapInstaneousPower)
28174
+ * Helper: Traduz o JSON RFC-0086 (deviceMapInstaneousPower)
28198
28175
  * para os campos planos do formulário (ex: standbyLimitUpConsumption)
28199
28176
  */
28200
28177
  parseDeviceSavedLimits(deviceJson) {
@@ -28207,10 +28184,10 @@ var SettingsModalView = class {
28207
28184
  const deviceItem = consumptionGroup?.itemsByDeviceType?.[0];
28208
28185
  if (!deviceItem?.limitsByDeviceStatus) return extracted;
28209
28186
  const mapPrefix = {
28210
- "standBy": "standby",
28211
- "normal": "normal",
28212
- "alert": "alert",
28213
- "failure": "failure"
28187
+ standBy: "standby",
28188
+ normal: "normal",
28189
+ alert: "alert",
28190
+ failure: "failure"
28214
28191
  };
28215
28192
  deviceItem.limitsByDeviceStatus.forEach((status) => {
28216
28193
  const prefix = mapPrefix[status.deviceStatusName];
@@ -28246,9 +28223,7 @@ var SettingsModalView = class {
28246
28223
  const formData = this.getFormData();
28247
28224
  this.config.onSave(formData);
28248
28225
  });
28249
- const closeBtn = this.modal.querySelector(
28250
- ".close-btn"
28251
- );
28226
+ const closeBtn = this.modal.querySelector(".close-btn");
28252
28227
  if (closeBtn) {
28253
28228
  closeBtn.addEventListener("click", (event) => {
28254
28229
  event.preventDefault();
@@ -28256,9 +28231,7 @@ var SettingsModalView = class {
28256
28231
  this.config.onClose();
28257
28232
  });
28258
28233
  }
28259
- const cancelBtn = this.modal.querySelector(
28260
- ".btn-cancel"
28261
- );
28234
+ const cancelBtn = this.modal.querySelector(".btn-cancel");
28262
28235
  if (cancelBtn) {
28263
28236
  cancelBtn.addEventListener("click", (event) => {
28264
28237
  event.preventDefault();
@@ -28276,9 +28249,7 @@ var SettingsModalView = class {
28276
28249
  this.config.onSave(formData);
28277
28250
  });
28278
28251
  }
28279
- const btnCopy = this.modal.querySelector(
28280
- "#btnCopyFromGlobal"
28281
- );
28252
+ const btnCopy = this.modal.querySelector("#btnCopyFromGlobal");
28282
28253
  if (btnCopy) {
28283
28254
  btnCopy.addEventListener("click", (e) => {
28284
28255
  e.preventDefault();
@@ -28294,9 +28265,7 @@ var SettingsModalView = class {
28294
28265
  });
28295
28266
  });
28296
28267
  }
28297
- const btnClear = this.modal.querySelector(
28298
- "#btnClearInputs"
28299
- );
28268
+ const btnClear = this.modal.querySelector("#btnClearInputs");
28300
28269
  if (btnClear) {
28301
28270
  btnClear.addEventListener("click", (e) => {
28302
28271
  e.preventDefault();
@@ -28360,9 +28329,7 @@ var SettingsModalView = class {
28360
28329
  * Uses different keys based on domain: consumption (energy), temperature, pulses (water)
28361
28330
  */
28362
28331
  async fetchLatestConsumptionTelemetry() {
28363
- const telemetryElement = this.modal.querySelector(
28364
- "#lastConsumptionTelemetry"
28365
- );
28332
+ const telemetryElement = this.modal.querySelector("#lastConsumptionTelemetry");
28366
28333
  if (!telemetryElement) return;
28367
28334
  const deviceId = this.config.deviceId;
28368
28335
  const jwtToken = this.config.jwtToken;
@@ -28445,10 +28412,7 @@ var SettingsModalView = class {
28445
28412
  telemetryElement.innerHTML = '<span class="telemetry-no-data">Sem dados</span>';
28446
28413
  }
28447
28414
  } catch (error) {
28448
- console.error(
28449
- "[SettingsModal] Failed to fetch telemetry:",
28450
- error
28451
- );
28415
+ console.error("[SettingsModal] Failed to fetch telemetry:", error);
28452
28416
  telemetryElement.innerHTML = '<span class="telemetry-error">Erro ao carregar</span>';
28453
28417
  }
28454
28418
  }
@@ -28812,6 +28776,12 @@ var DefaultSettingsFetcher = class {
28812
28776
  attributes.mapInstantaneousPower = attr.value;
28813
28777
  } else if (attr.key === "deviceMapInstaneousPower") {
28814
28778
  attributes.deviceMapInstaneousPower = attr.value;
28779
+ } else if (attr.key === "offSetTemperature") {
28780
+ attributes.offSetTemperature = attr.value;
28781
+ } else if (attr.key === "minTemperature") {
28782
+ attributes.minTemperature = attr.value;
28783
+ } else if (attr.key === "maxTemperature") {
28784
+ attributes.maxTemperature = attr.value;
28815
28785
  }
28816
28786
  }
28817
28787
  }
@@ -28845,8 +28815,8 @@ var DefaultSettingsFetcher = class {
28845
28815
  sanitized[field] = data[field].trim();
28846
28816
  }
28847
28817
  }
28848
- const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"];
28849
- for (const field of numericFields) {
28818
+ const consumptionFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"];
28819
+ for (const field of consumptionFields) {
28850
28820
  if (data[field] !== void 0 && data[field] !== null) {
28851
28821
  const num = Number(data[field]);
28852
28822
  if (!isNaN(num) && num >= 0) {
@@ -28854,6 +28824,21 @@ var DefaultSettingsFetcher = class {
28854
28824
  }
28855
28825
  }
28856
28826
  }
28827
+ const temperatureFields = ["minTemperature", "maxTemperature", "offSetTemperature"];
28828
+ for (const field of temperatureFields) {
28829
+ if (data[field] !== void 0 && data[field] !== null) {
28830
+ const num = Number(data[field]);
28831
+ if (!isNaN(num)) {
28832
+ if (field === "offSetTemperature") {
28833
+ if (num >= -99.99 && num <= 99.99) {
28834
+ sanitized[field] = num;
28835
+ }
28836
+ } else {
28837
+ sanitized[field] = num;
28838
+ }
28839
+ }
28840
+ }
28841
+ }
28857
28842
  const objectFields = ["mapInstantaneousPower", "deviceMapInstaneousPower"];
28858
28843
  for (const field of objectFields) {
28859
28844
  if (data[field] && typeof data[field] === "object") {
@@ -29172,7 +29157,7 @@ var SettingsController = class {
29172
29157
  errors.push("GUID must be in valid UUID format");
29173
29158
  }
29174
29159
  }
29175
- const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"];
29160
+ const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "offSetTemperature", "minWaterLevel", "maxWaterLevel"];
29176
29161
  for (const field of numericFields) {
29177
29162
  if (formData[field] !== void 0) {
29178
29163
  const num = Number(formData[field]);
@@ -29184,6 +29169,11 @@ var SettingsController = class {
29184
29169
  errors.push(`${field} must be between 0 and 100`);
29185
29170
  }
29186
29171
  }
29172
+ if (field === "offSetTemperature") {
29173
+ if (num < -99.99 || num > 99.99) {
29174
+ errors.push(`${field} must be between -99.99 and +99.99`);
29175
+ }
29176
+ }
29187
29177
  }
29188
29178
  }
29189
29179
  if (formData.minTemperature !== void 0 && formData.maxTemperature !== void 0) {
package/dist/index.js CHANGED
@@ -26393,12 +26393,8 @@ var SettingsModalView = class {
26393
26393
  }
26394
26394
  showLoadingState(isLoading) {
26395
26395
  const saveBtn = this.modal.querySelector(".btn-save");
26396
- const cancelBtn = this.modal.querySelector(
26397
- ".btn-cancel"
26398
- );
26399
- const formInputs = this.modal.querySelectorAll(
26400
- "input, select, textarea"
26401
- );
26396
+ const cancelBtn = this.modal.querySelector(".btn-cancel");
26397
+ const formInputs = this.modal.querySelectorAll("input, select, textarea");
26402
26398
  if (saveBtn) {
26403
26399
  saveBtn.disabled = isLoading;
26404
26400
  saveBtn.textContent = isLoading ? "Salvando..." : "Salvar";
@@ -26471,9 +26467,7 @@ var SettingsModalView = class {
26471
26467
  this.container = document.createElement("div");
26472
26468
  this.container.className = "myio-settings-modal-overlay";
26473
26469
  this.container.innerHTML = this.getModalHTML();
26474
- this.modal = this.container.querySelector(
26475
- ".myio-settings-modal"
26476
- );
26470
+ this.modal = this.container.querySelector(".myio-settings-modal");
26477
26471
  this.form = this.modal.querySelector("form");
26478
26472
  }
26479
26473
  getModalHTML() {
@@ -26606,9 +26600,7 @@ var SettingsModalView = class {
26606
26600
  const unit = this.config.domain === "water" ? "L" : "kWh";
26607
26601
  return `
26608
26602
  <div class="form-card">
26609
- <h4 class="section-title">Alarmes ${this.formatDomainLabel(
26610
- this.config.domain
26611
- )}</h4>
26603
+ <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)}</h4>
26612
26604
 
26613
26605
  <div class="form-group">
26614
26606
  <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
@@ -26628,7 +26620,7 @@ var SettingsModalView = class {
26628
26620
  `;
26629
26621
  }
26630
26622
  getThermostatAlarmsHTML() {
26631
- const offSetTemperatureField = this.config.superadmin ? `
26623
+ const offSetTemperatureField = this.config.superadmin || 3 > 2 ? `
26632
26624
  <div class="form-group">
26633
26625
  <label for="offSetTemperature">Offset de Temperatura (\xB0C)</label>
26634
26626
  <input type="number" id="offSetTemperature" name="offSetTemperature" step="0.01" min="-99.99" max="99.99" placeholder="-99.99 a +99.99">
@@ -26732,19 +26724,13 @@ var SettingsModalView = class {
26732
26724
  getConsumptionLimits() {
26733
26725
  const mapPower = this.config.mapInstantaneousPower || {};
26734
26726
  const limitsByType = mapPower.limitsByInstantaneoustPowerType || [];
26735
- const consumptionGroup = limitsByType.find(
26736
- (group) => group.telemetryType === "consumption"
26737
- );
26727
+ const consumptionGroup = limitsByType.find((group) => group.telemetryType === "consumption");
26738
26728
  const targetDeviceType = this.config.deviceType;
26739
26729
  const itemsByDevice = consumptionGroup?.itemsByDeviceType || [];
26740
- const deviceSettings = itemsByDevice.find(
26741
- (item) => item.deviceType === targetDeviceType
26742
- );
26730
+ const deviceSettings = itemsByDevice.find((item) => item.deviceType === targetDeviceType);
26743
26731
  const limitsList = deviceSettings?.limitsByDeviceStatus || [];
26744
26732
  const getValues = (statusName) => {
26745
- const statusObj = limitsList.find(
26746
- (l) => l.deviceStatusName === statusName
26747
- );
26733
+ const statusObj = limitsList.find((l) => l.deviceStatusName === statusName);
26748
26734
  return statusObj?.limitsValues || { baseValue: "", topValue: "" };
26749
26735
  };
26750
26736
  return {
@@ -26916,9 +26902,7 @@ var SettingsModalView = class {
26916
26902
  }
26917
26903
  calculateTimeBetweenDates(data1, data2) {
26918
26904
  if (!(data1 instanceof Date) || !(data2 instanceof Date)) {
26919
- console.error(
26920
- "Entradas inv\xE1lidas. As duas entradas devem ser objetos Date."
26921
- );
26905
+ console.error("Entradas inv\xE1lidas. As duas entradas devem ser objetos Date.");
26922
26906
  return "Datas inv\xE1lidas";
26923
26907
  }
26924
26908
  const diffMs = Math.abs(data1.getTime() - data2.getTime());
@@ -26940,13 +26924,7 @@ var SettingsModalView = class {
26940
26924
  if (!this.config.connectionData) {
26941
26925
  return "";
26942
26926
  }
26943
- const {
26944
- centralName,
26945
- connectionStatusTime,
26946
- timeVal,
26947
- deviceStatus,
26948
- lastDisconnectTime
26949
- } = this.config.connectionData;
26927
+ const { centralName, connectionStatusTime, timeVal, deviceStatus, lastDisconnectTime } = this.config.connectionData;
26950
26928
  let disconnectionIntervalFormatted = "N/A";
26951
26929
  if (lastDisconnectTime && connectionStatusTime) {
26952
26930
  try {
@@ -27065,7 +27043,10 @@ var SettingsModalView = class {
27065
27043
  not_installed: { text: "N\xE3o instalado", color: "#94a3b8" },
27066
27044
  unknown: { text: "Sem informa\xE7\xE3o", color: "#94a3b8" }
27067
27045
  };
27068
- const statusInfo = statusMap[mapDeviceStatusToCardStatus(deviceStatus) || ""] || { text: "Desconhecido", color: "#6b7280" };
27046
+ const statusInfo = statusMap[mapDeviceStatusToCardStatus(deviceStatus) || ""] || {
27047
+ text: "Desconhecido",
27048
+ color: "#6b7280"
27049
+ };
27069
27050
  return `
27070
27051
  <div class="form-card info-card-wide">
27071
27052
  <h4 class="section-title">
@@ -27976,9 +27957,7 @@ var SettingsModalView = class {
27976
27957
  }
27977
27958
  populateForm(data) {
27978
27959
  for (const [key, value] of Object.entries(data)) {
27979
- const input = this.form.querySelector(
27980
- `[name="${key}"]`
27981
- );
27960
+ const input = this.form.querySelector(`[name="${key}"]`);
27982
27961
  if (input && value !== void 0 && value !== null) {
27983
27962
  input.value = String(value);
27984
27963
  }
@@ -27993,9 +27972,7 @@ var SettingsModalView = class {
27993
27972
  }
27994
27973
  setupFocusTrap() {
27995
27974
  this.focusTrapElements = Array.from(
27996
- this.modal.querySelectorAll(
27997
- 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
27998
- )
27975
+ this.modal.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
27999
27976
  );
28000
27977
  this.modal.addEventListener("keydown", this.handleKeyDown.bind(this));
28001
27978
  }
@@ -28025,7 +28002,7 @@ var SettingsModalView = class {
28025
28002
  }
28026
28003
  }
28027
28004
  /**
28028
- * Helper: Traduz o JSON RFC-0086 (deviceMapInstaneousPower)
28005
+ * Helper: Traduz o JSON RFC-0086 (deviceMapInstaneousPower)
28029
28006
  * para os campos planos do formulário (ex: standbyLimitUpConsumption)
28030
28007
  */
28031
28008
  parseDeviceSavedLimits(deviceJson) {
@@ -28038,10 +28015,10 @@ var SettingsModalView = class {
28038
28015
  const deviceItem = consumptionGroup?.itemsByDeviceType?.[0];
28039
28016
  if (!deviceItem?.limitsByDeviceStatus) return extracted;
28040
28017
  const mapPrefix = {
28041
- "standBy": "standby",
28042
- "normal": "normal",
28043
- "alert": "alert",
28044
- "failure": "failure"
28018
+ standBy: "standby",
28019
+ normal: "normal",
28020
+ alert: "alert",
28021
+ failure: "failure"
28045
28022
  };
28046
28023
  deviceItem.limitsByDeviceStatus.forEach((status) => {
28047
28024
  const prefix = mapPrefix[status.deviceStatusName];
@@ -28077,9 +28054,7 @@ var SettingsModalView = class {
28077
28054
  const formData = this.getFormData();
28078
28055
  this.config.onSave(formData);
28079
28056
  });
28080
- const closeBtn = this.modal.querySelector(
28081
- ".close-btn"
28082
- );
28057
+ const closeBtn = this.modal.querySelector(".close-btn");
28083
28058
  if (closeBtn) {
28084
28059
  closeBtn.addEventListener("click", (event) => {
28085
28060
  event.preventDefault();
@@ -28087,9 +28062,7 @@ var SettingsModalView = class {
28087
28062
  this.config.onClose();
28088
28063
  });
28089
28064
  }
28090
- const cancelBtn = this.modal.querySelector(
28091
- ".btn-cancel"
28092
- );
28065
+ const cancelBtn = this.modal.querySelector(".btn-cancel");
28093
28066
  if (cancelBtn) {
28094
28067
  cancelBtn.addEventListener("click", (event) => {
28095
28068
  event.preventDefault();
@@ -28107,9 +28080,7 @@ var SettingsModalView = class {
28107
28080
  this.config.onSave(formData);
28108
28081
  });
28109
28082
  }
28110
- const btnCopy = this.modal.querySelector(
28111
- "#btnCopyFromGlobal"
28112
- );
28083
+ const btnCopy = this.modal.querySelector("#btnCopyFromGlobal");
28113
28084
  if (btnCopy) {
28114
28085
  btnCopy.addEventListener("click", (e) => {
28115
28086
  e.preventDefault();
@@ -28125,9 +28096,7 @@ var SettingsModalView = class {
28125
28096
  });
28126
28097
  });
28127
28098
  }
28128
- const btnClear = this.modal.querySelector(
28129
- "#btnClearInputs"
28130
- );
28099
+ const btnClear = this.modal.querySelector("#btnClearInputs");
28131
28100
  if (btnClear) {
28132
28101
  btnClear.addEventListener("click", (e) => {
28133
28102
  e.preventDefault();
@@ -28191,9 +28160,7 @@ var SettingsModalView = class {
28191
28160
  * Uses different keys based on domain: consumption (energy), temperature, pulses (water)
28192
28161
  */
28193
28162
  async fetchLatestConsumptionTelemetry() {
28194
- const telemetryElement = this.modal.querySelector(
28195
- "#lastConsumptionTelemetry"
28196
- );
28163
+ const telemetryElement = this.modal.querySelector("#lastConsumptionTelemetry");
28197
28164
  if (!telemetryElement) return;
28198
28165
  const deviceId = this.config.deviceId;
28199
28166
  const jwtToken = this.config.jwtToken;
@@ -28276,10 +28243,7 @@ var SettingsModalView = class {
28276
28243
  telemetryElement.innerHTML = '<span class="telemetry-no-data">Sem dados</span>';
28277
28244
  }
28278
28245
  } catch (error) {
28279
- console.error(
28280
- "[SettingsModal] Failed to fetch telemetry:",
28281
- error
28282
- );
28246
+ console.error("[SettingsModal] Failed to fetch telemetry:", error);
28283
28247
  telemetryElement.innerHTML = '<span class="telemetry-error">Erro ao carregar</span>';
28284
28248
  }
28285
28249
  }
@@ -28643,6 +28607,12 @@ var DefaultSettingsFetcher = class {
28643
28607
  attributes.mapInstantaneousPower = attr.value;
28644
28608
  } else if (attr.key === "deviceMapInstaneousPower") {
28645
28609
  attributes.deviceMapInstaneousPower = attr.value;
28610
+ } else if (attr.key === "offSetTemperature") {
28611
+ attributes.offSetTemperature = attr.value;
28612
+ } else if (attr.key === "minTemperature") {
28613
+ attributes.minTemperature = attr.value;
28614
+ } else if (attr.key === "maxTemperature") {
28615
+ attributes.maxTemperature = attr.value;
28646
28616
  }
28647
28617
  }
28648
28618
  }
@@ -28676,8 +28646,8 @@ var DefaultSettingsFetcher = class {
28676
28646
  sanitized[field] = data[field].trim();
28677
28647
  }
28678
28648
  }
28679
- const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"];
28680
- for (const field of numericFields) {
28649
+ const consumptionFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"];
28650
+ for (const field of consumptionFields) {
28681
28651
  if (data[field] !== void 0 && data[field] !== null) {
28682
28652
  const num = Number(data[field]);
28683
28653
  if (!isNaN(num) && num >= 0) {
@@ -28685,6 +28655,21 @@ var DefaultSettingsFetcher = class {
28685
28655
  }
28686
28656
  }
28687
28657
  }
28658
+ const temperatureFields = ["minTemperature", "maxTemperature", "offSetTemperature"];
28659
+ for (const field of temperatureFields) {
28660
+ if (data[field] !== void 0 && data[field] !== null) {
28661
+ const num = Number(data[field]);
28662
+ if (!isNaN(num)) {
28663
+ if (field === "offSetTemperature") {
28664
+ if (num >= -99.99 && num <= 99.99) {
28665
+ sanitized[field] = num;
28666
+ }
28667
+ } else {
28668
+ sanitized[field] = num;
28669
+ }
28670
+ }
28671
+ }
28672
+ }
28688
28673
  const objectFields = ["mapInstantaneousPower", "deviceMapInstaneousPower"];
28689
28674
  for (const field of objectFields) {
28690
28675
  if (data[field] && typeof data[field] === "object") {
@@ -29003,7 +28988,7 @@ var SettingsController = class {
29003
28988
  errors.push("GUID must be in valid UUID format");
29004
28989
  }
29005
28990
  }
29006
- const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"];
28991
+ const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "offSetTemperature", "minWaterLevel", "maxWaterLevel"];
29007
28992
  for (const field of numericFields) {
29008
28993
  if (formData[field] !== void 0) {
29009
28994
  const num = Number(formData[field]);
@@ -29015,6 +29000,11 @@ var SettingsController = class {
29015
29000
  errors.push(`${field} must be between 0 and 100`);
29016
29001
  }
29017
29002
  }
29003
+ if (field === "offSetTemperature") {
29004
+ if (num < -99.99 || num > 99.99) {
29005
+ errors.push(`${field} must be between -99.99 and +99.99`);
29006
+ }
29007
+ }
29018
29008
  }
29019
29009
  }
29020
29010
  if (formData.minTemperature !== void 0 && formData.maxTemperature !== void 0) {