diff --git a/README.md b/README.md index 84c3bb9..d3668c8 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Standard port the adpater listens on is 50222 but can be changed in setup. The adapter provides a minimum set of setup options. The listening port can be changed, which should not be required as the port the weatherstation hub is sending can not be changed, to my knowledge. -The station height in meters above sea level is used to calculate the reduced pressure from local pressure as is provided by the station. Just use the same height as entered in the App. There may be small differences compared to the reduced pressure in the app depending on the formula used. The adapter uses the formula the german weather service DWD is using (http://dk0te.ba-ravensburg.de/cgi-bin/navi?m=WX_BAROMETER; found [here](https://www.symcon.de/forum/threads/6480-Relativen-Luftdruck-aus-absoluten-Luftdruck-errechnen)). +The station height in meters above sea level is used to calculate the reduced pressure from local pressure as is provided by the station. Just use the same height as entered in the App. There may be small differences compared to the reduced pressure in the app depending on the formula used. The adapter uses the formula the german weather service DWD is using (http://dk0te.ba-ravensburg.de/cgi-bin/navi?m=WX_BAROMETER; nur noch [hier](https://www.symcon.de/forum/threads/6480-Relativen-Luftdruck-aus-absoluten-Luftdruck-errechnen)). When the debug checkbox is ticked, the adapter creates a lot of output in the log file. Should only be used for debugging. @@ -59,6 +59,8 @@ Further, the adapter provides a selection of useful minimum and maximum values o The protocol sends a lightning distance of 0 when no lightning was detected. Values of 0 are modified to 999 to avoid the impression that lightning strikes are directly overhead. ## Changelog +### 0.1.1 +(womi) Fixed "invalid date" in timestamps ### 0.1.0 (womi) Compatibility with Admin 5; Stable version diff --git a/io-package.json b/io-package.json index fbc0e9b..2de2179 100644 --- a/io-package.json +++ b/io-package.json @@ -1,8 +1,12 @@ { "common": { "name": "weatherflow_udp", - "version": "0.1.0", + "version": "0.1.1", "news": { + "0.1.1": { + "en": "Fixed 'invalid date' for timestamps", + "de": "Problem mit ungültigen Datumswerten bei den Zeitstempeln behoben" + }, "0.1.0": { "en": "Compatibility with Admin 5; Stable version", "de": "Kompatibilität mit Admin 5" diff --git a/lib/messages.js b/lib/messages.js index 51fc958..6718757 100644 --- a/lib/messages.js +++ b/lib/messages.js @@ -14,7 +14,7 @@ messages.evt_precip = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], @@ -28,7 +28,7 @@ messages.evt_strike = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], @@ -56,7 +56,7 @@ messages.rapid_wind = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], @@ -84,7 +84,7 @@ messages.obs_air = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], @@ -157,7 +157,7 @@ messages.obs_sky = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], @@ -280,7 +280,7 @@ messages.obs_st = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], @@ -430,7 +430,7 @@ messages.device_status = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], @@ -536,7 +536,7 @@ messages.hub_status = { 0: ['timestamp', { type: 'state', common: { - type: 'object', read: true, write: false, role: 'date', name: 'Time of event', + type: 'number', read: true, write: false, role: 'value.time', name: 'Time of event', }, native: {}, }], diff --git a/main.js b/main.js index 52e1ed3..a752f52 100644 --- a/main.js +++ b/main.js @@ -214,7 +214,7 @@ class WeatherflowUdp extends utils.Adapter { // Deal with timestamp messages if (messageInfo[item][field][0] === 'timestamp') { - fieldvalue = JSON.stringify(new Date(fieldvalue * 1000)); // timestamp in iobroker is milliseconds and provided timestamp is seconds + fieldvalue = new Date(fieldvalue * 1000).getTime(); // timestamp in iobroker is milliseconds and provided timestamp is seconds } if (that.config.debug === true) { that.log.info(['[', field, '] ', 'state: ', stateName, ' = ', fieldvalue].join('')); } @@ -314,7 +314,7 @@ class WeatherflowUdp extends utils.Adapter { } } - // raining or not as binary state? + // raining or not as boolean state? //------------------------------- if (messageInfo[item][field][0] === 'precipAccumulated') { const statePathCorrected = statePath.replace('obs_st', 'evt_precip').replace('obs_sky', 'evt_precip'); // move state from observation to evt_precip @@ -333,7 +333,7 @@ class WeatherflowUdp extends utils.Adapter { } } - if (messageType === 'evt_precip' && messageInfo[item][field][0] === 'timestamp') { // if precipitation start is recieved also set to true + if (messageType === 'evt_precip' && messageInfo[item][field][0] === 'timestamp') { // if precipitation start is received also set to true const stateNameRaining = [statePath, 'raining'].join('.'); const stateParametersRaining = { type: 'state', diff --git a/package.json b/package.json index 337b1b0..9edd514 100644 --- a/package.json +++ b/package.json @@ -1,28 +1,5 @@ { - "_from": "iobroker.weatherflow_udp@0.0.15", - "_id": "iobroker.weatherflow_udp@0.0.15", - "_inBundle": false, - "_integrity": "sha512-SPH6/PhwHV3nFY4ZdTBvh6505DNkyJDOG5lr/XJkmF/dF2PhAT269q9Bfst8NEG/1BZQ+2Qk4xlVAEJtVgBh2g==", - "_location": "/iobroker.weatherflow_udp", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "iobroker.weatherflow_udp@0.0.15", - "name": "iobroker.weatherflow_udp", - "escapedName": "iobroker.weatherflow_udp", - "rawSpec": "0.0.15", - "saveSpec": null, - "fetchSpec": "0.0.15" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/iobroker.weatherflow_udp/-/iobroker.weatherflow_udp-0.0.15.tgz", - "_shasum": "70f06f5a71d204ba4c5fa832093b1d7eb9a03963", - "_spec": "iobroker.weatherflow_udp@0.0.15", - "_where": "C:\\iobroker", + "version": "0.1.1", "author": { "name": "womi", "email": "woessmich@gmail.com" @@ -82,6 +59,5 @@ "test:js": "mocha --opts test/mocha.custom.opts", "test:package": "mocha test/package --exit", "test:unit": "mocha test/unit --exit" - }, - "version": "0.1.0" + } }