diff --git a/README.md b/README.md index d36ce6f9..8de6f438 100644 --- a/README.md +++ b/README.md @@ -243,9 +243,9 @@ When the adapter crashes or an other Code error happens, this error message that --> ## Changelog - -### 0.4.8-alpha.11 (2021-01-14) +### 0.4.8-alpha.12 (2021-01-14) * (Dutchman) Bugfix : Ensure daily reset does not destroy cumulative memory value (Fixes NULL values for Watt after night reset) +* (Dutchman) Bugfix : Ensure proper reset and init of Watt ### 0.4.8-alpha.10 (2021-01-14) * (Dutchman) Bugfix : Avoid loop if init value is set and > reading diff --git a/io-package.json b/io-package.json index 6557a118..e54d17f6 100644 --- a/io-package.json +++ b/io-package.json @@ -1,8 +1,20 @@ { "common": { "name": "sourceanalytix", - "version": "0.4.8-alpha.11", + "version": "0.4.8-alpha.12", "news": { + "0.4.8-alpha.12": { + "en": "Bugfix : Ensure daily reset does not destroy cumulative memory value (Fixes NULL values for Watt after night reset)\nBugfix : Ensure proper reset and init of Watt", + "de": "Bugfix: Stellen Sie sicher, dass das tägliche Zurücksetzen den kumulativen Speicherwert nicht zerstört (Behebt NULL-Werte für Watt nach dem Zurücksetzen bei Nacht).\nBugfix: Stellen Sie sicher, dass Watt ordnungsgemäß zurückgesetzt und gestartet wurde", + "ru": "Исправление: убедитесь, что ежедневный сброс не уничтожает совокупное значение памяти (исправляет значения NULL для ватт после ночного сброса)\nИсправление: Обеспечьте правильный сброс и инициализацию ватт", + "pt": "Correção de bug: garantir que a reinicialização diária não destrua o valor cumulativo da memória (corrige os valores NULL para Watt após a reinicialização noturna)\nCorreção de bug: garantir a reinicialização e inicialização adequadas de Watt", + "nl": "Bugfix: zorg ervoor dat dagelijkse reset de cumulatieve geheugenwaarde niet vernietigt (repareert NULL-waarden voor Watt na nachtreset)\nBugfix: Zorg voor een juiste reset en start van Watt", + "fr": "Correctif: assurez-vous que la réinitialisation quotidienne ne détruit pas la valeur de mémoire cumulée (corrige les valeurs NULL pour Watt après la réinitialisation de nuit)\nCorrectif: assurez-vous que la réinitialisation et l'initialisation de Watt sont correctes", + "it": "Bugfix: assicurarsi che il ripristino giornaliero non distrugga il valore della memoria cumulativa (risolve i valori NULL per Watt dopo il ripristino notturno)\nBugfix: Garantire un corretto reset e inizializzazione di Watt", + "es": "Corrección de error: asegúrese de que el reinicio diario no destruya el valor de memoria acumulativo (corrige los valores NULL para Watt después del reinicio nocturno)\nCorrección de errores: asegúrese de reiniciar e iniciar correctamente Watt", + "pl": "Poprawka: Upewnij się, że codzienny reset nie niszczy skumulowanej wartości pamięci (naprawia wartości NULL dla watów po resetowaniu nocnym)\nPoprawka: Zapewnij prawidłowy reset i inicjalizację Watt", + "zh-cn": "错误修正:确保每日重设不会破坏累积内存值(夜间重设后修复Watt的NULL值)\n错误修正:确保正确重置和初始化瓦特" + }, "0.4.8-alpha.11": { "en": "Bugfix : Ensure daily reset does not destroy cumulative memory value (Fixes NULL values for Watt after night reset)", "de": "Bugfix: Stellen Sie sicher, dass das tägliche Zurücksetzen den kumulativen Speicherwert nicht zerstört (Behebt NULL-Werte für Watt nach dem Zurücksetzen bei Nacht).", diff --git a/main.js b/main.js index 1601d91d..07d4d278 100644 --- a/main.js +++ b/main.js @@ -564,7 +564,7 @@ class Sourceanalytix extends utils.Adapter { } catch (error) { this.errorHandling(`[onStateChange] for ${id}`, error); } - } + } /** * Daily logic to store start values in memory and previous values at states @@ -608,6 +608,11 @@ class Sourceanalytix extends utils.Adapter { this.activeStates[stateID].calcValues.previousReadingWattTs = null; } + obj.common.custom[this.namespace].cumulativeValue = reading; + obj.common.custom[this.namespace].valueAtDeviceReset = this.activeStates[stateID].calcValues.valueAtDeviceReset; + obj.common.custom[this.namespace].valueAtDeviceInit = this.activeStates[stateID].calcValues.valueAtDeviceInit; + this.activeStates[stateID].calcValues = obj.common.custom[this.namespace]; + //At week reset ensure current week values are moved to previous week and current set to 0 if (beforeReset.week !== actualDate.week) { for (const x in weekdays) { @@ -1075,6 +1080,7 @@ class Sourceanalytix extends utils.Adapter { if (currentCath === 'Watt') { // Convert watt to watt hours reading = await this.wattToWattHour(stateID, stateVal); + if (reading === null || reading === undefined) return; } else if (currentCath === 'Liter' && targetCath === 'Cubic_meter' ) { reading = stateVal.val / 1000; diff --git a/package-lock.json b/package-lock.json index 2528dd9e..1afa984f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "iobroker.sourceanalytix", - "version": "0.4.8-alpha.11", + "version": "0.4.8-alpha.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8c8ef497..f339b0cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.sourceanalytix", - "version": "0.4.8-alpha.11", + "version": "0.4.8-alpha.12", "description": "SourceAnalytix", "author": { "name": "DutchmanNL",