iobroker.pv-notifications 1.2.17 → 1.2.18

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.
Files changed (3) hide show
  1. package/io-package.json +1 -1
  2. package/main.js +14 -31
  3. package/package.json +1 -1
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "pv-notifications",
4
- "version": "1.2.17",
4
+ "version": "1.2.18",
5
5
  "titleLang": {
6
6
  "en": "PV Notifications",
7
7
  "de": "PV-Benachrichtigungen",
package/main.js CHANGED
@@ -548,13 +548,6 @@ class PvNotifications extends utils.Adapter {
548
548
  }
549
549
  }
550
550
 
551
- /**
552
- * Is called when adapter receives configuration.
553
- */
554
- async onConfigChange() {
555
- this.log.info('Configuration changed');
556
- }
557
-
558
551
  /**
559
552
  * Is called if a subscribed state changes
560
553
  *
@@ -580,7 +573,7 @@ class PvNotifications extends utils.Adapter {
580
573
 
581
574
  // Process battery SOC change
582
575
  if (id === this.config.batterySOC) {
583
- this.onBatterySOCChange(state.val);
576
+ await this.onBatterySOCChange(state.val);
584
577
  return;
585
578
  }
586
579
 
@@ -711,7 +704,10 @@ class PvNotifications extends utils.Adapter {
711
704
  }
712
705
  // === Intermediate-Stufen (nur wenn nicht voll/leer und nicht nachts und nicht in Ruhezeit) ===
713
706
  if (soc !== this.config.thresholdFull && soc !== this.config.thresholdEmpty) {
714
- const intermediateSteps = this.config.intermediateSteps.split(',').map(s => parseInt(s.trim()));
707
+ const intermediateSteps = (this.config.intermediateSteps || '20,40,60,80')
708
+ .split(',')
709
+ .map(s => parseInt(s.trim()))
710
+ .filter(n => !isNaN(n));
715
711
 
716
712
  // Prüfe Intermediate-Stufen - nur außerhalb der Nachtzeit und Ruhezeit
717
713
  const allowIntermediate = (!nightTime || !nightModeActive) && (!quietTime || !quietModeActive);
@@ -1093,10 +1089,10 @@ class PvNotifications extends utils.Adapter {
1093
1089
  direction === 'up'
1094
1090
  ? this.systemLang === 'ru'
1095
1091
  ? '✅ Батарея заряжается'
1096
- : '✅ Batterie wird geladen'
1092
+ : '✅ Battery charging'
1097
1093
  : this.systemLang === 'ru'
1098
1094
  ? '⚠️ Батарея разряжается'
1099
- : '⚠️ Batterie wird entladen';
1095
+ : '⚠️ Battery discharging';
1100
1096
 
1101
1097
  // Einheitliche Nachricht für alle Stufen (20, 40, 60, 80)
1102
1098
  const batteryAt = this.translate('Battery at');
@@ -1467,23 +1463,6 @@ ${statusText}
1467
1463
  );
1468
1464
  }
1469
1465
 
1470
- /**
1471
- * State-Wert holen
1472
- *
1473
- * @param {string} id - State ID
1474
- */
1475
- getStateValue(id) {
1476
- if (!id) {
1477
- return 0;
1478
- }
1479
- try {
1480
- const state = this.getState(id);
1481
- return state && state.val !== null && state.val !== undefined ? state.val : 0;
1482
- } catch {
1483
- return 0;
1484
- }
1485
- }
1486
-
1487
1466
  /**
1488
1467
  * Runde Zahl auf Dezimalstellen
1489
1468
  *
@@ -1540,7 +1519,7 @@ ${statusText}
1540
1519
  }, 60000); // Jede Minute ausführen
1541
1520
 
1542
1521
  this.log.info(
1543
- `Zeitgesteuerte Aufgaben gestartet (Täglich: ${this.config.statsDayTime}, Wöchentlich: Tag ${this.config.statsWeekDay} um ${this.config.statsWeekTime})`,
1522
+ `Scheduled tasks started (Daily: ${this.config.statsDayTime}, Weekly: day ${this.config.statsWeekDay} at ${this.config.statsWeekTime})`,
1544
1523
  );
1545
1524
  }
1546
1525
 
@@ -1899,8 +1878,12 @@ ${statusText}
1899
1878
  try {
1900
1879
  // Wetter heute
1901
1880
  if (this.config.weatherTodayText || this.config.weatherTodayTemp) {
1902
- const weatherTodayTextState = await this.getForeignStateAsync(this.config.weatherTodayText);
1903
- const weatherTodayState = await this.getForeignStateAsync(this.config.weatherTodayTemp);
1881
+ const weatherTodayTextState = this.config.weatherTodayText
1882
+ ? await this.getForeignStateAsync(this.config.weatherTodayText)
1883
+ : null;
1884
+ const weatherTodayState = this.config.weatherTodayTemp
1885
+ ? await this.getForeignStateAsync(this.config.weatherTodayTemp)
1886
+ : null;
1904
1887
 
1905
1888
  const weatherTodayText =
1906
1889
  weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.pv-notifications",
3
- "version": "1.2.17",
3
+ "version": "1.2.18",
4
4
  "description": "PV-Anlage Batterie-Status Telegram Benachrichtigungen",
5
5
  "author": {
6
6
  "name": "Alex1808 via LLM: Qwen",