Hi, I am observing a strange behaviour from notecard in handling zero values (float 0.0 or integer 0).
I am reading my sensor values by an MCU and send them through note.card (LoRa) to note.hub.
Here are the code for creating the template (in setup()):
// Create new template
req = notecard.newRequest("note.template");
if (req != NULL) {
JAddStringToObject(req, "file", "tdlas.qo");
JAddNumberToObject(req, "port", 99);
J *body = JCreateObject();
if (body != NULL) {
JAddNumberToObject(body, "methane", 14.1);
JAddItemToObject(req, "body", body);
notecard.sendRequest(req);
}
}
and adding sensor value “methane” to it (in loop()):
// Send sensor data to Notehub
J *req = notecard.newRequest("note.add");
if (req != NULL) {
JAddStringToObject(req, "file", "tdlas.qo");
JAddNumberToObject(req, "port", 99);
J *body = JAddObjectToObject(req, "body");
if (body != NULL) {
JAddNumberToObject(body, "methane", methane);
// JAddNumberToObject(body, "methane", 0);
}
notecard.sendRequest(req);
}
}
methane value I get from sensor is 0.00, and I get this in serial monitor output:
[INFO]{“req”:“note.add”,“file”:“tdlas.qo”,“port”:99,“body”:“methane”:0},“crc”:“0011:09F14C3A”}
but surprisingly I get empty {} in Notehub!
I tried manually setting sensor values to 0.00 and 0 and all behave the same. Could you please advise how to resolve this?