Skip to content

Commit 05bf2f9

Browse files
committed
Fix JSON serialization of node-wifi-mqtt: Transmit sensor readings as float values. Thanks, Matthias!
1 parent 0b21616 commit 05bf2f9

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ in-progress
1515
- Update HX711 library incorporating our fix »Define “yield” as noop for older Arduino Core releases«
1616
- Update Arduino-Makefile and makeEspArduino tools
1717
- Improve firmwares :ref:`node-wifi-mqtt-homie` and :ref:`node-wifi-mqtt-homie-battery`
18+
- Fix JSON serialization of :ref:`node-wifi-mqtt`: Transmit sensor readings as float values. Thanks, Matthias!
1819

1920

2021
2017-03-17 0.13.0

node-wifi-mqtt/node-wifi-mqtt.ino

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
55
Collect beehive sensor data and transmit via WiFi to a MQTT broker.
66
7-
Copyright (C) 2014-2017 Clemens Gruber
8-
Copyright (C) 2016-2017 Karsten Harazim
9-
Copyright (C) 2016-2017 Andreas Motl
7+
Copyright (C) 2014-2017 Clemens Gruber <clemens@hiveeyes.org>
8+
Copyright (C) 2016-2017 Karsten Harazim <karsten@hiveeyes.org>
9+
Copyright (C) 2016-2017 Andreas Motl <andreas@hiveeyes.org>
1010
1111
1212
Changes
@@ -15,6 +15,7 @@
1515
2016-10-31 Beta release
1616
2017-01-09 Add more sensors
1717
2017-02-01 Serialize sensor readings en bloc using JSON
18+
2017-03-30 Fix JSON serialization: Transmit sensor readings as float values. Thanks, Matthias!
1819
1920
2021
GNU GPL v3 License
@@ -351,13 +352,13 @@ void loop() {
351352
StaticJsonBuffer<256> jsonBuffer;
352353

353354
JsonObject& root = jsonBuffer.createObject();
354-
root["weight"] = weightChar;
355-
root["broodtemperature"] = temperatureArrayChar[0];
356-
root["entrytemperature"] = temperatureArrayChar[1];
357-
root["airtemperature"] = temperatureChar[0];
358-
root["airhumidity"] = humidityChar[0];
359-
root["airtemperature_outside"] = temperatureChar[1];
360-
root["airhumidity_outside"] = humidityChar[1];
355+
root["weight"] = String(weightChar).toFloat();
356+
root["broodtemperature"] = String(temperatureArrayChar[0]).toFloat();
357+
root["entrytemperature"] = String(temperatureArrayChar[1]).toFloat();
358+
root["airtemperature"] = String(temperatureChar[0]).toFloat();
359+
root["airhumidity"] = String(humidityChar[0]).toFloat();
360+
root["airtemperature_outside"] = String(temperatureChar[1]).toFloat();
361+
root["airhumidity_outside"] = String(humidityChar[1]).toFloat();
361362

362363

363364
// Debugging

0 commit comments

Comments
 (0)