myio-js-library 0.1.113 → 0.1.114

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
@@ -12783,9 +12783,17 @@ var SettingsModalView = class {
12783
12783
  const data = {};
12784
12784
  for (const [key, value] of formData.entries()) {
12785
12785
  if (typeof value === "string") {
12786
- if (["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"].includes(key)) {
12786
+ if (["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"].includes(key)) {
12787
12787
  const num = parseFloat(value);
12788
- if (!isNaN(num) && num >= 0) {
12788
+ if (!isNaN(num)) {
12789
+ if (key.includes("Kwh") && num < 0) {
12790
+ continue;
12791
+ }
12792
+ if (key.includes("WaterLevel")) {
12793
+ if (num < 0 || num > 100) {
12794
+ continue;
12795
+ }
12796
+ }
12789
12797
  data[key] = num;
12790
12798
  }
12791
12799
  } else if (value.trim()) {
@@ -12827,7 +12835,7 @@ var SettingsModalView = class {
12827
12835
  `;
12828
12836
  }
12829
12837
  getFormHTML() {
12830
- const unit = this.config.domain === "water" ? "L" : "kWh";
12838
+ const deviceType = this.config.deviceType;
12831
12839
  return `
12832
12840
  <div class="form-layout">
12833
12841
  <!-- Top Row: Two cards side by side -->
@@ -12856,24 +12864,7 @@ var SettingsModalView = class {
12856
12864
 
12857
12865
  <!-- Right Column: Alarms -->
12858
12866
  <div class="form-column">
12859
- <div class="form-card">
12860
- <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)} - ${this.config.deviceLabel || "Outback"}</h4>
12861
-
12862
- <div class="form-group">
12863
- <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
12864
- <input type="number" id="maxDailyKwh" name="maxDailyKwh" min="0" step="0.1">
12865
- </div>
12866
-
12867
- <div class="form-group">
12868
- <label for="maxNightKwh">Consumo M\xE1ximo na Madrugada (0h\u201306h)</label>
12869
- <input type="number" id="maxNightKwh" name="maxNightKwh" min="0" step="0.1">
12870
- </div>
12871
-
12872
- <div class="form-group">
12873
- <label for="maxBusinessKwh">Consumo M\xE1ximo Hor\xE1rio Comercial (09h\u201322h)</label>
12874
- <input type="number" id="maxBusinessKwh" name="maxBusinessKwh" min="0" step="0.1">
12875
- </div>
12876
- </div>
12867
+ ${this.getAlarmsHTML(deviceType)}
12877
12868
  </div>
12878
12869
  </div>
12879
12870
 
@@ -12882,6 +12873,73 @@ var SettingsModalView = class {
12882
12873
  </div>
12883
12874
  `;
12884
12875
  }
12876
+ getAlarmsHTML(deviceType) {
12877
+ switch (deviceType) {
12878
+ case "TERMOSTATO":
12879
+ return this.getThermostatAlarmsHTML();
12880
+ case "CAIXA_DAGUA":
12881
+ return this.getWaterTankAlarmsHTML();
12882
+ default:
12883
+ return this.getConsumptionAlarmsHTML();
12884
+ }
12885
+ }
12886
+ getConsumptionAlarmsHTML() {
12887
+ const unit = this.config.domain === "water" ? "L" : "kWh";
12888
+ return `
12889
+ <div class="form-card">
12890
+ <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)} - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12891
+
12892
+ <div class="form-group">
12893
+ <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
12894
+ <input type="number" id="maxDailyKwh" name="maxDailyKwh" min="0" step="0.1">
12895
+ </div>
12896
+
12897
+ <div class="form-group">
12898
+ <label for="maxNightKwh">Consumo M\xE1ximo na Madrugada (0h\u201306h)</label>
12899
+ <input type="number" id="maxNightKwh" name="maxNightKwh" min="0" step="0.1">
12900
+ </div>
12901
+
12902
+ <div class="form-group">
12903
+ <label for="maxBusinessKwh">Consumo M\xE1ximo Hor\xE1rio Comercial (09h\u201322h)</label>
12904
+ <input type="number" id="maxBusinessKwh" name="maxBusinessKwh" min="0" step="0.1">
12905
+ </div>
12906
+ </div>
12907
+ `;
12908
+ }
12909
+ getThermostatAlarmsHTML() {
12910
+ return `
12911
+ <div class="form-card">
12912
+ <h4 class="section-title">Alarmes de Temperatura - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12913
+
12914
+ <div class="form-group">
12915
+ <label for="minTemperature">Temperatura M\xEDnima (\xB0C)</label>
12916
+ <input type="number" id="minTemperature" name="minTemperature" step="0.1">
12917
+ </div>
12918
+
12919
+ <div class="form-group">
12920
+ <label for="maxTemperature">Temperatura M\xE1xima (\xB0C)</label>
12921
+ <input type="number" id="maxTemperature" name="maxTemperature" step="0.1">
12922
+ </div>
12923
+ </div>
12924
+ `;
12925
+ }
12926
+ getWaterTankAlarmsHTML() {
12927
+ return `
12928
+ <div class="form-card">
12929
+ <h4 class="section-title">Alarmes de N\xEDvel - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12930
+
12931
+ <div class="form-group">
12932
+ <label for="minWaterLevel">N\xEDvel M\xEDnimo (%)</label>
12933
+ <input type="number" id="minWaterLevel" name="minWaterLevel" min="0" max="100" step="0.1" placeholder="Risco de falta d'\xE1gua">
12934
+ </div>
12935
+
12936
+ <div class="form-group">
12937
+ <label for="maxWaterLevel">N\xEDvel M\xE1ximo (%)</label>
12938
+ <input type="number" id="maxWaterLevel" name="maxWaterLevel" min="0" max="100" step="0.1" placeholder="Risco de transbordar">
12939
+ </div>
12940
+ </div>
12941
+ `;
12942
+ }
12885
12943
  getConnectionInfoHTML() {
12886
12944
  if (!this.config.connectionData) {
12887
12945
  return "";
@@ -13696,6 +13754,8 @@ var SettingsController = class {
13696
13754
  // Default theme
13697
13755
  closeOnBackdrop: params.ui?.closeOnBackdrop !== false,
13698
13756
  domain: params.domain || "energy",
13757
+ deviceType: params.deviceType,
13758
+ // Pass deviceType for conditional rendering
13699
13759
  themeTokens: params.ui?.themeTokens,
13700
13760
  i18n: params.ui?.i18n,
13701
13761
  deviceLabel: params.label,
@@ -13910,13 +13970,32 @@ var SettingsController = class {
13910
13970
  errors.push("GUID must be in valid UUID format");
13911
13971
  }
13912
13972
  }
13913
- const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"];
13973
+ const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"];
13914
13974
  for (const field of numericFields) {
13915
13975
  if (formData[field] !== void 0) {
13916
13976
  const num = Number(formData[field]);
13917
- if (isNaN(num) || num < 0) {
13918
- errors.push(`${field} must be a positive number`);
13977
+ if (isNaN(num) || field.includes("Kwh") && num < 0) {
13978
+ errors.push(`${field} must be a valid number`);
13919
13979
  }
13980
+ if (field.includes("WaterLevel")) {
13981
+ if (num < 0 || num > 100) {
13982
+ errors.push(`${field} must be between 0 and 100`);
13983
+ }
13984
+ }
13985
+ }
13986
+ }
13987
+ if (formData.minTemperature !== void 0 && formData.maxTemperature !== void 0) {
13988
+ const minTemp = Number(formData.minTemperature);
13989
+ const maxTemp = Number(formData.maxTemperature);
13990
+ if (!isNaN(minTemp) && !isNaN(maxTemp) && minTemp >= maxTemp) {
13991
+ errors.push("Minimum temperature must be less than maximum temperature");
13992
+ }
13993
+ }
13994
+ if (formData.minWaterLevel !== void 0 && formData.maxWaterLevel !== void 0) {
13995
+ const minLevel = Number(formData.minWaterLevel);
13996
+ const maxLevel = Number(formData.maxWaterLevel);
13997
+ if (!isNaN(minLevel) && !isNaN(maxLevel) && minLevel >= maxLevel) {
13998
+ errors.push("Minimum water level must be less than maximum water level");
13920
13999
  }
13921
14000
  }
13922
14001
  if (formData.label && formData.label.length > 255) {
package/dist/index.d.cts CHANGED
@@ -1215,6 +1215,7 @@ interface OpenDashboardPopupSettingsParams {
1215
1215
  identifier?: string;
1216
1216
  label?: string;
1217
1217
  domain?: Domain;
1218
+ deviceType?: string;
1218
1219
  connectionData?: {
1219
1220
  centralName?: string;
1220
1221
  connectionStatusTime?: string;
@@ -1256,6 +1257,10 @@ interface OpenDashboardPopupSettingsParams {
1256
1257
  maxDailyKwh?: number;
1257
1258
  maxNightKwh?: number;
1258
1259
  maxBusinessKwh?: number;
1260
+ minTemperature?: number;
1261
+ maxTemperature?: number;
1262
+ minWaterLevel?: number;
1263
+ maxWaterLevel?: number;
1259
1264
  };
1260
1265
  }
1261
1266
  interface PersistResult {
package/dist/index.js CHANGED
@@ -12693,9 +12693,17 @@ var SettingsModalView = class {
12693
12693
  const data = {};
12694
12694
  for (const [key, value] of formData.entries()) {
12695
12695
  if (typeof value === "string") {
12696
- if (["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"].includes(key)) {
12696
+ if (["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"].includes(key)) {
12697
12697
  const num = parseFloat(value);
12698
- if (!isNaN(num) && num >= 0) {
12698
+ if (!isNaN(num)) {
12699
+ if (key.includes("Kwh") && num < 0) {
12700
+ continue;
12701
+ }
12702
+ if (key.includes("WaterLevel")) {
12703
+ if (num < 0 || num > 100) {
12704
+ continue;
12705
+ }
12706
+ }
12699
12707
  data[key] = num;
12700
12708
  }
12701
12709
  } else if (value.trim()) {
@@ -12737,7 +12745,7 @@ var SettingsModalView = class {
12737
12745
  `;
12738
12746
  }
12739
12747
  getFormHTML() {
12740
- const unit = this.config.domain === "water" ? "L" : "kWh";
12748
+ const deviceType = this.config.deviceType;
12741
12749
  return `
12742
12750
  <div class="form-layout">
12743
12751
  <!-- Top Row: Two cards side by side -->
@@ -12766,24 +12774,7 @@ var SettingsModalView = class {
12766
12774
 
12767
12775
  <!-- Right Column: Alarms -->
12768
12776
  <div class="form-column">
12769
- <div class="form-card">
12770
- <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)} - ${this.config.deviceLabel || "Outback"}</h4>
12771
-
12772
- <div class="form-group">
12773
- <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
12774
- <input type="number" id="maxDailyKwh" name="maxDailyKwh" min="0" step="0.1">
12775
- </div>
12776
-
12777
- <div class="form-group">
12778
- <label for="maxNightKwh">Consumo M\xE1ximo na Madrugada (0h\u201306h)</label>
12779
- <input type="number" id="maxNightKwh" name="maxNightKwh" min="0" step="0.1">
12780
- </div>
12781
-
12782
- <div class="form-group">
12783
- <label for="maxBusinessKwh">Consumo M\xE1ximo Hor\xE1rio Comercial (09h\u201322h)</label>
12784
- <input type="number" id="maxBusinessKwh" name="maxBusinessKwh" min="0" step="0.1">
12785
- </div>
12786
- </div>
12777
+ ${this.getAlarmsHTML(deviceType)}
12787
12778
  </div>
12788
12779
  </div>
12789
12780
 
@@ -12792,6 +12783,73 @@ var SettingsModalView = class {
12792
12783
  </div>
12793
12784
  `;
12794
12785
  }
12786
+ getAlarmsHTML(deviceType) {
12787
+ switch (deviceType) {
12788
+ case "TERMOSTATO":
12789
+ return this.getThermostatAlarmsHTML();
12790
+ case "CAIXA_DAGUA":
12791
+ return this.getWaterTankAlarmsHTML();
12792
+ default:
12793
+ return this.getConsumptionAlarmsHTML();
12794
+ }
12795
+ }
12796
+ getConsumptionAlarmsHTML() {
12797
+ const unit = this.config.domain === "water" ? "L" : "kWh";
12798
+ return `
12799
+ <div class="form-card">
12800
+ <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)} - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12801
+
12802
+ <div class="form-group">
12803
+ <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
12804
+ <input type="number" id="maxDailyKwh" name="maxDailyKwh" min="0" step="0.1">
12805
+ </div>
12806
+
12807
+ <div class="form-group">
12808
+ <label for="maxNightKwh">Consumo M\xE1ximo na Madrugada (0h\u201306h)</label>
12809
+ <input type="number" id="maxNightKwh" name="maxNightKwh" min="0" step="0.1">
12810
+ </div>
12811
+
12812
+ <div class="form-group">
12813
+ <label for="maxBusinessKwh">Consumo M\xE1ximo Hor\xE1rio Comercial (09h\u201322h)</label>
12814
+ <input type="number" id="maxBusinessKwh" name="maxBusinessKwh" min="0" step="0.1">
12815
+ </div>
12816
+ </div>
12817
+ `;
12818
+ }
12819
+ getThermostatAlarmsHTML() {
12820
+ return `
12821
+ <div class="form-card">
12822
+ <h4 class="section-title">Alarmes de Temperatura - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12823
+
12824
+ <div class="form-group">
12825
+ <label for="minTemperature">Temperatura M\xEDnima (\xB0C)</label>
12826
+ <input type="number" id="minTemperature" name="minTemperature" step="0.1">
12827
+ </div>
12828
+
12829
+ <div class="form-group">
12830
+ <label for="maxTemperature">Temperatura M\xE1xima (\xB0C)</label>
12831
+ <input type="number" id="maxTemperature" name="maxTemperature" step="0.1">
12832
+ </div>
12833
+ </div>
12834
+ `;
12835
+ }
12836
+ getWaterTankAlarmsHTML() {
12837
+ return `
12838
+ <div class="form-card">
12839
+ <h4 class="section-title">Alarmes de N\xEDvel - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12840
+
12841
+ <div class="form-group">
12842
+ <label for="minWaterLevel">N\xEDvel M\xEDnimo (%)</label>
12843
+ <input type="number" id="minWaterLevel" name="minWaterLevel" min="0" max="100" step="0.1" placeholder="Risco de falta d'\xE1gua">
12844
+ </div>
12845
+
12846
+ <div class="form-group">
12847
+ <label for="maxWaterLevel">N\xEDvel M\xE1ximo (%)</label>
12848
+ <input type="number" id="maxWaterLevel" name="maxWaterLevel" min="0" max="100" step="0.1" placeholder="Risco de transbordar">
12849
+ </div>
12850
+ </div>
12851
+ `;
12852
+ }
12795
12853
  getConnectionInfoHTML() {
12796
12854
  if (!this.config.connectionData) {
12797
12855
  return "";
@@ -13606,6 +13664,8 @@ var SettingsController = class {
13606
13664
  // Default theme
13607
13665
  closeOnBackdrop: params.ui?.closeOnBackdrop !== false,
13608
13666
  domain: params.domain || "energy",
13667
+ deviceType: params.deviceType,
13668
+ // Pass deviceType for conditional rendering
13609
13669
  themeTokens: params.ui?.themeTokens,
13610
13670
  i18n: params.ui?.i18n,
13611
13671
  deviceLabel: params.label,
@@ -13820,13 +13880,32 @@ var SettingsController = class {
13820
13880
  errors.push("GUID must be in valid UUID format");
13821
13881
  }
13822
13882
  }
13823
- const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"];
13883
+ const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"];
13824
13884
  for (const field of numericFields) {
13825
13885
  if (formData[field] !== void 0) {
13826
13886
  const num = Number(formData[field]);
13827
- if (isNaN(num) || num < 0) {
13828
- errors.push(`${field} must be a positive number`);
13887
+ if (isNaN(num) || field.includes("Kwh") && num < 0) {
13888
+ errors.push(`${field} must be a valid number`);
13829
13889
  }
13890
+ if (field.includes("WaterLevel")) {
13891
+ if (num < 0 || num > 100) {
13892
+ errors.push(`${field} must be between 0 and 100`);
13893
+ }
13894
+ }
13895
+ }
13896
+ }
13897
+ if (formData.minTemperature !== void 0 && formData.maxTemperature !== void 0) {
13898
+ const minTemp = Number(formData.minTemperature);
13899
+ const maxTemp = Number(formData.maxTemperature);
13900
+ if (!isNaN(minTemp) && !isNaN(maxTemp) && minTemp >= maxTemp) {
13901
+ errors.push("Minimum temperature must be less than maximum temperature");
13902
+ }
13903
+ }
13904
+ if (formData.minWaterLevel !== void 0 && formData.maxWaterLevel !== void 0) {
13905
+ const minLevel = Number(formData.minWaterLevel);
13906
+ const maxLevel = Number(formData.maxWaterLevel);
13907
+ if (!isNaN(minLevel) && !isNaN(maxLevel) && minLevel >= maxLevel) {
13908
+ errors.push("Minimum water level must be less than maximum water level");
13830
13909
  }
13831
13910
  }
13832
13911
  if (formData.label && formData.label.length > 255) {
@@ -12647,9 +12647,17 @@
12647
12647
  const data = {};
12648
12648
  for (const [key, value] of formData.entries()) {
12649
12649
  if (typeof value === "string") {
12650
- if (["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"].includes(key)) {
12650
+ if (["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"].includes(key)) {
12651
12651
  const num = parseFloat(value);
12652
- if (!isNaN(num) && num >= 0) {
12652
+ if (!isNaN(num)) {
12653
+ if (key.includes("Kwh") && num < 0) {
12654
+ continue;
12655
+ }
12656
+ if (key.includes("WaterLevel")) {
12657
+ if (num < 0 || num > 100) {
12658
+ continue;
12659
+ }
12660
+ }
12653
12661
  data[key] = num;
12654
12662
  }
12655
12663
  } else if (value.trim()) {
@@ -12691,7 +12699,7 @@
12691
12699
  `;
12692
12700
  }
12693
12701
  getFormHTML() {
12694
- const unit = this.config.domain === "water" ? "L" : "kWh";
12702
+ const deviceType = this.config.deviceType;
12695
12703
  return `
12696
12704
  <div class="form-layout">
12697
12705
  <!-- Top Row: Two cards side by side -->
@@ -12720,24 +12728,7 @@
12720
12728
 
12721
12729
  <!-- Right Column: Alarms -->
12722
12730
  <div class="form-column">
12723
- <div class="form-card">
12724
- <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)} - ${this.config.deviceLabel || "Outback"}</h4>
12725
-
12726
- <div class="form-group">
12727
- <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
12728
- <input type="number" id="maxDailyKwh" name="maxDailyKwh" min="0" step="0.1">
12729
- </div>
12730
-
12731
- <div class="form-group">
12732
- <label for="maxNightKwh">Consumo M\xE1ximo na Madrugada (0h\u201306h)</label>
12733
- <input type="number" id="maxNightKwh" name="maxNightKwh" min="0" step="0.1">
12734
- </div>
12735
-
12736
- <div class="form-group">
12737
- <label for="maxBusinessKwh">Consumo M\xE1ximo Hor\xE1rio Comercial (09h\u201322h)</label>
12738
- <input type="number" id="maxBusinessKwh" name="maxBusinessKwh" min="0" step="0.1">
12739
- </div>
12740
- </div>
12731
+ ${this.getAlarmsHTML(deviceType)}
12741
12732
  </div>
12742
12733
  </div>
12743
12734
 
@@ -12746,6 +12737,73 @@
12746
12737
  </div>
12747
12738
  `;
12748
12739
  }
12740
+ getAlarmsHTML(deviceType) {
12741
+ switch (deviceType) {
12742
+ case "TERMOSTATO":
12743
+ return this.getThermostatAlarmsHTML();
12744
+ case "CAIXA_DAGUA":
12745
+ return this.getWaterTankAlarmsHTML();
12746
+ default:
12747
+ return this.getConsumptionAlarmsHTML();
12748
+ }
12749
+ }
12750
+ getConsumptionAlarmsHTML() {
12751
+ const unit = this.config.domain === "water" ? "L" : "kWh";
12752
+ return `
12753
+ <div class="form-card">
12754
+ <h4 class="section-title">Alarmes ${this.formatDomainLabel(this.config.domain)} - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12755
+
12756
+ <div class="form-group">
12757
+ <label for="maxDailyKwh">Consumo M\xE1ximo Di\xE1rio (${unit})</label>
12758
+ <input type="number" id="maxDailyKwh" name="maxDailyKwh" min="0" step="0.1">
12759
+ </div>
12760
+
12761
+ <div class="form-group">
12762
+ <label for="maxNightKwh">Consumo M\xE1ximo na Madrugada (0h\u201306h)</label>
12763
+ <input type="number" id="maxNightKwh" name="maxNightKwh" min="0" step="0.1">
12764
+ </div>
12765
+
12766
+ <div class="form-group">
12767
+ <label for="maxBusinessKwh">Consumo M\xE1ximo Hor\xE1rio Comercial (09h\u201322h)</label>
12768
+ <input type="number" id="maxBusinessKwh" name="maxBusinessKwh" min="0" step="0.1">
12769
+ </div>
12770
+ </div>
12771
+ `;
12772
+ }
12773
+ getThermostatAlarmsHTML() {
12774
+ return `
12775
+ <div class="form-card">
12776
+ <h4 class="section-title">Alarmes de Temperatura - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12777
+
12778
+ <div class="form-group">
12779
+ <label for="minTemperature">Temperatura M\xEDnima (\xB0C)</label>
12780
+ <input type="number" id="minTemperature" name="minTemperature" step="0.1">
12781
+ </div>
12782
+
12783
+ <div class="form-group">
12784
+ <label for="maxTemperature">Temperatura M\xE1xima (\xB0C)</label>
12785
+ <input type="number" id="maxTemperature" name="maxTemperature" step="0.1">
12786
+ </div>
12787
+ </div>
12788
+ `;
12789
+ }
12790
+ getWaterTankAlarmsHTML() {
12791
+ return `
12792
+ <div class="form-card">
12793
+ <h4 class="section-title">Alarmes de N\xEDvel - ${this.config.deviceLabel || "SEM IDENTIFICADOR"}</h4>
12794
+
12795
+ <div class="form-group">
12796
+ <label for="minWaterLevel">N\xEDvel M\xEDnimo (%)</label>
12797
+ <input type="number" id="minWaterLevel" name="minWaterLevel" min="0" max="100" step="0.1" placeholder="Risco de falta d'\xE1gua">
12798
+ </div>
12799
+
12800
+ <div class="form-group">
12801
+ <label for="maxWaterLevel">N\xEDvel M\xE1ximo (%)</label>
12802
+ <input type="number" id="maxWaterLevel" name="maxWaterLevel" min="0" max="100" step="0.1" placeholder="Risco de transbordar">
12803
+ </div>
12804
+ </div>
12805
+ `;
12806
+ }
12749
12807
  getConnectionInfoHTML() {
12750
12808
  if (!this.config.connectionData) {
12751
12809
  return "";
@@ -13560,6 +13618,8 @@
13560
13618
  // Default theme
13561
13619
  closeOnBackdrop: params.ui?.closeOnBackdrop !== false,
13562
13620
  domain: params.domain || "energy",
13621
+ deviceType: params.deviceType,
13622
+ // Pass deviceType for conditional rendering
13563
13623
  themeTokens: params.ui?.themeTokens,
13564
13624
  i18n: params.ui?.i18n,
13565
13625
  deviceLabel: params.label,
@@ -13774,13 +13834,32 @@
13774
13834
  errors.push("GUID must be in valid UUID format");
13775
13835
  }
13776
13836
  }
13777
- const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh"];
13837
+ const numericFields = ["maxDailyKwh", "maxNightKwh", "maxBusinessKwh", "minTemperature", "maxTemperature", "minWaterLevel", "maxWaterLevel"];
13778
13838
  for (const field of numericFields) {
13779
13839
  if (formData[field] !== void 0) {
13780
13840
  const num = Number(formData[field]);
13781
- if (isNaN(num) || num < 0) {
13782
- errors.push(`${field} must be a positive number`);
13841
+ if (isNaN(num) || field.includes("Kwh") && num < 0) {
13842
+ errors.push(`${field} must be a valid number`);
13783
13843
  }
13844
+ if (field.includes("WaterLevel")) {
13845
+ if (num < 0 || num > 100) {
13846
+ errors.push(`${field} must be between 0 and 100`);
13847
+ }
13848
+ }
13849
+ }
13850
+ }
13851
+ if (formData.minTemperature !== void 0 && formData.maxTemperature !== void 0) {
13852
+ const minTemp = Number(formData.minTemperature);
13853
+ const maxTemp = Number(formData.maxTemperature);
13854
+ if (!isNaN(minTemp) && !isNaN(maxTemp) && minTemp >= maxTemp) {
13855
+ errors.push("Minimum temperature must be less than maximum temperature");
13856
+ }
13857
+ }
13858
+ if (formData.minWaterLevel !== void 0 && formData.maxWaterLevel !== void 0) {
13859
+ const minLevel = Number(formData.minWaterLevel);
13860
+ const maxLevel = Number(formData.maxWaterLevel);
13861
+ if (!isNaN(minLevel) && !isNaN(maxLevel) && minLevel >= maxLevel) {
13862
+ errors.push("Minimum water level must be less than maximum water level");
13784
13863
  }
13785
13864
  }
13786
13865
  if (formData.label && formData.label.length > 255) {