iobroker.pv-notifications 1.2.8 → 1.2.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 +4 -0
- package/io-package.json +14 -14
- package/main.js +187 -80
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -344,6 +344,10 @@ sadam6752@gmail.com
|
|
|
344
344
|
### **WORK IN PROGRESS**
|
|
345
345
|
-->
|
|
346
346
|
|
|
347
|
+
### 1.2.9 (2026-03-02)
|
|
348
|
+
|
|
349
|
+
* (FIX) Fixed ESLint formatting issues (75 prettier/prettier errors auto-fixed with lint:fix)
|
|
350
|
+
|
|
347
351
|
### 1.2.8 (2026-03-02)
|
|
348
352
|
|
|
349
353
|
* (FIX) Fixed duplicate news entry in io-package.json (E1036/E2005 fix)
|
package/io-package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "pv-notifications",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.9",
|
|
5
5
|
"titleLang": {
|
|
6
6
|
"en": "PV Notifications",
|
|
7
7
|
"de": "PV-Benachrichtigungen",
|
|
@@ -29,6 +29,19 @@
|
|
|
29
29
|
"zh-cn": "发送 Telegram 通知用于 PV 电池状态"
|
|
30
30
|
},
|
|
31
31
|
"news": {
|
|
32
|
+
"1.2.9": {
|
|
33
|
+
"en": "Fixed ESLint formatting issues (75 prettier/prettier errors auto-fixed with lint:fix)",
|
|
34
|
+
"de": "ESLint-Formatierungsfehler behoben (75 prettier/prettier Fehler mit lint:fix automatisch korrigiert)",
|
|
35
|
+
"ru": "Исправлены ошибки форматирования ESLint (75 ошибок prettier/prettier автоматически исправлены через lint:fix)",
|
|
36
|
+
"pt": "Corrigidos problemas de formatação ESLint (75 erros prettier/prettier corrigidos automaticamente com lint:fix)",
|
|
37
|
+
"nl": "ESLint-opmaakproblemen opgelost (75 prettier/prettier-fouten automatisch hersteld met lint:fix)",
|
|
38
|
+
"fr": "Correction des problèmes de formatage ESLint (75 erreurs prettier/prettier corrigées automatiquement avec lint:fix)",
|
|
39
|
+
"it": "Corretti problemi di formattazione ESLint (75 errori prettier/prettier corretti automaticamente con lint:fix)",
|
|
40
|
+
"es": "Corregidos problemas de formato ESLint (75 errores prettier/prettier corregidos automáticamente con lint:fix)",
|
|
41
|
+
"pl": "Naprawiono problemy z formatowaniem ESLint (75 błędów prettier/prettier automatycznie naprawionych za pomocą lint:fix)",
|
|
42
|
+
"uk": "Виправлено проблеми з форматуванням ESLint (75 помилок prettier/prettier автоматично виправлено за допомогою lint:fix)",
|
|
43
|
+
"zh-cn": "已修复 ESLint 格式化问题(75 个 prettier/prettier 错误已通过 lint:fix 自动修复)"
|
|
44
|
+
},
|
|
32
45
|
"1.2.8": {
|
|
33
46
|
"en": "Fixed duplicate news entry in io-package.json (E1036/E2005 fix)",
|
|
34
47
|
"de": "Doppelten news-Eintrag in io-package.json behoben (E1036/E2005 Fix)",
|
|
@@ -106,19 +119,6 @@
|
|
|
106
119
|
"pl": "Dodano atrybuty rozmiaru (xs, xl) dla pól minIntervalFull, minIntervalEmpty, intermediateSteps, quietModeStart, quietModeEnd w interfejsie administracyjnym (poprawka E5507)",
|
|
107
120
|
"uk": "Додано атрибути розміру (xs, xl) для полів minIntervalFull, minIntervalEmpty, intermediateSteps, quietModeStart, quietModeEnd в адмін-інтерфейсі (виправлення E5507)",
|
|
108
121
|
"zh-cn": "已为管理界面中的 minIntervalFull、minIntervalEmpty、intermediateSteps、quietModeStart、quietModeEnd 字段添加大小属性(xs, xl)(E5507 修复)"
|
|
109
|
-
},
|
|
110
|
-
"1.2.2": {
|
|
111
|
-
"en": "Fixed weekly statistics: Now uses weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower fields instead of daily values",
|
|
112
|
-
"de": "Wochenstatistik fixiert: Verwendet jetzt weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower Felder statt Tageswerten",
|
|
113
|
-
"ru": "Исправлена недельная статистика: теперь используются поля weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower вместо дневных значений",
|
|
114
|
-
"pt": "Estatísticas semanais corrigidas: Agora usa os campos weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower em vez de valores diários",
|
|
115
|
-
"nl": "Wekelijkse statistieken hersteld: Gebruikt nu weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower velden in plaats van dagwaarden",
|
|
116
|
-
"fr": "Statistiques hebdomadaires corrigées : Utilise maintenant les champs weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower au lieu des valeurs quotidiennes",
|
|
117
|
-
"it": "Statistiche settimanali corrette: Ora utilizza i campi weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower invece dei valori giornalieri",
|
|
118
|
-
"es": "Estadísticas semanales corregidas: Ahora usa los campos weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower en lugar de valores diarios",
|
|
119
|
-
"pl": "Naprawiono statystyki tygodniowe: Teraz używa pól weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower zamiast wartości dziennych",
|
|
120
|
-
"uk": "Виправлено тижневу статистику: Тепер використовуються поля weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower замість денних значень",
|
|
121
|
-
"zh-cn": "已修复周统计:现在使用 weeklyProduction/weeklyConsumption/weeklyFeedIn/weeklyGridPower 字段而不是日值"
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
"authors": [
|
package/main.js
CHANGED
|
@@ -91,12 +91,16 @@ class PvNotifications extends utils.Adapter {
|
|
|
91
91
|
this.log.info('PV Notifications Adapter started');
|
|
92
92
|
|
|
93
93
|
// Migration: Set weather checkboxes to true if not set (for updates from < v1.1.3)
|
|
94
|
-
if (
|
|
95
|
-
|
|
94
|
+
if (
|
|
95
|
+
this.config.weatherEnabled === true &&
|
|
96
|
+
(this.config.weatherInIntermediate === undefined || this.config.weatherInIntermediate === null)
|
|
97
|
+
) {
|
|
96
98
|
this.log.info('Migration: Setting weatherInIntermediate to true (default)');
|
|
97
99
|
}
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
+
if (
|
|
101
|
+
this.config.weatherEnabled === true &&
|
|
102
|
+
(this.config.weatherInDailyStats === undefined || this.config.weatherInDailyStats === null)
|
|
103
|
+
) {
|
|
100
104
|
this.log.info('Migration: Setting weatherInDailyStats to true (default)');
|
|
101
105
|
}
|
|
102
106
|
|
|
@@ -433,12 +437,17 @@ class PvNotifications extends utils.Adapter {
|
|
|
433
437
|
const lastWeekFullCycles = await this.getStateAsync('statistics.lastWeekFullCycles');
|
|
434
438
|
const lastWeekEmptyCycles = await this.getStateAsync('statistics.lastWeekEmptyCycles');
|
|
435
439
|
|
|
436
|
-
this.stats.lastWeekProduction =
|
|
437
|
-
|
|
440
|
+
this.stats.lastWeekProduction =
|
|
441
|
+
lastWeekProduction && lastWeekProduction.val !== null ? lastWeekProduction.val : 0;
|
|
442
|
+
this.stats.lastWeekConsumption =
|
|
443
|
+
lastWeekConsumption && lastWeekConsumption.val !== null ? lastWeekConsumption.val : 0;
|
|
438
444
|
this.stats.lastWeekFeedIn = lastWeekFeedIn && lastWeekFeedIn.val !== null ? lastWeekFeedIn.val : 0;
|
|
439
|
-
this.stats.lastWeekGridPower =
|
|
440
|
-
|
|
441
|
-
this.stats.
|
|
445
|
+
this.stats.lastWeekGridPower =
|
|
446
|
+
lastWeekGridPower && lastWeekGridPower.val !== null ? lastWeekGridPower.val : 0;
|
|
447
|
+
this.stats.lastWeekFullCycles =
|
|
448
|
+
lastWeekFullCycles && lastWeekFullCycles.val !== null ? lastWeekFullCycles.val : 0;
|
|
449
|
+
this.stats.lastWeekEmptyCycles =
|
|
450
|
+
lastWeekEmptyCycles && lastWeekEmptyCycles.val !== null ? lastWeekEmptyCycles.val : 0;
|
|
442
451
|
|
|
443
452
|
// Load saved last month data from states
|
|
444
453
|
const lastMonthProduction = await this.getStateAsync('statistics.lastMonthProduction');
|
|
@@ -448,12 +457,17 @@ class PvNotifications extends utils.Adapter {
|
|
|
448
457
|
const lastMonthFullCycles = await this.getStateAsync('statistics.lastMonthFullCycles');
|
|
449
458
|
const lastMonthEmptyCycles = await this.getStateAsync('statistics.lastMonthEmptyCycles');
|
|
450
459
|
|
|
451
|
-
this.stats.lastMonthProduction =
|
|
452
|
-
|
|
460
|
+
this.stats.lastMonthProduction =
|
|
461
|
+
lastMonthProduction && lastMonthProduction.val !== null ? lastMonthProduction.val : 0;
|
|
462
|
+
this.stats.lastMonthConsumption =
|
|
463
|
+
lastMonthConsumption && lastMonthConsumption.val !== null ? lastMonthConsumption.val : 0;
|
|
453
464
|
this.stats.lastMonthFeedIn = lastMonthFeedIn && lastMonthFeedIn.val !== null ? lastMonthFeedIn.val : 0;
|
|
454
|
-
this.stats.lastMonthGridPower =
|
|
455
|
-
|
|
456
|
-
this.stats.
|
|
465
|
+
this.stats.lastMonthGridPower =
|
|
466
|
+
lastMonthGridPower && lastMonthGridPower.val !== null ? lastMonthGridPower.val : 0;
|
|
467
|
+
this.stats.lastMonthFullCycles =
|
|
468
|
+
lastMonthFullCycles && lastMonthFullCycles.val !== null ? lastMonthFullCycles.val : 0;
|
|
469
|
+
this.stats.lastMonthEmptyCycles =
|
|
470
|
+
lastMonthEmptyCycles && lastMonthEmptyCycles.val !== null ? lastMonthEmptyCycles.val : 0;
|
|
457
471
|
|
|
458
472
|
this.log.info('Statistics loaded from states');
|
|
459
473
|
} catch (e) {
|
|
@@ -882,35 +896,56 @@ class PvNotifications extends utils.Adapter {
|
|
|
882
896
|
🔌 ${this.translate('Feed-in today')}: ${this.round(Math.abs(feedIn), 0)} kWh`;
|
|
883
897
|
|
|
884
898
|
// Wetter-Prognose hinzufügen (heute und morgen)
|
|
885
|
-
const weatherConfigured =
|
|
899
|
+
const weatherConfigured =
|
|
900
|
+
this.config.weatherTodayText ||
|
|
901
|
+
this.config.weatherTodayTemp ||
|
|
902
|
+
this.config.weatherTomorrowText ||
|
|
903
|
+
this.config.weatherTomorrow;
|
|
886
904
|
if (this.config.weatherEnabled !== false && weatherConfigured) {
|
|
887
905
|
try {
|
|
888
906
|
// Wetter heute
|
|
889
907
|
if (this.config.weatherTodayText || this.config.weatherTodayTemp) {
|
|
890
|
-
const weatherTodayTextState = this.config.weatherTodayText
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
|
|
908
|
+
const weatherTodayTextState = this.config.weatherTodayText
|
|
909
|
+
? await this.getForeignStateAsync(this.config.weatherTodayText)
|
|
910
|
+
: null;
|
|
911
|
+
const weatherTodayTempState = this.config.weatherTodayTemp
|
|
912
|
+
? await this.getForeignStateAsync(this.config.weatherTodayTemp)
|
|
913
|
+
: null;
|
|
914
|
+
|
|
915
|
+
const weatherTodayText =
|
|
916
|
+
weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
|
|
917
|
+
const weatherTodayTemp =
|
|
918
|
+
weatherTodayTempState && weatherTodayTempState.val !== null ? weatherTodayTempState.val : null;
|
|
895
919
|
const todayTempText = weatherTodayTemp ? ` ${this.round(weatherTodayTemp, 1)}°C` : '';
|
|
896
|
-
|
|
920
|
+
|
|
897
921
|
if (weatherTodayText || weatherTodayTemp) {
|
|
898
922
|
const weatherDesc = weatherTodayText ? this.getWeatherDescription(weatherTodayText) : '🌡️';
|
|
899
923
|
message += `\n🌤️ Heute: ${weatherDesc}${todayTempText}`;
|
|
900
924
|
}
|
|
901
925
|
}
|
|
902
|
-
|
|
926
|
+
|
|
903
927
|
// Wetter morgen
|
|
904
928
|
if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
|
|
905
|
-
const weatherTomorrowTextState = this.config.weatherTomorrowText
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
const
|
|
929
|
+
const weatherTomorrowTextState = this.config.weatherTomorrowText
|
|
930
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrowText)
|
|
931
|
+
: null;
|
|
932
|
+
const weatherTomorrowState = this.config.weatherTomorrow
|
|
933
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrow)
|
|
934
|
+
: null;
|
|
935
|
+
const tempTomorrowState = this.config.weatherTomorrowTemp
|
|
936
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrowTemp)
|
|
937
|
+
: null;
|
|
938
|
+
|
|
939
|
+
const weatherTomorrowText =
|
|
940
|
+
weatherTomorrowTextState && weatherTomorrowTextState.val !== null
|
|
941
|
+
? weatherTomorrowTextState.val
|
|
942
|
+
: null;
|
|
943
|
+
const weatherTomorrow =
|
|
944
|
+
weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
|
|
945
|
+
const tempTomorrow =
|
|
946
|
+
tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
|
|
912
947
|
const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
|
|
913
|
-
|
|
948
|
+
|
|
914
949
|
const weatherText = weatherTomorrowText || weatherTomorrow;
|
|
915
950
|
if (weatherText) {
|
|
916
951
|
const weatherDesc = this.getWeatherDescription(weatherText);
|
|
@@ -953,35 +988,56 @@ class PvNotifications extends utils.Adapter {
|
|
|
953
988
|
🏠 ${this.translate('Consumption today')}: ${this.round(consumption)} W`;
|
|
954
989
|
|
|
955
990
|
// Wetter-Prognose hinzufügen (heute und morgen)
|
|
956
|
-
const weatherConfigured =
|
|
991
|
+
const weatherConfigured =
|
|
992
|
+
this.config.weatherTodayText ||
|
|
993
|
+
this.config.weatherTodayTemp ||
|
|
994
|
+
this.config.weatherTomorrowText ||
|
|
995
|
+
this.config.weatherTomorrow;
|
|
957
996
|
if (this.config.weatherEnabled !== false && weatherConfigured) {
|
|
958
997
|
try {
|
|
959
998
|
// Wetter heute
|
|
960
999
|
if (this.config.weatherTodayText || this.config.weatherTodayTemp) {
|
|
961
|
-
const weatherTodayTextState = this.config.weatherTodayText
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
|
|
1000
|
+
const weatherTodayTextState = this.config.weatherTodayText
|
|
1001
|
+
? await this.getForeignStateAsync(this.config.weatherTodayText)
|
|
1002
|
+
: null;
|
|
1003
|
+
const weatherTodayTempState = this.config.weatherTodayTemp
|
|
1004
|
+
? await this.getForeignStateAsync(this.config.weatherTodayTemp)
|
|
1005
|
+
: null;
|
|
1006
|
+
|
|
1007
|
+
const weatherTodayText =
|
|
1008
|
+
weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
|
|
1009
|
+
const weatherTodayTemp =
|
|
1010
|
+
weatherTodayTempState && weatherTodayTempState.val !== null ? weatherTodayTempState.val : null;
|
|
966
1011
|
const todayTempText = weatherTodayTemp ? ` ${this.round(weatherTodayTemp, 1)}°C` : '';
|
|
967
|
-
|
|
1012
|
+
|
|
968
1013
|
if (weatherTodayText || weatherTodayTemp) {
|
|
969
1014
|
const weatherDesc = weatherTodayText ? this.getWeatherDescription(weatherTodayText) : '🌡️';
|
|
970
1015
|
message += `\n🌤️ Heute: ${weatherDesc}${todayTempText}`;
|
|
971
1016
|
}
|
|
972
1017
|
}
|
|
973
|
-
|
|
1018
|
+
|
|
974
1019
|
// Wetter morgen
|
|
975
1020
|
if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
|
|
976
|
-
const weatherTomorrowTextState = this.config.weatherTomorrowText
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
const
|
|
1021
|
+
const weatherTomorrowTextState = this.config.weatherTomorrowText
|
|
1022
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrowText)
|
|
1023
|
+
: null;
|
|
1024
|
+
const weatherTomorrowState = this.config.weatherTomorrow
|
|
1025
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrow)
|
|
1026
|
+
: null;
|
|
1027
|
+
const tempTomorrowState = this.config.weatherTomorrowTemp
|
|
1028
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrowTemp)
|
|
1029
|
+
: null;
|
|
1030
|
+
|
|
1031
|
+
const weatherTomorrowText =
|
|
1032
|
+
weatherTomorrowTextState && weatherTomorrowTextState.val !== null
|
|
1033
|
+
? weatherTomorrowTextState.val
|
|
1034
|
+
: null;
|
|
1035
|
+
const weatherTomorrow =
|
|
1036
|
+
weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
|
|
1037
|
+
const tempTomorrow =
|
|
1038
|
+
tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
|
|
983
1039
|
const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
|
|
984
|
-
|
|
1040
|
+
|
|
985
1041
|
const weatherText = weatherTomorrowText || weatherTomorrow;
|
|
986
1042
|
if (weatherText) {
|
|
987
1043
|
const weatherDesc = this.getWeatherDescription(weatherText);
|
|
@@ -1038,39 +1094,64 @@ class PvNotifications extends utils.Adapter {
|
|
|
1038
1094
|
${statusText}`;
|
|
1039
1095
|
|
|
1040
1096
|
// Wetter-Prognose für morgen hinzufügen (optional, nur wenn weatherInIntermediate aktiv)
|
|
1041
|
-
const weatherConfigured =
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1097
|
+
const weatherConfigured =
|
|
1098
|
+
this.config.weatherTomorrowText ||
|
|
1099
|
+
this.config.weatherTomorrow ||
|
|
1100
|
+
this.config.weatherTodayText ||
|
|
1101
|
+
this.config.weatherTodayTemp;
|
|
1102
|
+
this.log.debug(
|
|
1103
|
+
`Weather config: enabled=${this.config.weatherEnabled}, inIntermediate=${this.config.weatherInIntermediate}, configured=${weatherConfigured}`,
|
|
1104
|
+
);
|
|
1105
|
+
this.log.debug(
|
|
1106
|
+
`Weather data points: todayText="${this.config.weatherTodayText}", todayTemp="${this.config.weatherTodayTemp}", tomorrowText="${this.config.weatherTomorrowText}", tomorrow="${this.config.weatherTomorrow}", tomorrowTemp="${this.config.weatherTomorrowTemp}"`,
|
|
1107
|
+
);
|
|
1108
|
+
|
|
1045
1109
|
if (this.config.weatherEnabled !== false && this.config.weatherInIntermediate !== false && weatherConfigured) {
|
|
1046
1110
|
try {
|
|
1047
1111
|
this.log.debug('Attempting to read weather data...');
|
|
1048
|
-
|
|
1112
|
+
|
|
1049
1113
|
// Wetter heute lesen
|
|
1050
1114
|
if (this.config.weatherTodayText || this.config.weatherTodayTemp) {
|
|
1051
|
-
const weatherTodayTextState = this.config.weatherTodayText
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1115
|
+
const weatherTodayTextState = this.config.weatherTodayText
|
|
1116
|
+
? await this.getForeignStateAsync(this.config.weatherTodayText)
|
|
1117
|
+
: null;
|
|
1118
|
+
const weatherTodayTempState = this.config.weatherTodayTemp
|
|
1119
|
+
? await this.getForeignStateAsync(this.config.weatherTodayTemp)
|
|
1120
|
+
: null;
|
|
1121
|
+
|
|
1122
|
+
const weatherTodayText =
|
|
1123
|
+
weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
|
|
1124
|
+
const weatherTodayTemp =
|
|
1125
|
+
weatherTodayTempState && weatherTodayTempState.val !== null ? weatherTodayTempState.val : null;
|
|
1056
1126
|
const todayTempText = weatherTodayTemp ? ` ${this.round(weatherTodayTemp, 1)}°C` : '';
|
|
1057
|
-
|
|
1127
|
+
|
|
1058
1128
|
if (weatherTodayText || weatherTodayTemp) {
|
|
1059
1129
|
const weatherDesc = weatherTodayText ? this.getWeatherDescription(weatherTodayText) : '🌡️';
|
|
1060
1130
|
message += `\n\n🌤️ ${this.translate('Weather today')}: ${weatherDesc}${todayTempText}`;
|
|
1061
1131
|
this.log.info(`Weather today added to intermediate message: ${weatherDesc}${todayTempText}`);
|
|
1062
1132
|
}
|
|
1063
1133
|
}
|
|
1064
|
-
|
|
1134
|
+
|
|
1065
1135
|
// Wetter morgen lesen
|
|
1066
1136
|
if (this.config.weatherTomorrowText || this.config.weatherTomorrow) {
|
|
1067
|
-
const weatherTomorrowTextState = this.config.weatherTomorrowText
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
const
|
|
1137
|
+
const weatherTomorrowTextState = this.config.weatherTomorrowText
|
|
1138
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrowText)
|
|
1139
|
+
: null;
|
|
1140
|
+
const weatherTomorrowState = this.config.weatherTomorrow
|
|
1141
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrow)
|
|
1142
|
+
: null;
|
|
1143
|
+
const tempTomorrowState = this.config.weatherTomorrowTemp
|
|
1144
|
+
? await this.getForeignStateAsync(this.config.weatherTomorrowTemp)
|
|
1145
|
+
: null;
|
|
1146
|
+
|
|
1147
|
+
const weatherTomorrowText =
|
|
1148
|
+
weatherTomorrowTextState && weatherTomorrowTextState.val !== null
|
|
1149
|
+
? weatherTomorrowTextState.val
|
|
1150
|
+
: null;
|
|
1151
|
+
const weatherTomorrow =
|
|
1152
|
+
weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
|
|
1153
|
+
const tempTomorrow =
|
|
1154
|
+
tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
|
|
1074
1155
|
const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
|
|
1075
1156
|
|
|
1076
1157
|
const weatherText = weatherTomorrowText || weatherTomorrow;
|
|
@@ -1082,7 +1163,9 @@ ${statusText}`;
|
|
|
1082
1163
|
}
|
|
1083
1164
|
} catch (e) {
|
|
1084
1165
|
this.log.error(`Weather data error: ${e.message}`);
|
|
1085
|
-
this.log.error(
|
|
1166
|
+
this.log.error(
|
|
1167
|
+
`Config: weatherTodayText="${this.config.weatherTodayText}", weatherTomorrowText="${this.config.weatherTomorrowText}"`,
|
|
1168
|
+
);
|
|
1086
1169
|
}
|
|
1087
1170
|
} else {
|
|
1088
1171
|
if (this.config.weatherEnabled === false) {
|
|
@@ -1092,7 +1175,9 @@ ${statusText}`;
|
|
|
1092
1175
|
this.log.debug('Weather disabled for intermediate (weatherInIntermediate=false)');
|
|
1093
1176
|
}
|
|
1094
1177
|
if (!weatherConfigured) {
|
|
1095
|
-
this.log.debug(
|
|
1178
|
+
this.log.debug(
|
|
1179
|
+
'Weather not configured (no weatherTodayText, weatherTodayTemp, weatherTomorrowText or weatherTomorrow)',
|
|
1180
|
+
);
|
|
1096
1181
|
}
|
|
1097
1182
|
}
|
|
1098
1183
|
|
|
@@ -1135,15 +1220,22 @@ ${statusText}`;
|
|
|
1135
1220
|
⚡ ${this.translate('Grid consumption')}: ${gridPower} kWh`;
|
|
1136
1221
|
|
|
1137
1222
|
// Wetter-Prognose für morgen hinzufügen (optional, nur wenn weatherInDailyStats aktiv)
|
|
1138
|
-
if (
|
|
1139
|
-
|
|
1223
|
+
if (
|
|
1224
|
+
this.config.weatherEnabled !== false &&
|
|
1225
|
+
this.config.weatherInDailyStats !== false &&
|
|
1226
|
+
(this.config.weatherTomorrowText || this.config.weatherTomorrow)
|
|
1227
|
+
) {
|
|
1140
1228
|
try {
|
|
1141
1229
|
const weatherTomorrowTextState = await this.getForeignStateAsync(this.config.weatherTomorrowText);
|
|
1142
1230
|
const weatherTomorrowState = await this.getForeignStateAsync(this.config.weatherTomorrow);
|
|
1143
1231
|
const tempTomorrowState = await this.getForeignStateAsync(this.config.weatherTomorrowTemp);
|
|
1144
1232
|
|
|
1145
|
-
const weatherTomorrowText =
|
|
1146
|
-
|
|
1233
|
+
const weatherTomorrowText =
|
|
1234
|
+
weatherTomorrowTextState && weatherTomorrowTextState.val !== null
|
|
1235
|
+
? weatherTomorrowTextState.val
|
|
1236
|
+
: null;
|
|
1237
|
+
const weatherTomorrow =
|
|
1238
|
+
weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
|
|
1147
1239
|
const tempTomorrow = tempTomorrowState && tempTomorrowState.val !== null ? tempTomorrowState.val : null;
|
|
1148
1240
|
const tempText = tempTomorrow ? ` ${this.round(tempTomorrow, 1)}°C` : '';
|
|
1149
1241
|
|
|
@@ -1420,7 +1512,8 @@ ${statusText}`;
|
|
|
1420
1512
|
const weeklyGridPower = await this.getForeignStateAsync(this.config.weeklyGridPower);
|
|
1421
1513
|
|
|
1422
1514
|
this.stats.lastWeekProduction = weeklyProd && weeklyProd.val !== null ? weeklyProd.val : 0;
|
|
1423
|
-
this.stats.lastWeekConsumption =
|
|
1515
|
+
this.stats.lastWeekConsumption =
|
|
1516
|
+
weeklyConsumption && weeklyConsumption.val !== null ? weeklyConsumption.val : 0;
|
|
1424
1517
|
this.stats.lastWeekFeedIn = weeklyFeedIn && weeklyFeedIn.val !== null ? weeklyFeedIn.val : 0;
|
|
1425
1518
|
this.stats.lastWeekGridPower = weeklyGridPower && weeklyGridPower.val !== null ? weeklyGridPower.val : 0;
|
|
1426
1519
|
this.stats.lastWeekFullCycles = this.stats.weekFullCycles;
|
|
@@ -1431,7 +1524,9 @@ ${statusText}`;
|
|
|
1431
1524
|
this.stats.weekEmptyCycles = 0;
|
|
1432
1525
|
|
|
1433
1526
|
this.saveStatistics();
|
|
1434
|
-
this.log.info(
|
|
1527
|
+
this.log.info(
|
|
1528
|
+
`Weekly stats saved: Production=${this.stats.lastWeekProduction} kWh, FeedIn=${this.stats.lastWeekFeedIn} kWh`,
|
|
1529
|
+
);
|
|
1435
1530
|
// KEIN Senden hier - Senden erfolgt nur in startScheduledTasks() zur konfigurierten Zeit
|
|
1436
1531
|
}
|
|
1437
1532
|
}
|
|
@@ -1455,7 +1550,9 @@ ${statusText}`;
|
|
|
1455
1550
|
|
|
1456
1551
|
// Automatische Speicherung: Letzter Tag des Monats um 23:55 (vor Mitternacht)
|
|
1457
1552
|
if (today === lastDayOfMonth && hours === 23 && minutes === 55) {
|
|
1458
|
-
this.log.info(
|
|
1553
|
+
this.log.info(
|
|
1554
|
+
`Auto-saving monthly statistics (last day of month ${today}. ${now.getMonth() + 1}.${now.getFullYear()} 23:55, before sourceanalytix reset)`,
|
|
1555
|
+
);
|
|
1459
1556
|
|
|
1460
1557
|
// Aktuelle Daten aus externen States lesen (direkter Zugriff)
|
|
1461
1558
|
const totalProd = await this.getForeignStateAsync(this.config.monthlyProduction);
|
|
@@ -1472,7 +1569,9 @@ ${statusText}`;
|
|
|
1472
1569
|
|
|
1473
1570
|
this.stats.lastMonthReset = today;
|
|
1474
1571
|
this.saveStatistics();
|
|
1475
|
-
this.log.info(
|
|
1572
|
+
this.log.info(
|
|
1573
|
+
`Monthly stats saved: Production=${this.stats.lastMonthProduction} kWh, FeedIn=${this.stats.lastMonthFeedIn} kWh`,
|
|
1574
|
+
);
|
|
1476
1575
|
}
|
|
1477
1576
|
}
|
|
1478
1577
|
|
|
@@ -1719,8 +1818,10 @@ ${statusText}`;
|
|
|
1719
1818
|
const weatherTodayTextState = await this.getForeignStateAsync(this.config.weatherTodayText);
|
|
1720
1819
|
const weatherTodayState = await this.getForeignStateAsync(this.config.weatherTodayTemp);
|
|
1721
1820
|
|
|
1722
|
-
const weatherTodayText =
|
|
1723
|
-
|
|
1821
|
+
const weatherTodayText =
|
|
1822
|
+
weatherTodayTextState && weatherTodayTextState.val !== null ? weatherTodayTextState.val : null;
|
|
1823
|
+
const weatherTodayTemp =
|
|
1824
|
+
weatherTodayState && weatherTodayState.val !== null ? weatherTodayState.val : null;
|
|
1724
1825
|
const tempText = weatherTodayTemp ? ` ${this.round(weatherTodayTemp, 1)}°C` : '';
|
|
1725
1826
|
|
|
1726
1827
|
if (weatherTodayText || weatherTodayTemp) {
|
|
@@ -1734,12 +1835,18 @@ ${statusText}`;
|
|
|
1734
1835
|
const weatherTomorrowTextState = await this.getForeignStateAsync(this.config.weatherTomorrowText);
|
|
1735
1836
|
const weatherTomorrowState = await this.getForeignStateAsync(this.config.weatherTomorrowTemp);
|
|
1736
1837
|
|
|
1737
|
-
const weatherTomorrowText =
|
|
1738
|
-
|
|
1838
|
+
const weatherTomorrowText =
|
|
1839
|
+
weatherTomorrowTextState && weatherTomorrowTextState.val !== null
|
|
1840
|
+
? weatherTomorrowTextState.val
|
|
1841
|
+
: null;
|
|
1842
|
+
const weatherTomorrowTemp =
|
|
1843
|
+
weatherTomorrowState && weatherTomorrowState.val !== null ? weatherTomorrowState.val : null;
|
|
1739
1844
|
const tempText = weatherTomorrowTemp ? ` ${this.round(weatherTomorrowTemp, 1)}°C` : '';
|
|
1740
1845
|
|
|
1741
1846
|
if (weatherTomorrowText || weatherTomorrowTemp) {
|
|
1742
|
-
const weatherDesc = weatherTomorrowText
|
|
1847
|
+
const weatherDesc = weatherTomorrowText
|
|
1848
|
+
? this.getWeatherDescription(weatherTomorrowText)
|
|
1849
|
+
: '🌡️';
|
|
1743
1850
|
message += `\n🌤️ *${this.translate('Weather tomorrow')}:* ${weatherDesc}${tempText}`;
|
|
1744
1851
|
}
|
|
1745
1852
|
}
|