[SOLVED] Ubidots only seeing '-2' instead of actual data on Particle Photon and DHT22

Okay, this is weird. I am using a Particle Photon to send data to Ubidots. The photon is pulling temperature and humidity values from a DHT22. This data is being displayed on a web page and so I know that the code and associated variables are capturing data properly.

The strange thing is that when I send the data to Ubidots, I only see a value of -2. Clearly there is something weird going on and I am not sure why I am seeing this. Here is a snippet of code where the value is created and sent. Note that I am only sending temperature to Ubidots in this example, but I see -2 if I send humidI as well. I have also tested sending tempF and humidF with the same result. As an FYI, the Web page is displaying tempFi and humidI.

  if (Time.now() - PreviousTime > interval){
      PreviousTime = Time.now();
      DHT.acquireAndWait();
      tempF = DHT.getFahrenheit();
      tempFi = (int) tempF;
      humidF = DHT.getHumidity();
      humidI = (int) humidF;
      tempupdate = true;
      request.body = "{\"value\":" + String(tempFi) + "}";
      http.post(request, response, headers);
    }

Does anyone have any idea what is going on here? I have also posted a question over on the Particle forum as well.

Thank you!

Hi @JL_678 can you point us to the DHT library you are you using? We’d need to check why it’s returning -2 instead of the actual value

Hi,

I am using the Piettech library. It is rock solid for both my Photon and my Core. As an FYI, I am certain that the variables are populated because I see them on my web page. (e.g. the web page properly shows temperature and humidity using tempFi and humidI) The issue is why Ubidots is not getting the value…

Thank you!

Hi,

I am not sure what happened, but it just started working. Did someone make a change at Ubidots? Thank you, if so!

Hi @JL_678 Cool! although there hasn’t been new deployments today actually. Could you share your entire code (except tokens of course!) to see what the potential problem could have been?

Thanks

Este topic está ahora cerrado. No se admiten nuevas respuestas