iobroker.poolcontrol 0.6.3 → 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 +27 -27
- package/lib/helpers/consumptionHelper.js +58 -24
- package/lib/helpers/frostHelper.js +1 -1
- package/package.json +1 -1
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
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
|
+
},
|
|
19
|
+
"0.6.4": {
|
|
20
|
+
"en": "Fix for weekly, monthly and yearly reset in consumptionHelper",
|
|
21
|
+
"de": "Fix für Wochen-, Monats- und Jahres-Reset im ConsumptionHelper",
|
|
22
|
+
"ru": "Исправление еженедельного, ежемесячного и ежегодного сброса в consumptionHelper",
|
|
23
|
+
"pt": "Correção para redefinição semanal, mensal e anual no consumptionHelper",
|
|
24
|
+
"nl": "Fix voor wekelijkse, maandelijkse en jaarlijkse reset in consumptionHelper",
|
|
25
|
+
"fr": "Correctif pour la réinitialisation hebdomadaire, mensuelle et annuelle dans consumptionHelper",
|
|
26
|
+
"it": "Correzione per il reset settimanale, mensile e annuale in consumptionHelper",
|
|
27
|
+
"es": "Corrección para el reinicio semanal, mensual y anual en consumptionHelper",
|
|
28
|
+
"pl": "Poprawka cotygodniowego, comiesięcznego i corocznego resetu w consumptionHelper",
|
|
29
|
+
"uk": "Виправлення щотижневого, щомісячного та щорічного скидання в consumptionHelper",
|
|
30
|
+
"zh-cn": "修复 consumptionHelper 中每周、每月和每年重置的问题"
|
|
31
|
+
},
|
|
6
32
|
"0.6.3": {
|
|
7
33
|
"en": "Fix for weekly, monthly and yearly reset in consumptionHelper",
|
|
8
34
|
"de": "Fix für Wochen-, Monats- und Jahres-Reset im ConsumptionHelper",
|
|
@@ -65,32 +91,6 @@
|
|
|
65
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.",
|
|
66
92
|
"uk": "Виправлено залишкову рекурсію таймера у тижневій та місячній статистиці, щоб повністю запобігти нескінченним циклам скидання. Очищено структуру jsonConfig і покращено обробку таймерів.",
|
|
67
93
|
"zh-cn": "修复了每周和每月统计中的剩余计时器递归问题,以完全防止无限重置循环。清理了 jsonConfig 结构并改进了计时器处理。"
|
|
68
|
-
},
|
|
69
|
-
"0.5.4": {
|
|
70
|
-
"en": "Fixed a rare infinite loop during weekly and monthly statistics reset that could cause Redis overload. Added timer protection and improved stability.",
|
|
71
|
-
"de": "Selten auftretende Endlosschleife beim Wochen- und Monatsreset der Statistik behoben, die zu Redis-Überlastung führen konnte. Timer-Schutz und Stabilität verbessert.",
|
|
72
|
-
"ru": "Исправлена редкая бесконечная петля при сбросе еженедельной и ежемесячной статистики, вызывавшая перегрузку Redis. Добавлена защита таймера и улучшена стабильность.",
|
|
73
|
-
"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.",
|
|
74
|
-
"nl": "Zeldzame oneindige lus opgelost tijdens de reset van wekelijkse en maandelijkse statistieken die Redis kon overbelasten. Timerbescherming en stabiliteit verbeterd.",
|
|
75
|
-
"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.",
|
|
76
|
-
"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à.",
|
|
77
|
-
"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.",
|
|
78
|
-
"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ść.",
|
|
79
|
-
"uk": "Виправлено рідкісну нескінченну петлю під час скидання тижневої та місячної статистики, що могла спричинити перевантаження Redis. Додано захист таймера та покращено стабільність.",
|
|
80
|
-
"zh-cn": "修复了每周和每月统计重置期间可能导致 Redis 过载的罕见无限循环。改进了计时器保护和系统稳定性。"
|
|
81
|
-
},
|
|
82
|
-
"0.5.3": {
|
|
83
|
-
"en": "Added user selection for Telegram notifications. If no user is selected, messages are sent globally as before; if one or more usernames are specified, only those users receive the messages. Admin UI visually improved (recipient field indented under the instance). speechHelper and jsonConfig.json updated.",
|
|
84
|
-
"de": "Benutzerauswahl für Telegram-Benachrichtigungen hinzugefügt. Wenn kein Benutzer ausgewählt ist, werden Nachrichten wie bisher global gesendet; bei einem oder mehreren Benutzernamen erhalten nur diese die Nachrichten. Admin-UI optisch verbessert (Empfängerfeld unter der Instanz eingerückt). speechHelper und jsonConfig.json aktualisiert.",
|
|
85
|
-
"ru": "Добавлен выбор пользователей для уведомлений Telegram. Если пользователь не выбран, сообщения отправляются глобально, как и раньше; при указании одного или нескольких имен сообщения получают только эти пользователи. Улучшен интерфейс админки (поле получателей расположено под экземпляром). Обновлены speechHelper и jsonConfig.json.",
|
|
86
|
-
"pt": "Adicionada seleção de usuários para notificações do Telegram. Se nenhum usuário for selecionado, as mensagens serão enviadas globalmente como antes; se um ou mais nomes forem informados, apenas esses usuários receberão as mensagens. UI de administração melhorada visualmente (campo de destinatários recuado sob a instância). speechHelper e jsonConfig.json atualizados.",
|
|
87
|
-
"nl": "Gebruikersselectie toegevoegd voor Telegram-meldingen. Als er geen gebruiker is geselecteerd, worden berichten zoals voorheen wereldwijd verzonden; bij één of meer opgegeven gebruikersnamen ontvangen alleen die gebruikers de berichten. Admin-UI visueel verbeterd (ontvanger-veld ingesprongen onder de instantie). speechHelper en jsonConfig.json bijgewerkt.",
|
|
88
|
-
"fr": "Ajout de la sélection d’utilisateurs pour les notifications Telegram. Si aucun utilisateur n’est sélectionné, les messages sont envoyés globalement comme auparavant ; si un ou plusieurs noms sont spécifiés, seuls ces utilisateurs reçoivent les messages. Amélioration visuelle de l’interface d’admin (champ destinataire indenté sous l’instance). speechHelper et jsonConfig.json mis à jour.",
|
|
89
|
-
"it": "Aggiunta la selezione degli utenti per le notifiche Telegram. Se non viene selezionato alcun utente, i messaggi vengono inviati globalmente come prima; indicando uno o più nomi utente, solo questi riceveranno i messaggi. Migliorata l’UI di amministrazione (campo destinatari rientrato sotto l’istanza). Aggiornati speechHelper e jsonConfig.json.",
|
|
90
|
-
"es": "Se añadió la selección de usuarios para notificaciones de Telegram. Si no se selecciona ningún usuario, los mensajes se envían globalmente como antes; si se especifican uno o más nombres de usuario, solo esos usuarios reciben los mensajes. Mejora visual en la interfaz de administración (campo de destinatarios sangrado bajo la instancia). speechHelper y jsonConfig.json actualizados.",
|
|
91
|
-
"pl": "Dodano wybór użytkowników dla powiadomień Telegram. Gdy nie wybrano żadnego użytkownika, wiadomości są wysyłane globalnie jak wcześniej; po podaniu jednego lub kilku nazw użytkowników wiadomości otrzymują tylko oni. Ulepszono UI administracyjne (pole odbiorców pod instancją). Zaktualizowano speechHelper i jsonConfig.json.",
|
|
92
|
-
"uk": "Додано вибір користувачів для сповіщень Telegram. Якщо користувача не вибрано, повідомлення надсилаються глобально, як і раніше; якщо вказано одне чи кілька імен, їх отримують лише ці користувачі. Візуально покращено інтерфейс адміністрування (поле одержувача під екземпляром). Оновлено speechHelper та jsonConfig.json.",
|
|
93
|
-
"zh-cn": "新增 Telegram 通知的用户选择功能。未选择用户时消息将像以前一样全局发送;指定一个或多个用户名时,仅这些用户会收到消息。优化了管理界面显示(收件人字段缩进至实例下方)。已更新 speechHelper 和 jsonConfig.json。"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"titleLang": {
|
|
@@ -268,72 +268,106 @@ 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
|
},
|
|
319
339
|
|
|
320
340
|
// ---------------------------------------------------------
|
|
321
|
-
// 🔵 JÄHRLICHER RESET (
|
|
341
|
+
// 🔵 JÄHRLICHER RESET (täglicher Check um 00:10 Uhr)
|
|
322
342
|
// ---------------------------------------------------------
|
|
323
343
|
_scheduleYearlyReset() {
|
|
324
344
|
const now = new Date();
|
|
325
|
-
const next = new Date(now
|
|
345
|
+
const next = new Date(now);
|
|
346
|
+
next.setHours(0, 10, 0, 0); // täglicher Check 00:10 Uhr
|
|
347
|
+
|
|
348
|
+
// Wenn Zeit für heute bereits vorbei ist → morgen um 00:10
|
|
349
|
+
if (next <= now) {
|
|
350
|
+
next.setDate(now.getDate() + 1);
|
|
351
|
+
}
|
|
352
|
+
|
|
326
353
|
const delay = next - now;
|
|
327
354
|
|
|
328
355
|
setTimeout(async () => {
|
|
329
356
|
try {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
357
|
+
const nowCheck = new Date();
|
|
358
|
+
|
|
359
|
+
// 👉 Nur wenn wirklich 1. Januar
|
|
360
|
+
if (nowCheck.getMonth() === 0 && nowCheck.getDate() === 1) {
|
|
361
|
+
this.adapter.log.info('[consumptionHelper] Jahres-Reset (1. Januar 00:10)');
|
|
362
|
+
await this.adapter.setStateAsync('consumption.year_kwh', { val: 0, ack: true });
|
|
363
|
+
await this.adapter.setStateAsync('costs.year_eur', { val: 0, ack: true });
|
|
364
|
+
this.baselines.year = (await this.adapter.getStateAsync('consumption.total_kwh'))?.val || 0;
|
|
365
|
+
}
|
|
334
366
|
} catch (err) {
|
|
335
367
|
this.adapter.log.warn(`[consumptionHelper] Fehler beim Jahresreset: ${err.message}`);
|
|
336
368
|
}
|
|
369
|
+
|
|
370
|
+
// Morgen wieder prüfen
|
|
337
371
|
this._scheduleYearlyReset();
|
|
338
372
|
}, delay);
|
|
339
373
|
},
|
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",
|