Skip to content

Commit

Permalink
chore: release v0.4.8-alpha.12
Browse files Browse the repository at this point in the history
Bugfix : Ensure daily reset does not destroy cumulative memory value (Fixes NULL values for Watt after night reset)
Bugfix : Ensure proper reset and init of Watt
  • Loading branch information
DutchmanNL committed Jan 14, 2021
1 parent ef00788 commit 9d07adc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -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).",
Expand Down
8 changes: 7 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.sourceanalytix",
"version": "0.4.8-alpha.11",
"version": "0.4.8-alpha.12",
"description": "SourceAnalytix",
"author": {
"name": "DutchmanNL",
Expand Down

0 comments on commit 9d07adc

Please sign in to comment.