iobroker.pv-notifications 1.1.0 → 1.1.2

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/README.md CHANGED
@@ -339,14 +339,15 @@ sadam6752@gmail.com
339
339
  ### **WORK IN PROGRESS**
340
340
  -->
341
341
 
342
- ### 1.1.0 (2026-03-01)
342
+ ### 1.1.2 (2026-03-01)
343
343
 
344
- * (FIX) buildFullMessage() and buildEmptyMessage() now read from INTERNAL states (statistics.currentPower, etc.) instead of external config states
345
- * (FIX) buildFullMessage() and buildEmptyMessage() converted to async functions with await
344
+ * (FIX) Weather data now read correctly using getForeignStateAsync() instead of getStateValue()
345
+ * (FIX) Weather data added to daily statistics (buildDailyStatsMessage) and intermediate messages (buildIntermediateMessage)
346
+ * (ADD) New checkbox 'weatherEnabled' to enable/disable weather data in messages
346
347
 
347
- ### 1.0.99 (2026-03-01)
348
+ ### 1.1.1 (2026-03-01)
348
349
 
349
- * (FIX) Weekly stats auto-saved every Sunday at 23:55 (before sourceanalytix reset at 00:00)
350
+ * (FIX) Intermediate messages: Flag reset condition changed from `> 2` to `>= 2` for proper 2% tolerance
350
351
 
351
352
  ### 1.0.93 (2026-02-27)
352
353
 
@@ -68,6 +68,8 @@
68
68
  "label_monthlyStatsTime": "Uhrzeit",
69
69
  "tooltip_monthlyStatsTime": "Format: HH:MM (z.B. 09:00)",
70
70
  "header_weather": "Wetter (Optional)",
71
+ "label_weatherEnabled": "Wetterdaten in Nachrichten anzeigen",
72
+ "tooltip_weatherEnabled": "Wenn aktiviert, werden Wetterdaten in Tagesstatistik und Batterie-Status-Nachrichten angezeigt",
71
73
  "label_weatherTodayText": "Wetter heute",
72
74
  "tooltip_weatherTodayText": "Z.B. daswetter.0.Day0.forecast.currentSymbol",
73
75
  "label_weatherTodayTemp": "Temperatur heute (°C)",
@@ -68,6 +68,8 @@
68
68
  "label_monthlyStatsTime": "Time",
69
69
  "tooltip_monthlyStatsTime": "Format: HH:MM (e.g. 09:00)",
70
70
  "header_weather": "Weather (Optional)",
71
+ "label_weatherEnabled": "Show weather data in messages",
72
+ "tooltip_weatherEnabled": "If enabled, weather data will be shown in daily statistics and battery status messages",
71
73
  "label_weatherTodayText": "Weather today",
72
74
  "tooltip_weatherTodayText": "e.g. daswetter.0.Day0.forecast.currentSymbol",
73
75
  "label_weatherTodayTemp": "Temperature today (°C)",
@@ -68,6 +68,8 @@
68
68
  "label_monthlyStatsTime": "Время",
69
69
  "tooltip_monthlyStatsTime": "Формат: ЧЧ:ММ (например, 09:00)",
70
70
  "header_weather": "Погода (опционально)",
71
+ "label_weatherEnabled": "Показывать данные о погоде в сообщениях",
72
+ "tooltip_weatherEnabled": "Если включено, данные о погоде будут отображаться в дневной статистике и сообщениях о статусе батареи",
71
73
  "label_weatherTodayText": "Погода сегодня",
72
74
  "tooltip_weatherTodayText": "Например: daswetter.0.Day0.forecast.currentSymbol",
73
75
  "label_weatherTodayTemp": "Температура сегодня (°C)",
@@ -424,6 +424,15 @@
424
424
  "md": 12,
425
425
  "lg": 12
426
426
  },
