Outdoor Temperature Humidity Sensor with an ESP32 and Esphomeyaml

Hi everybody,

not a big thing but I finally found a (relative) stable and cost efficient way of deploying various temperature sensors around the house.

Direct comparison with yr.no/Darksky Outdoor Temp. shows a big difference.

Thanks to @OttoWinter for esphomeyaml and the cheap prices on ebay for this setup:

Screenshot Group Card in the UI:

Grafana Screenshot:

I use a cheap 18650 battery directly connected to the Wemos Lolin32 board. Voltage of the battery (connected to an ADC Pin), temperature and Humidity (DHT22) is reported every 30 minutes to MQTT Broker.
If the Voltage drops below a certain value shutdown is triggered by the the ESP itself.

Everything beside the actual sensor is inside and IP67 water and dustproof case.

The HASS package is just for the state card, the mqtt sensors and some templates and a notification automation if the battery is empty (persistent and pushbullet).

Let me know what you think or what I could improve.

HASS Package:

Esphomeyaml file:

lovelace config for sensors view:


Replaced the DHT22 with a BME280. Links and config changed. Old state card replaced by the lovelace config. Increased the deep sleep time to improve battery life.


Thanks for the share, how long does it last on one charge of the battery ? all the more in winter with cold temperature ?

No valuable data yet.

The ESP draws 60mA while running (5 secs every 30 mins) and about 5mA in deepsleep. The datasheet of the battery promises no efficiency loss from -40°C to 60°C.

So I calculate with months rather than days in runtime.

Roughly how much did it cost?

Also, how does the humidity sensor read the outside humidity when it is in a (near) airtight box?

About 10 €…
If you are patient enough to wait 3-4 weeks you’ll get the boards even cheaper.

The DHT22 Sensor is outside. The wires go through a small hole in the enclosure.

1 Like

Can you share connection diagram please?

Never used Fritzing before but if it helps you I will try it out.

But nothing really complex.
I soldered a 18650 batteryholder to an M2 cable and a wire from postive to ADC Pin 34 of the ESP.
The DHT Module (DHT22 on aliexpress) is connected to +3V, GND and Data to ESP Pin 15.

would you mind sharing the components/ links you used?


ESP32: Wemos Lolin32 (https://www.ebay.de/itm/WEMOS-D1-Flash-Lolin32-4MB-CP2104-WIFI-Bluetooth-Card-ESP32-ESP-WROOM-32-Antenna/273001635570?hash=item3f902a5ef2:m:mZwRu2mHouwrh3gASYCnoFQ)
DHT22: https://www.ebay.de/itm/DS18B20-KY-015-DHT11-DHT22-AM2302-Temperatur-Feuchtigkeit-Modul-Fur-Arduino-GE/172792287432?hash=item283b3910c8:m:m5VpsyuyweWjSu_neiV-mqQ

I assume you have a breadbord, cables etc…

Any case of your choice (rated IP 67 or better)

why use vemo and not esp 8266 Half price?

simple. lower battery consumption. deep sleep and esp8266 isn’t working well.

thanks - but unfortunately i don’t have a power source, would you mind sharing yours?
and i don’t see a breadboard in your picture, where do you use it?

I got some spare 18650 Batteries lying around (in my case Sony Konion VTC5) . Every batteryholder for 18560 should do (~ 1€). You need a m2 type connector for the board (as described in the first post).

When testting is finished i will glue a breadboard to the bottom of the case

@void Can you help me? I use same configuration, but only receive change when remove battery and connect. I know that deep sleeps works because I debug it, but homeassistant doesnt change last value time.

you mean the value for the V?


Nice project indeed, I’m quite interested about for how long will it be able to work with one full charge :).

BTW, can you please share the arduino code you’re using?


now running for 30 days still with the first charge…

im running esphomelib on it with esphomeyaml https://github.com/OttoWinter/esphomeyaml

see the frist post for the configfile

This looks great! I will be giving it a try this WE if I find the time.

BTW, how weather-proof is the DHT22 supposed to be? I have used it in the past, but indoors only.

Figured out I need a different board which doesn’t use so much power - like the Wemos D32.

I’d like to know as well.