Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wemos Attic Environmental Monitor

Firmware for a Wemos D1 mini (ESP8266) with an Adafruit SHT40 and up to three DS18B20 temperature probes. Its MQTT and Home Assistant conventions follow the feather-esp32s3-solar-wx-station project: retained status and device inventory, non-retained JSON state, and retained Home Assistant discovery.

Initial release: v0.1.0

Wiring

Adafruit SHT40 over STEMMA QT / Qwiic (I2C)

SHT40 Wemos D1 mini ESP8266 GPIO
VIN 3V3 —
GND G —
SDA D2 GPIO4
SCL D1 GPIO5

STEMMA QT and Qwiic both carry I2C, but verify the cable's wire order if mixing connector brands. Power this sensor from 3.3 V.

Three DS18B20 probes (one shared 1-Wire bus)

DS18B20 wire Wemos D1 mini
VDD, normally red 3V3
GND, normally black G
DATA, normally yellow/white D5 / GPIO14

Connect all three probes in parallel. Add one 4.7 kΩ pull-up resistor between DATA and 3V3 near the Wemos. Use normal three-wire powered mode rather than parasite power. Probe cable colors are not standardized, so confirm them from the probe vendor.

The Wemos D1 mini uses 3.3 V logic. Do not put 5 V on D1, D2, or D5.

Configure and upload

  1. Install PlatformIO in VS Code or use PlatformIO Core.
  2. Copy include/secrets.example.h to include/secrets.h.
  3. Enter the Wi-Fi and MQTT settings in include/secrets.h.
  4. Optionally change MQTT_BASE_TOPIC, reporting interval, or probe names in include/config.h.
  5. Connect the Wemos by USB and run pio run --target upload.
  6. View startup and readings with pio device monitor.

Home Assistant MQTT discovery must be enabled. The device uses these topics:

Purpose Topic Retained
State sensors/attic01/environment/state No
Availability/LWT sensors/attic01/environment/status Yes
Device inventory sensors/attic01/environment/device_info Yes
Device inventory status sensors/attic01/environment/device/availability Yes
Discovery homeassistant/sensor/attic01_environment_*/config Yes

Identifying the DS18B20 probes

On startup, the serial monitor prints each probe's unique 16-character ROM address. The firmware sorts these addresses so Air Handler Probe 1, 2, and 3 remain stable across restarts. Before permanently mounting them:

  1. Connect all probes and note the three serial addresses.
  2. Warm one probe by hand while watching MQTT or Home Assistant.
  3. Label that physical probe with its entity number.
  4. Repeat for the other two probes.

If a probe is replaced with a different ROM address, re-identify the physical ordering. To use location-specific names such as “Return Air” or “Supply Air,” edit DS18B20_NAMES in include/config.h before uploading.

MQTT state example

{
  "attic_temperature": 31.42,
  "attic_humidity": 58.17,
  "air_handler_1": 19.31,
  "air_handler_2": 14.88,
  "air_handler_3": 24.56,
  "rssi": -57,
  "uptime_seconds": 3600
}

Temperatures are reported in Celsius; Home Assistant can display them in the unit configured for the system.

About

Sensor package using an SHT40 sensor and DS18B20 probes

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages