Skip to content

Commit

Permalink
Fix JSON serialization of node-wifi-mqtt: Transmit sensor readings as…
Browse files Browse the repository at this point in the history
… float values. Thanks, Matthias!
  • Loading branch information
amotl committed Mar 30, 2017
1 parent 0b21616 commit 05bf2f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Expand Up @@ -15,6 +15,7 @@ in-progress
- Update HX711 library incorporating our fix »Define “yield” as noop for older Arduino Core releases«
- Update Arduino-Makefile and makeEspArduino tools
- Improve firmwares :ref:`node-wifi-mqtt-homie` and :ref:`node-wifi-mqtt-homie-battery`
- Fix JSON serialization of :ref:`node-wifi-mqtt`: Transmit sensor readings as float values. Thanks, Matthias!


2017-03-17 0.13.0
Expand Down
21 changes: 11 additions & 10 deletions node-wifi-mqtt/node-wifi-mqtt.ino
Expand Up @@ -4,9 +4,9 @@
Collect beehive sensor data and transmit via WiFi to a MQTT broker.
Copyright (C) 2014-2017 Clemens Gruber
Copyright (C) 2016-2017 Karsten Harazim
Copyright (C) 2016-2017 Andreas Motl
Copyright (C) 2014-2017 Clemens Gruber <clemens@hiveeyes.org>
Copyright (C) 2016-2017 Karsten Harazim <karsten@hiveeyes.org>
Copyright (C) 2016-2017 Andreas Motl <andreas@hiveeyes.org>
Changes
Expand All @@ -15,6 +15,7 @@
2016-10-31 Beta release
2017-01-09 Add more sensors
2017-02-01 Serialize sensor readings en bloc using JSON
2017-03-30 Fix JSON serialization: Transmit sensor readings as float values. Thanks, Matthias!
GNU GPL v3 License
Expand Down Expand Up @@ -351,13 +352,13 @@ void loop() {
StaticJsonBuffer<256> jsonBuffer;

JsonObject& root = jsonBuffer.createObject();
root["weight"] = weightChar;
root["broodtemperature"] = temperatureArrayChar[0];
root["entrytemperature"] = temperatureArrayChar[1];
root["airtemperature"] = temperatureChar[0];
root["airhumidity"] = humidityChar[0];
root["airtemperature_outside"] = temperatureChar[1];
root["airhumidity_outside"] = humidityChar[1];
root["weight"] = String(weightChar).toFloat();
root["broodtemperature"] = String(temperatureArrayChar[0]).toFloat();
root["entrytemperature"] = String(temperatureArrayChar[1]).toFloat();
root["airtemperature"] = String(temperatureChar[0]).toFloat();
root["airhumidity"] = String(humidityChar[0]).toFloat();
root["airtemperature_outside"] = String(temperatureChar[1]).toFloat();
root["airhumidity_outside"] = String(humidityChar[1]).toFloat();


// Debugging
Expand Down

0 comments on commit 05bf2f9

Please sign in to comment.