Data not arriving - No variables in bucket of device

Hi,

I am puzzled why data is not arriving with this script.

Any help is highly appropriated…

Thanks

// Assemble the data into the required format, then send it to the
// Tago.io cloud as an HTTP POST request.
void http_POST_data_Tago_cloud(void) {
// close any connection before send a new request.
// This will free the socket on the WiFi shield
client.stop();

Serial.println("\nStarting connection to server...");
  if (client.connect("api.tago.io", 80)) {
Serial.println("connected to server tago");
client.println("POST api.tago.io/data? HTTP/1.1");
client.println("HOST: api.tago.io"); 
client.println("Content-Type: application/json");
client.println("Device-Token: " TAGO_DEVICE_TOKEN_STRING);
client.println("_ssl: false");

uint8_t T_positive_integer = airData.T_C_int_with_sign & TEMPERATURE_VALUE_MASK;
// If the most-significant bit is set, the temperature is negative (below 0 C)
if ((airData.T_C_int_with_sign & TEMPERATURE_SIGN_MASK) != 0) {
  // The bit is set: celsius temperature is negative
  sprintf(postBuffer,"[{\"variable\":\"temperature\",\"value\":-%u.%u}", 
      T_positive_integer, airData.T_C_fr_1dp);
}
else {
  // The bit is not set: celsius temperature is positive
  sprintf(postBuffer,"[{\"variable\":\"temperature\",\"value\":%u.%u}", 
      T_positive_integer, airData.T_C_fr_1dp);
}

sprintf(fieldBuffer,",{\"variable\":\"pressure\",\"value\":%lu}", airData.P_Pa);
strcat(postBuffer, fieldBuffer);

sprintf(fieldBuffer,",{\"variable\":\"humidity\",\"value\":%u.%u}", 
    airData.H_pc_int, airData.H_pc_fr_1dp);
strcat(postBuffer, fieldBuffer);
  
sprintf(fieldBuffer,",{\"variable\":\"aqi\",\"value\":%u.%u}", 
    airQualityData.AQI_int, airQualityData.AQI_fr_1dp);
strcat(postBuffer, fieldBuffer);

sprintf(fieldBuffer,",{\"variable\":\"aqi_string\",\"value\":\"%s\"}", 
    interpret_AQI_value(airQualityData.AQI_int));
strcat(postBuffer, fieldBuffer);

sprintf(fieldBuffer,",{\"variable\":\"bvoc\",\"value\":%u.%02u}", 
    airQualityData.bVOC_int, airQualityData.bVOC_fr_2dp);
strcat(postBuffer, fieldBuffer);

sprintf(fieldBuffer,",{\"variable\":\"spl\",\"value\":%u.%u}", 
    soundData.SPL_dBA_int, soundData.SPL_dBA_fr_1dp);
strcat(postBuffer, fieldBuffer);

sprintf(fieldBuffer,",{\"variable\":\"peak_amp\",\"value\":%u.%02u}", 
    soundData.peak_amp_mPa_int, soundData.peak_amp_mPa_fr_2dp);
strcat(postBuffer, fieldBuffer);

sprintf(fieldBuffer,",{\"variable\":\"particulates\",\"value\":%u.%02u}", 
    particleData.concentration_int, particleData.concentration_fr_2dp);
strcat(postBuffer, fieldBuffer);

sprintf(fieldBuffer,",{\"variable\":\"illuminance\",\"value\":%u.%02u}]", 
    lightData.illum_lux_int, lightData.illum_lux_fr_2dp);
strcat(postBuffer, fieldBuffer);

int len = strlen(postBuffer);    
sprintf(fieldBuffer,"Content-Length: %u",len);     
client.println(fieldBuffer);     
client.println(); 
client.println(postBuffer);  
Serial.println(postBuffer);        

}
else {
Serial.println(“Connection failed”);
}
}

Hi @josveu,
Do you know if you’re getting any error from the http requests?

Also, did you check the Live Inspector on your device to see if any data is coming at all? Maybe it is in wrong format, which you can only see the error using the Live Inspector or checking the http request response.

If nothing is being showed in the Live Inspector at all, it usually means the device-token is wrong or you’re not sending a request at all.

Hi @josveu, try to send data as a string.

instead:

sprintf(fieldBuffer,",{\"variable\":\"humidity\",\"value\":%u.%u}",  airData.H_pc_int, airData.H_pc_fr_1dp);

do:

sprintf(fieldBuffer,",{\"variable\":\"humidity\",\"value\":\"%u.%u\"}", airData.H_pc_int, airData.H_pc_fr_1dp);

Maybe you are sending an invalid float value, the best you can do is find a way to get a response from the server and print it on your serial output, then you can check the server error code and the server error message, with that information we can help you better.

Thanks.

Problem solved, coding error it’s working now, Thanks