# Example for sending temperature and humidity to the cloud using the DHT22 and ESP8266 Code # 2

**URL:** <https://forums.losant.com/t/example-for-sending-temperature-and-humidity-to-the-cloud-using-the-dht22-and-esp8266-code-2/2773>\
**Category:** Help\
**Tags:** mqtt\
**Created:** [March 30, 2020, 9:32pm UTC](https://forums.losant.com/t/example-for-sending-temperature-and-humidity-to-the-cloud-using-the-dht22-and-esp8266-code-2/2773 "2020-03-30T21:32:54Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [March 31, 2020, 2:05pm UTC](https://forums.losant.com/t/example-for-sending-temperature-and-humidity-to-the-cloud-using-the-dht22-and-esp8266-code-2/2773/3 "2020-03-31T14:05:27Z")

</div>

Hi @Nick_C,

The example included in the Github repository contains code to connect and send data to Losant. You will have to update the code from the example to also read from your DHT sensor, and include these values in the data sent to Losant. For further assistance with this sensor, I would recommend checking out the [Arduino Forums](https://forum.arduino.cc/) and/or [Stack Overflow](https://stackoverflow.com/questions/tagged/arduino).

I am also curious, could you further elaborate on the issue you are facing with “and display them on the dashboard”? Is this an issue that will this likely be solved once you are sending values from the sensor?

There are also some posts around the Forums about DHT that may provide some assistance. You can check them out here:

> [@Device won't transmit to Losant, mqttClient.state -2](https://forums.losant.com/t/device-wont-transmit-to-losant-mqttclient-state-2/2649):
>
> Hello, I have am working on setting up a temperature and humidity sensor based on [the tutorial](https://www.losant.com/blog/getting-started-with-the-esp8266-and-dht22-sensor) by @anaptfox. When testing though, the device says authentication succeeded in the application log, however it doesn’t transmit any data afterward. [log] I am also getting this readout in the serial monitor: WiFi connected IP address: xxx.xxx.x.x Authenticating Device...This device is authorized! Connecting to Losant...-2 .-2 .-2 .-2 .-2 .-2 I have tried removing everything marked “secure” in …

> [@\[SOLVED\] "Failed to read from DHT sensor!"](https://forums.losant.com/t/solved-failed-to-read-from-dht-sensor/1629):
>
> Hi, I’m trying to read the temperature and humidity with this code, but I can not read it, because it only shows this error. If anyone can help me, I’ll be very grateful. [https://gist.githubusercontent.com/LosantGists/1c76d04c0e567852c416d6dd7b1fa87b/raw/38225afa6feca0513299c5e2da485515e52505fe/esp8266-dht22.ino](https://gist.githubusercontent.com/LosantGists/1c76d04c0e567852c416d6dd7b1fa87b/raw/38225afa6feca0513299c5e2da485515e52505fe/esp8266-dht22.ino)

Please let me know if I can answer any additional questions 😄

Thanks!  
Julia

---

_[View the full topic](https://forums.losant.com/t/example-for-sending-temperature-and-humidity-to-the-cloud-using-the-dht22-and-esp8266-code-2/2773)._
