iobroker.pv-notifications 1.1.7 → 1.1.9

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,14 @@ sadam6752@gmail.com
339
339
  ### **WORK IN PROGRESS**
340
340
  -->
341
341
 
342
- ### 1.1.7 (2026-03-01)
342
+ ### 1.1.9 (2026-03-01)
343
343
 
344
- * (FIX) Weather data reading: Added null checks before calling getForeignStateAsync() to prevent "id needs to be string" error
345
- * (FIX) Better error logging shows which weather data points are configured
344
+ * (ADD) Weather today added to battery full (100%) and empty (0%) messages
345
+ * (ADD) Full and empty messages now show both today and tomorrow weather
346
346
 
347
- ### 1.1.6 (2026-03-01)
347
+ ### 1.1.8 (2026-03-01)
348
348
 
349
- * (ADD) Debug logging added to buildIntermediateMessage() for troubleshooting weather data issues
349
+ * (ADD) Weather today added to intermediate messages (when weatherTodayText or weatherTodayTemp is configured)
350
350
 
351
351
  ### 1.1.1 (2026-03-01)
352
352
 
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "pv-notifications",
4
- "version": "1.1.7",
4
+ "version": "1.1.9",
5
5
  "titleLang": {
6
6
  "en": "PV Notifications",
7
7
  "de": "PV-Benachrichtigungen",
package/main.js CHANGED
@@ -881,21 +881,44 @@ class PvNotifications extends utils.Adapter {
881
881
  ☀️ ${this.translate('Production today')}: ${this.round(totalProd)} kWh
882
882
  🔌 ${this.translate('Feed-in today')}: ${this.round(Math.abs(feedIn), 0)} kWh`;
883
883
 
884
- // Wetter-Prognose hinzufügen (optional)
885
- if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
884
+ // Wetter-Prognose hinzufügen (heute und morgen)
885
+ const weatherConfigured = this.config.weatherTodayText || this.config.weatherTodayTemp || this.config.weatherTomorrowText || this.config.weatherTomorrow;
886
+ if (this.config.weatherEnabled !== false && weatherConfigured) {
886
887
  try {
887
- const weatherTomorrowText = this.getStateValue(this.config.weatherTomorrowText);
888
- const weatherTomorrow = this.getStateValue(this.config.weatherTomorrow);
889
- const tempTomorrow = this.getStateValue(this.config.weatherTomorrowTemp);
890
- const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
891
-
892
- const weatherText = weatherTomorrowText || weatherTomorrow;
893
- if (weatherText) {
894
- const weatherDesc = this.getWeatherDescription(weatherText);
895
- message += `\n🌤️ Morgen: ${weatherDesc}${tempText}`;
896
-
897
- if (this.isWeatherBad(weatherText)) {
898
- message += `\n💡 ${this.translate('Tip tomorrow little sun use consumers today')}`;
888
+ // Wetter heute
889
+ if (this.config.weatherTodayText || this.config.weatherTodayTemp) {
890
+ const weatherTodayTextState = this.config.weatherTodayText ? await this.getForeignStateAsync(this.config.weatherTodayText) : null;
891
+ const weatherTodayTempState = this.config.weatherTodayTemp ? await this.getForeignStateAsync(this.config.weatherTodayTemp) : null;
892
+
893
+ const weatherTodayText = weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
894
+ const weatherTodayTemp = weatherTodayTempState && weatherTodayTempState.val !== null ? weatherTodayTempState.val : null;
895
+ const todayTempText = weatherTodayTemp ? ` ${this.round(weatherTodayTemp, 1)}°C` : '';
896
+
897
+ if (weatherTodayText || weatherTodayTemp) {
898
+ const weatherDesc = weatherTodayText ? this.getWeatherDescription(weatherTodayText) : '🌡️';
899
+ message += `\n🌤️ Heute: ${weatherDesc}${todayTempText}`;
900
+ }
901
+ }
902
+
903
+ // Wetter morgen
904
+ if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
905
+ const weatherTomorrowTextState = this.config.weatherTomorrowText ? await this.getForeignStateAsync(this.config.weatherTomorrowText) : null;
906
+ const weatherTomorrowState = this.config.weatherTomorrow ? await this.getForeignStateAsync(this.config.weatherTomorrow) : null;
907
+ const tempTomorrowState = this.config.weatherTomorrowTemp ? await this.getForeignStateAsync(this.config.weatherTomorrowTemp) : null;
908
+
909
+ const weatherTomorrowText = weatherTomorrowTextState && weatherTomorrowTextState.val !== null ? weatherTomorrowTextState.val : null;
910
+ const weatherTomorrow = weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
911
+ const tempTomorrow = tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
912
+ const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
913
+
914
+ const weatherText = weatherTomorrowText || weatherTomorrow;
915
+ if (weatherText) {
916
+ const weatherDesc = this.getWeatherDescription(weatherText);
917
+ message += `\n🌤️ Morgen: ${weatherDesc}${tempText}`;
918
+
919
+ if (this.isWeatherBad(weatherText)) {
920
+ message += `\n💡 ${this.translate('Tip tomorrow little sun use consumers today')}`;
921
+ }
899
922
  }
900
923
  }
901
924
  } catch (e) {
@@ -929,21 +952,44 @@ class PvNotifications extends utils.Adapter {
929
952
  ⚠️ ${this.translate('Grid consumption today')}: ${this.round(gridPower)} W
930
953
  🏠 ${this.translate('Consumption today')}: ${this.round(consumption)} W`;
931
954
 
932
- // Wetter-Prognose
933
- if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
955
+ // Wetter-Prognose hinzufügen (heute und morgen)
956
+ const weatherConfigured = this.config.weatherTodayText || this.config.weatherTodayTemp || this.config.weatherTomorrowText || this.config.weatherTomorrow;
957
+ if (this.config.weatherEnabled !== false && weatherConfigured) {
934
958
  try {
935
- const weatherTomorrowText = this.getStateValue(this.config.weatherTomorrowText);
936
- const weatherTomorrow = this.getStateValue(this.config.weatherTomorrow);
937
- const tempTomorrow = this.getStateValue(this.config.weatherTomorrowTemp);
938
- const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
939
-
940
- const weatherText = weatherTomorrowText || weatherTomorrow;
941
- if (weatherText) {
942
- const weatherDesc = this.getWeatherDescription(weatherText);
943
- message += `\n🌤️ Morgen: ${weatherDesc}${tempText}`;
944
-
945
- if (this.isWeatherGood(weatherText)) {
946
- message += `\n💡 ${this.translate('Good news tomorrow more sun')}`;
959
+ // Wetter heute
960
+ if (this.config.weatherTodayText || this.config.weatherTodayTemp) {
961
+ const weatherTodayTextState = this.config.weatherTodayText ? await this.getForeignStateAsync(this.config.weatherTodayText) : null;
962
+ const weatherTodayTempState = this.config.weatherTodayTemp ? await this.getForeignStateAsync(this.config.weatherTodayTemp) : null;
963
+
964
+ const weatherTodayText = weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
965
+ const weatherTodayTemp = weatherTodayTempState && weatherTodayTempState.val !== null ? weatherTodayTempState.val : null;
966
+ const todayTempText = weatherTodayTemp ? ` ${this.round(weatherTodayTemp, 1)}°C` : '';
967
+
968
+ if (weatherTodayText || weatherTodayTemp) {
969
+ const weatherDesc = weatherTodayText ? this.getWeatherDescription(weatherTodayText) : '🌡️';
970
+ message += `\n🌤️ Heute: ${weatherDesc}${todayTempText}`;
971
+ }
972
+ }
973
+
974
+ // Wetter morgen
975
+ if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
976
+ const weatherTomorrowTextState = this.config.weatherTomorrowText ? await this.getForeignStateAsync(this.config.weatherTomorrowText) : null;
977
+ const weatherTomorrowState = this.config.weatherTomorrow ? await this.getForeignStateAsync(this.config.weatherTomorrow) : null;
978
+ const tempTomorrowState = this.config.weatherTomorrowTemp ? await this.getForeignStateAsync(this.config.weatherTomorrowTemp) : null;
979
+
980
+ const weatherTomorrowText = weatherTomorrowTextState && weatherTomorrowTextState.val !== null ? weatherTomorrowTextState.val : null;
981
+ const weatherTomorrow = weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
982
+ const tempTomorrow = tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
983
+ const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
984
+
985
+ const weatherText = weatherTomorrowText || weatherTomorrow;
986
+ if (weatherText) {
987
+ const weatherDesc = this.getWeatherDescription(weatherText);
988
+ message += `\n🌤️ Morgen: ${weatherDesc}${tempText}`;
989
+
990
+ if (this.isWeatherGood(weatherText)) {
991
+ message += `\n💡 ${this.translate('Good news tomorrow more sun')}`;
992
+ }
947
993
  }
948
994
  }
949
995
  } catch (e) {
@@ -992,36 +1038,51 @@ class PvNotifications extends utils.Adapter {
992
1038
  ${statusText}`;
993
1039
 
994
1040
  // Wetter-Prognose für morgen hinzufügen (optional, nur wenn weatherInIntermediate aktiv)
995
- const weatherConfigured = this.config.weatherTomorrowText || this.config.weatherTomorrow;
1041
+ const weatherConfigured = this.config.weatherTomorrowText || this.config.weatherTomorrow || this.config.weatherTodayText || this.config.weatherTodayTemp;
996
1042
  this.log.debug(`Weather config: enabled=${this.config.weatherEnabled}, inIntermediate=${this.config.weatherInIntermediate}, configured=${weatherConfigured}`);
997
- this.log.debug(`Weather data points: tomorrowText="${this.config.weatherTomorrowText}", tomorrow="${this.config.weatherTomorrow}", tomorrowTemp="${this.config.weatherTomorrowTemp}"`);
1043
+ this.log.debug(`Weather data points: todayText="${this.config.weatherTodayText}", todayTemp="${this.config.weatherTodayTemp}", tomorrowText="${this.config.weatherTomorrowText}", tomorrow="${this.config.weatherTomorrow}", tomorrowTemp="${this.config.weatherTomorrowTemp}"`);
998
1044
 
999
1045
  if (this.config.weatherEnabled !== false && this.config.weatherInIntermediate !== false && weatherConfigured) {
1000
1046
  try {
1001
1047
  this.log.debug('Attempting to read weather data...');
1002
1048
 
1003
- const weatherTomorrowTextState = this.config.weatherTomorrowText ? await this.getForeignStateAsync(this.config.weatherTomorrowText) : null;
1004
- const weatherTomorrowState = this.config.weatherTomorrow ? await this.getForeignStateAsync(this.config.weatherTomorrow) : null;
1005
- const tempTomorrowState = this.config.weatherTomorrowTemp ? await this.getForeignStateAsync(this.config.weatherTomorrowTemp) : null;
1006
-
1007
- const weatherTomorrowText = weatherTomorrowTextState && weatherTomorrowTextState.val !== null ? weatherTomorrowTextState.val : null;
1008
- const weatherTomorrow = weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
1009
- const tempTomorrow = tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
1010
- const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
1011
-
1012
- this.log.debug(`Weather data read: text=${weatherTomorrowText}, temp=${weatherTomorrow}, tempValue=${tempTomorrow}`);
1049
+ // Wetter heute lesen
1050
+ if (this.config.weatherTodayText || this.config.weatherTodayTemp) {
1051
+ const weatherTodayTextState = this.config.weatherTodayText ? await this.getForeignStateAsync(this.config.weatherTodayText) : null;
1052
+ const weatherTodayTempState = this.config.weatherTodayTemp ? await this.getForeignStateAsync(this.config.weatherTodayTemp) : null;
1053
+
1054
+ const weatherTodayText = weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
1055
+ const weatherTodayTemp = weatherTodayTempState && weatherTodayTempState.val !== null ? weatherTodayTempState.val : null;
1056
+ const todayTempText = weatherTodayTemp ? ` ${this.round(weatherTodayTemp, 1)}°C` : '';
1057
+
1058
+ if (weatherTodayText || weatherTodayTemp) {
1059
+ const weatherDesc = weatherTodayText ? this.getWeatherDescription(weatherTodayText) : '🌡️';
1060
+ message += `\n\n🌤️ ${this.translate('Weather today')}: ${weatherDesc}${todayTempText}`;
1061
+ this.log.info(`Weather today added to intermediate message: ${weatherDesc}${todayTempText}`);
1062
+ }
1063
+ }
1064
+
1065
+ // Wetter morgen lesen
1066
+ if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
1067
+ const weatherTomorrowTextState = this.config.weatherTomorrowText ? await this.getForeignStateAsync(this.config.weatherTomorrowText) : null;
1068
+ const weatherTomorrowState = this.config.weatherTomorrow ? await this.getForeignStateAsync(this.config.weatherTomorrow) : null;
1069
+ const tempTomorrowState = this.config.weatherTomorrowTemp ? await this.getForeignStateAsync(this.config.weatherTomorrowTemp) : null;
1013
1070
 
1014
- const weatherText = weatherTomorrowText || weatherTomorrow;
1015
- if (weatherText) {
1016
- const weatherDesc = this.getWeatherDescription(weatherText);
1017
- message += `\n\n🌤️ ${this.translate('Weather tomorrow')}: ${weatherDesc}${tempText}`;
1018
- this.log.info(`Weather added to intermediate message: ${weatherDesc}${tempText}`);
1019
- } else {
1020
- this.log.debug('No weather text found (states may be null or empty)');
1071
+ const weatherTomorrowText = weatherTomorrowTextState && weatherTomorrowTextState.val !== null ? weatherTomorrowTextState.val : null;
1072
+ const weatherTomorrow = weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
1073
+ const tempTomorrow = tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
1074
+ const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
1075
+
1076
+ const weatherText = weatherTomorrowText || weatherTomorrow;
1077
+ if (weatherText) {
1078
+ const weatherDesc = this.getWeatherDescription(weatherText);
1079
+ message += `\n🌤️ ${this.translate('Weather tomorrow')}: ${weatherDesc}${tempText}`;
1080
+ this.log.info(`Weather tomorrow added to intermediate message: ${weatherDesc}${tempText}`);
1081
+ }
1021
1082
  }
1022
1083
  } catch (e) {
1023
1084
  this.log.error(`Weather data error: ${e.message}`);
1024
- this.log.error(`Config: weatherTomorrowText="${this.config.weatherTomorrowText}", weatherTomorrow="${this.config.weatherTomorrow}"`);
1085
+ this.log.error(`Config: weatherTodayText="${this.config.weatherTodayText}", weatherTomorrowText="${this.config.weatherTomorrowText}"`);
1025
1086
  }
1026
1087
  } else {
1027
1088
  if (this.config.weatherEnabled === false) {
@@ -1031,7 +1092,7 @@ ${statusText}`;
1031
1092
  this.log.debug('Weather disabled for intermediate (weatherInIntermediate=false)');
1032
1093
  }
1033
1094
  if (!weatherConfigured) {
1034
- this.log.debug('Weather not configured (no weatherTomorrowText or weatherTomorrow)');
1095
+ this.log.debug('Weather not configured (no weatherTodayText, weatherTodayTemp, weatherTomorrowText or weatherTomorrow)');
1035
1096
  }
1036
1097
  }
1037
1098
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.pv-notifications",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "PV-Anlage Batterie-Status Telegram Benachrichtigungen",
5
5
  "author": {
6
6
  "name": "Alex1808 via LLM: Qwen",