Closed pablojimpas closed 1 year ago
With this PR, we avoid creating an array of arrays in the decoded payload, which is a big inconvenience for integrations (e.g., TagoIO).
The current decoder produces this output:
{ "err": 0, "messages": [ [ { "measurementId": "4097", "measurementValue": 18, "type": "Air Temperature" }, { "measurementId": "4098", "measurementValue": 34, "type": "Air Humidity" }, { "measurementId": "4099", "measurementValue": 92458, "type": "Light Intensity" }, { "measurementId": "4190", "measurementValue": 8.1, "type": "UV Index" }, { "measurementId": "4105", "measurementValue": 1.8, "type": "Wind Speed" } ], [ { "measurementId": "4104", "measurementValue": 106, "type": "Wind Direction Sensor" }, { "measurementId": "4113", "measurementValue": 0, "type": "Rain Gauge" }, { "measurementId": "4101", "measurementValue": 88810, "type": "Barometric Pressure" } ] ], "payload": "0100B4220001692A51001202006A0000000022B1", "valid": true }
Instead, with this improvement, the output produced is the following:
{ "err": 0, "messages": [ { "measurementId": "4097", "measurementValue": 18, "type": "Air Temperature" }, { "measurementId": "4098", "measurementValue": 34, "type": "Air Humidity" }, { "measurementId": "4099", "measurementValue": 92458, "type": "Light Intensity" }, { "measurementId": "4190", "measurementValue": 8.1, "type": "UV Index" }, { "measurementId": "4105", "measurementValue": 1.8, "type": "Wind Speed" }, { "measurementId": "4104", "measurementValue": 106, "type": "Wind Direction Sensor" }, { "measurementId": "4113", "measurementValue": 0, "type": "Rain Gauge" }, { "measurementId": "4101", "measurementValue": 88810, "type": "Barometric Pressure" } ], "payload": "0100B4220001692A51001202006A0000000022B1", "valid": true }
Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax
@Kway99 please take a look at this and, if you find it appropriate, update the decoder everywhere else that Seeed might use it so that they stay in sync.
@pablojimpas thanks for this update
Summary
With this PR, we avoid creating an array of arrays in the decoded payload, which is a big inconvenience for integrations (e.g., TagoIO).
The current decoder produces this output:
Instead, with this improvement, the output produced is the following:
Changes
Notes for Reviewers
Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax
@Kway99 please take a look at this and, if you find it appropriate, update the decoder everywhere else that Seeed might use it so that they stay in sync.
Release Notes