iobroker.poolcontrol 0.6.4 → 0.6.5
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/io-package.json +14 -14
- package/lib/helpers/consumptionHelper.js +38 -18
- package/lib/helpers/frostHelper.js +1 -1
- package/package.json +1 -1
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "poolcontrol",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.5",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.6.5": {
|
|
7
|
+
"en": "Fix for weekly, monthly and yearly reset in consumptionHelper",
|
|
8
|
+
"de": "Fix für Wochen-, Monats- und Jahres-Reset im ConsumptionHelper",
|
|
9
|
+
"ru": "Исправление еженедельного, ежемесячного и ежегодного сброса в consumptionHelper",
|
|
10
|
+
"pt": "Correção para redefinição semanal, mensal e anual no consumptionHelper",
|
|
11
|
+
"nl": "Fix voor wekelijkse, maandelijkse en jaarlijkse reset in consumptionHelper",
|
|
12
|
+
"fr": "Correctif pour la réinitialisation hebdomadaire, mensuelle et annuelle dans consumptionHelper",
|
|
13
|
+
"it": "Correzione per il reset settimanale, mensile e annuale in consumptionHelper",
|
|
14
|
+
"es": "Corrección para el reinicio semanal, mensual y anual en consumptionHelper",
|
|
15
|
+
"pl": "Poprawka cotygodniowego, comiesięcznego i corocznego resetu w consumptionHelper",
|
|
16
|
+
"uk": "Виправлення щотижневого, щомісячного та щорічного скидання в consumptionHelper",
|
|
17
|
+
"zh-cn": "修复 consumptionHelper 中每周、每月和每年重置的问题"
|
|
18
|
+
},
|
|
6
19
|
"0.6.4": {
|
|
7
20
|
"en": "Fix for weekly, monthly and yearly reset in consumptionHelper",
|
|
8
21
|
"de": "Fix für Wochen-, Monats- und Jahres-Reset im ConsumptionHelper",
|
|
@@ -78,19 +91,6 @@
|
|
|
78
91
|
"pl": "Naprawiono pozostałą rekursję timera w statystykach tygodniowych i miesięcznych, aby całkowicie zapobiec nieskończonym pętlom resetowania. Uporządkowano strukturę jsonConfig i ulepszono obsługę timera.",
|
|
79
92
|
"uk": "Виправлено залишкову рекурсію таймера у тижневій та місячній статистиці, щоб повністю запобігти нескінченним циклам скидання. Очищено структуру jsonConfig і покращено обробку таймерів.",
|
|
80
93
|
"zh-cn": "修复了每周和每月统计中的剩余计时器递归问题,以完全防止无限重置循环。清理了 jsonConfig 结构并改进了计时器处理。"
|
|
81
|
-
},
|
|
82
|
-
"0.5.4": {
|
|
83
|
-
"en": "Fixed a rare infinite loop during weekly and monthly statistics reset that could cause Redis overload. Added timer protection and improved stability.",
|
|
84
|
-
"de": "Selten auftretende Endlosschleife beim Wochen- und Monatsreset der Statistik behoben, die zu Redis-Überlastung führen konnte. Timer-Schutz und Stabilität verbessert.",
|
|
85
|
-
"ru": "Исправлена редкая бесконечная петля при сбросе еженедельной и ежемесячной статистики, вызывавшая перегрузку Redis. Добавлена защита таймера и улучшена стабильность.",
|
|
86
|
-
"pt": "Corrigido um loop infinito raro durante a redefinição das estatísticas semanais e mensais que podia causar sobrecarga do Redis. Adicionada proteção de temporizador e melhorada a estabilidade.",
|
|
87
|
-
"nl": "Zeldzame oneindige lus opgelost tijdens de reset van wekelijkse en maandelijkse statistieken die Redis kon overbelasten. Timerbescherming en stabiliteit verbeterd.",
|
|
88
|
-
"fr": "Correction d'une boucle infinie rare lors de la réinitialisation des statistiques hebdomadaires et mensuelles pouvant provoquer une surcharge de Redis. Protection du minuteur et stabilité améliorées.",
|
|
89
|
-
"it": "Corretto un raro ciclo infinito durante il reset delle statistiche settimanali e mensili che poteva causare un sovraccarico di Redis. Migliorata la protezione del timer e la stabilità.",
|
|
90
|
-
"es": "Se corrigió un bucle infinito poco frecuente durante el reinicio de las estadísticas semanales y mensuales que podía causar sobrecarga de Redis. Protección de temporizador y estabilidad mejoradas.",
|
|
91
|
-
"pl": "Naprawiono rzadką nieskończoną pętlę podczas resetowania statystyk tygodniowych i miesięcznych, która mogła powodować przeciążenie Redis. Dodano ochronę timera i poprawiono stabilność.",
|
|
92
|
-
"uk": "Виправлено рідкісну нескінченну петлю під час скидання тижневої та місячної статистики, що могла спричинити перевантаження Redis. Додано захист таймера та покращено стабільність.",
|
|
93
|
-
"zh-cn": "修复了每周和每月统计重置期间可能导致 Redis 过载的罕见无限循环。改进了计时器保护和系统稳定性。"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"titleLang": {
|
|
@@ -268,51 +268,71 @@ const consumptionHelper = {
|
|
|
268
268
|
},
|
|
269
269
|
|
|
270
270
|
// ---------------------------------------------------------
|
|
271
|
-
// 🔵 WÖCHENTLICHER RESET (
|
|
271
|
+
// 🔵 WÖCHENTLICHER RESET (täglicher Check um 00:05 Uhr, nur Montag)
|
|
272
272
|
// ---------------------------------------------------------
|
|
273
273
|
_scheduleWeeklyReset() {
|
|
274
274
|
const now = new Date();
|
|
275
275
|
const next = new Date(now);
|
|
276
|
+
next.setHours(0, 5, 0, 0); // täglicher Check 00:05
|
|
276
277
|
|
|
277
|
-
//
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
next.setDate(now.getDate() + daysUntilMonday);
|
|
282
|
-
next.setHours(0, 5, 0, 0);
|
|
278
|
+
// Wenn die Zeit heute schon vorbei ist → morgen 00:05
|
|
279
|
+
if (next <= now) {
|
|
280
|
+
next.setDate(next.getDate() + 1);
|
|
281
|
+
}
|
|
283
282
|
|
|
284
283
|
const delay = next - now;
|
|
285
284
|
|
|
286
285
|
setTimeout(async () => {
|
|
287
286
|
try {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
287
|
+
const nowCheck = new Date();
|
|
288
|
+
|
|
289
|
+
// Nur wenn heute Montag ist (0 = Sonntag, 1 = Montag)
|
|
290
|
+
if (nowCheck.getDay() === 1) {
|
|
291
|
+
this.adapter.log.info('[consumptionHelper] Wochen-Reset (Montag 00:05)');
|
|
292
|
+
await this.adapter.setStateAsync('consumption.week_kwh', { val: 0, ack: true });
|
|
293
|
+
await this.adapter.setStateAsync('costs.week_eur', { val: 0, ack: true });
|
|
294
|
+
this.baselines.week = (await this.adapter.getStateAsync('consumption.total_kwh'))?.val || 0;
|
|
295
|
+
}
|
|
292
296
|
} catch (err) {
|
|
293
297
|
this.adapter.log.warn(`[consumptionHelper] Fehler beim Wochenreset: ${err.message}`);
|
|
294
298
|
}
|
|
295
|
-
|
|
299
|
+
|
|
300
|
+
// Morgen wieder planen
|
|
301
|
+
this._scheduleWeeklyReset();
|
|
296
302
|
}, delay);
|
|
297
303
|
},
|
|
298
304
|
|
|
299
305
|
// ---------------------------------------------------------
|
|
300
|
-
// 🔵 MONATLICHER RESET (
|
|
306
|
+
// 🔵 MONATLICHER RESET (täglicher Check um 00:05 Uhr, nur am 1.)
|
|
301
307
|
// ---------------------------------------------------------
|
|
302
308
|
_scheduleMonthlyReset() {
|
|
303
309
|
const now = new Date();
|
|
304
|
-
const next = new Date(now
|
|
310
|
+
const next = new Date(now);
|
|
311
|
+
next.setHours(0, 5, 0, 0); // täglicher Check 00:05
|
|
312
|
+
|
|
313
|
+
// Wenn die Zeit heute schon vorbei ist → morgen 00:05
|
|
314
|
+
if (next <= now) {
|
|
315
|
+
next.setDate(next.getDate() + 1);
|
|
316
|
+
}
|
|
317
|
+
|
|
305
318
|
const delay = next - now;
|
|
306
319
|
|
|
307
320
|
setTimeout(async () => {
|
|
308
321
|
try {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
322
|
+
const nowCheck = new Date();
|
|
323
|
+
|
|
324
|
+
// Nur am 1. des Monats
|
|
325
|
+
if (nowCheck.getDate() === 1) {
|
|
326
|
+
this.adapter.log.info('[consumptionHelper] Monats-Reset (1. 00:05)');
|
|
327
|
+
await this.adapter.setStateAsync('consumption.month_kwh', { val: 0, ack: true });
|
|
328
|
+
await this.adapter.setStateAsync('costs.month_eur', { val: 0, ack: true });
|
|
329
|
+
this.baselines.month = (await this.adapter.getStateAsync('consumption.total_kwh'))?.val || 0;
|
|
330
|
+
}
|
|
313
331
|
} catch (err) {
|
|
314
332
|
this.adapter.log.warn(`[consumptionHelper] Fehler beim Monatsreset: ${err.message}`);
|
|
315
333
|
}
|
|
334
|
+
|
|
335
|
+
// Morgen wieder planen
|
|
316
336
|
this._scheduleMonthlyReset();
|
|
317
337
|
}, delay);
|
|
318
338
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.poolcontrol",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Steuerung & Automatisierung für den Pool (Pumpe, Heizung, Ventile, Sensoren).",
|
|
5
5
|
"author": "DasBo1975 <dasbo1975@outlook.de>",
|
|
6
6
|
"homepage": "https://github.com/DasBo1975/ioBroker.poolcontrol",
|