But Ubidots is responding with an error:
{"results":[{"array":[{"status_code":400,"errors":{"error":{"message":"The value NaN is not in a valid range.","code":400001}}}]}]}
I'm wondering if I'm constructing my payload correctly.
Here's my code:
String data = "{";
data += "\"ts\": \"" + String(sensorData.ts) + "\","; // ts as a string
data += "\"u\": " + String(sensorData.t1, 2) + ","; // u as a numeric value
data += "\"d\": " + String(sensorData.t2, 2) + ","; // d as a numeric value
data += "\"b\": " + String(sensorData.b, 2); // b as a numeric value
data += "}";
You can see my comments. Maybe I'm totally wrong. Are these correct?
It's quite possible that the format you are sending to Ubidots is not what it's expecting, but I'm not familiar with it. Your template is quite a bit different than Chip's in the original post, and I'm also not sure what format is allowed. But I'd guess that the array is not constructed properly, so when Ubidots is trying to read the number it's getting something that's not a number (NaN error).