No description
- C++ 100%
|
|
||
|---|---|---|
| include | ||
| src | ||
| .gitignore | ||
| platformio.ini | ||
| README.md | ||
esp8266-TempAndHumid
PlatformIO project for ESP8266 (Wemos D1 Mini) reading DHT22 (temp/humidity) and DS18B20 (temp), publishing over MQTT with Home Assistant MQTT Discovery.
Wiring
- DHT22 data → D4 (GPIO2), needs 10k pull-up to 3V3
- DS18B20 data → D5 (GPIO14), needs 4.7k pull-up to 3V3
Pins configurable in include/config.h.
Setup
cp include/config.h.example include/config.h- Edit
include/config.h— WiFi SSID/password, MQTT broker host/port/credentials, device name. pio run -t upload
Behavior
- Connects WiFi, connects MQTT with LWT on
<device>/status(online/offline). - Publishes HA discovery configs to
homeassistant/sensor/<device>_<sensor>/configon connect. - Publishes sensor state every
PUBLISH_INTERVAL_MS(default 30s) to<device>/sensor/<sensor>/state. - Sensors auto-appear in Home Assistant under a device named
<device>— no manual YAML needed.
Board
Default env d1_mini in platformio.ini. Change board = for other ESP8266 modules (e.g. nodemcuv2, esp01_1m).