Skip to content

Commit

Permalink
Create timestamps if location is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Oct 23, 2023
1 parent b824593 commit 20dd6af
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ iobroker add luftdaten
NodeJS 16.x is required

* (klein0r) Added link to sensor map to intro tab
* (klein0r) Create timestamps if location is not available

### 3.0.0 (2023-05-01)

Expand Down
48 changes: 24 additions & 24 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,32 +446,32 @@ class Luftdaten extends utils.Adapter {
native: {},
});
await this.setStateChangedAsync(`${deviceId}.location.altitude`, { val: parseFloat(sensorData.location.altitude), ack: true });
}

await this.setObjectNotExistsAsync(`${deviceId}.timestamp`, {
type: 'state',
common: {
name: {
en: 'Last Update',
de: 'Letztes Update',
ru: 'Последнее обновление',
pt: 'Última atualização',
nl: 'Laatste update',
fr: 'Dernière mise à jour',
it: 'Ultimo aggiornamento',
es: 'Última actualización',
pl: 'Ostatnia aktualizacja',
uk: 'Останнє оновлення',
'zh-cn': '最后更新',
},
type: 'number',
role: 'date',
read: true,
write: false,
await this.setObjectNotExistsAsync(`${deviceId}.timestamp`, {
type: 'state',
common: {
name: {
en: 'Last Update',
de: 'Letztes Update',
ru: 'Последнее обновление',
pt: 'Última atualização',
nl: 'Laatste update',
fr: 'Dernière mise à jour',
it: 'Ultimo aggiornamento',
es: 'Última actualización',
pl: 'Ostatnia aktualizacja',
uk: 'Останнє оновлення',
'zh-cn': '最后更新',
},
native: {},
});
await this.setStateChangedAsync(`${deviceId}.timestamp`, { val: new Date(sensorData.timestamp).getTime(), ack: true });
}
type: 'number',
role: 'date',
read: true,
write: false,
},
native: {},
});
await this.setStateChangedAsync(`${deviceId}.timestamp`, { val: new Date(sensorData.timestamp).getTime(), ack: true });
}

resolve(response.responseTime);
Expand Down

0 comments on commit 20dd6af

Please sign in to comment.