427
+ "weatherEnabled": {
428
+ "type": "checkbox",
429
+ "label": "label_weatherEnabled",
430
+ "sm": 12,
431
+ "md": 12,
432
+ "lg": 12,
433
+ "default": true,
434
+ "tooltip": "tooltip_weatherEnabled"
435
+ },
427
436
  "weatherTodayText": {
428
437
  "type": "objectId",
429
438
  "label": "label_weatherTodayText",
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "pv-notifications",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "titleLang": {
6
6
  "en": "PV Notifications",
7
7
  "de": "PV-Benachrichtigungen",
package/main.js CHANGED
@@ -706,13 +706,13 @@ class PvNotifications extends utils.Adapter {
706
706
  }
707
707
  }
708
708
 
709
- // Reset Intermediate-Flags wenn Stufe verlassen
709
+ // Reset Intermediate-Flags wenn Stufe verlassen (±2% Toleranz)
710
710
  for (const step of intermediateSteps) {
711
- if (soc !== step && Math.abs(soc - step) > 2) {
711
+ if (soc !== step && Math.abs(soc - step) >= 2) {
712
712
  const idx = this.status.intermediateNotified.indexOf(step);
713
713
  if (idx > -1) {
714
714
  this.status.intermediateNotified.splice(idx, 1);
715
- this.log.debug(`Intermediate ${step}% flag reset`);
715
+ this.log.debug(`Intermediate ${step}% flag reset (SOC=${soc}%)`);
716
716
  }
717
717
  }
718
718
  }
@@ -977,9 +977,33 @@ class PvNotifications extends utils.Adapter {
977
977
  const batteryAt = this.translate('Battery at');
978
978
  const production = this.translate('Production');
979
979
 
980
- return `🔋 ${batteryAt} ${soc}% (${currentKWh} kWh) ${trend}
980
+ let message = `🔋 ${batteryAt} ${soc}% (${currentKWh} kWh) ${trend}
981
981
  ⚡ ${production}: ${this.round(power)} W
982
982
  ${statusText}`;
983
+
984
+ // Wetter-Prognose für morgen hinzufügen (optional)
985
+ if (this.config.weatherEnabled !== false && (this.config.weatherTomorrowText || this.config.weatherTomorrow)) {
986
+ try {
987
+ const weatherTomorrowTextState = await this.getForeignStateAsync(this.config.weatherTomorrowText);
988
+ const weatherTomorrowState = await this.getForeignStateAsync(this.config.weatherTomorrow);
989
+ const tempTomorrowState = await this.getForeignStateAsync(this.config.weatherTomorrowTemp);
990
+
991
+ const weatherTomorrowText = weatherTomorrowTextState && weatherTomorrowTextState.val !== null ? weatherTomorrowTextState.val : null;
992
+ const weatherTomorrow = weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
993
+ const tempTomorrow = tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
994
+ const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
995
+
996
+ const weatherText = weatherTomorrowText || weatherTomorrow;
997
+ if (weatherText) {
998
+ const weatherDesc = this.getWeatherDescription(weatherText);
999
+ message += `\n\n🌤️ ${this.translate('Weather tomorrow')}: ${weatherDesc}${tempText}`;
1000
+ }
1001
+ } catch (e) {
1002
+ this.log.debug(`Weather data not available: ${e.message}`);
1003
+ }
1004
+ }
1005
+
1006
+ return message;
983
1007
  }
984
1008
 
985
1009
  /**
@@ -1018,11 +1042,15 @@ ${statusText}`;
1018
1042
  ⚡ ${this.translate('Grid consumption')}: ${gridPower} kWh`;
1019
1043
 
1020
1044
  // Wetter-Prognose für morgen hinzufügen
1021
- if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
1045
+ if (this.config.weatherEnabled !== false && (this.config.weatherTomorrowText || this.config.weatherTomorrow)) {
1022
1046
  try {
1023
- const weatherTomorrowText = this.getStateValue(this.config.weatherTomorrowText);
1024
- const weatherTomorrow = this.getStateValue(this.config.weatherTomorrow);
1025
- const tempTomorrow = this.getStateValue(this.config.weatherTomorrowTemp);
1047
+ const weatherTomorrowTextState = await this.getForeignStateAsync(this.config.weatherTomorrowText);
1048
+ const weatherTomorrowState = await this.getForeignStateAsync(this.config.weatherTomorrow);
1049
+ const tempTomorrowState = await this.getForeignStateAsync(this.config.weatherTomorrowTemp);
1050
+
1051
+ const weatherTomorrowText = weatherTomorrowTextState && weatherTomorrowTextState.val !== null ? weatherTomorrowTextState.val : null;
1052
+ const weatherTomorrow = weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
1053
+ const tempTomorrow = tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
1026
1054
  const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
1027
1055
 
1028
1056
  const weatherText = weatherTomorrowText || weatherTomorrow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.pv-notifications",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "PV-Anlage Batterie-Status Telegram Benachrichtigungen",
5
5
  "author": {
6
6
  "name": "Alex1808 via LLM: Qwen",