Skip to content

Commit

Permalink
Option 'Only update datapoints if changes are detected' corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
Homemade-Disaster committed Jan 27, 2024
1 parent d193c82 commit 1db88a0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -34,6 +34,10 @@ Mittels der Netatmo-Energy API werden die aktuellen Einstellungen abgeholt bzw.

[Older changes](CHANGELOG_OLD.md)
<!-- ### **WORK IN PROGRESS** -->
### 2.7.3 (2024-01-27)

* (ioKlausi) Option 'Only update datapoints if changes are detected' corrected

### 2.7.2 (2024-01-18)

* (ioKlausi) Adjust attributes of the adapter
Expand Down
15 changes: 14 additions & 1 deletion io-package.json
@@ -1,8 +1,21 @@
{
"common": {
"name": "netatmo-energy",
"version": "2.7.2",
"version": "2.7.3",
"news": {
"2.7.3": {
"en": "Option 'Only update datapoints if changes are detected' corrected",
"de": "Option 'Datenpunkte nur aktualisieren, wenn Änderungen erkannt werden' korrigiert",
"ru": "Опция «Только обновление точек данных при обнаружении изменений»",
"pt": "Opção 'Apenas atualize datapoints se as alterações forem detectadas' corrigido",
"nl": "Optie 'Alleen gegevenspunten bijwerken als wijzigingen worden gedetecteerd' gecorrigeerd",
"fr": "Option « Mettre à jour uniquement les points de données si des changements sont détectés » corrigée",
"it": "Opzione 'Solo aggiornare i datapoint se le modifiche vengono rilevate' corretto",
"es": "Opción 'Sólo actualizar los puntos de datos si se detectan cambios' corregido",
"pl": "Opcja \"Aktualizacja punktów danych tylko w przypadku wykrycia zmian\" poprawiona",
"uk": "Опція «Навколо оновлення точок даних при виправленні змін»",
"zh-cn": "选项“ 只有发现变化时更新数据点” 更正"
},
"2.7.2": {
"en": "Adjust attributes of the adapter",
"de": "Attribute des Adapters anpassen",
Expand Down
5 changes: 3 additions & 2 deletions main.js
Expand Up @@ -1258,12 +1258,13 @@ class NetatmoEnergy extends utils.Adapter {
myObject.common.states = list;
}
try {

if (forced) {
// @ts-ignore
await this.setObjectAsync(id, myObject);
if (!norefresh) {
const actvalue = await this.getStateAsync(id);
if (this.config.UpdateStatesIfChanged == false || (this.config.UpdateStatesIfChanged == true && ((actvalue && actvalue != null && actvalue.val != value) || (this.config.UpdateStatesChangedTempEveryTime == true && role == 'value.temperature')))) {
if (this.config.UpdateStatesIfChanged == false || (this.config.UpdateStatesIfChanged == true && ((!actvalue || actvalue == null || (actvalue && actvalue != null && actvalue.val != value)) || (this.config.UpdateStatesChangedTempEveryTime == true && role == 'value.temperature')))) {
this.log.debug(mytools.tl('Event triggered:', this.systemLang) + glob.blank + id + ': ' + ((actvalue) ? ' (' + actvalue.val + ')' : 'NULL') + ' --> ' + value);
await this._subscribeStates(id);
await this.setState(id, value, ack);
Expand All @@ -1274,7 +1275,7 @@ class NetatmoEnergy extends utils.Adapter {
await this.setObjectNotExistsAsync(id, myObject);
if (!norefresh) {
const actvalue = await this.getStateAsync(id);
if (this.config.UpdateStatesIfChanged == false || (this.config.UpdateStatesIfChanged == true && ((actvalue && actvalue != null && actvalue.val != value) || (this.config.UpdateStatesChangedTempEveryTime == true && role == 'value.temperature')))) {
if (this.config.UpdateStatesIfChanged == false || (this.config.UpdateStatesIfChanged == true && ((!actvalue || actvalue == null || (actvalue && actvalue != null && actvalue.val != value)) || (this.config.UpdateStatesChangedTempEveryTime == true && role == 'value.temperature')))) {
this.log.debug(mytools.tl('Event triggered:', this.systemLang) + glob.blank + id + ': ' + ((actvalue) ? ' (' + actvalue.val + ')' : 'NULL') + ' --> ' + value);
await this._subscribeStates(id);
await this.setState(id, value, ack);
Expand Down
4 changes: 2 additions & 2 deletions 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
@@ -1,6 +1,6 @@
{
"name": "iobroker.netatmo-energy",
"version": "2.7.2",
"version": "2.7.3",
"engines": {
"node": ">=16.0.0"
},
Expand Down

0 comments on commit 1db88a0

Please sign in to comment.