2022-12-10 16:12:55 +01:00
|
|
|
# Send sensor data To Home Assistant
|
2020-12-29 19:35:59 +01:00
|
|
|
|
2022-12-10 16:12:55 +01:00
|
|
|
Publishes BMP280, CCS811 and Si7021 measurements to Home Assistant via MQTT.
|
2020-12-29 19:35:59 +01:00
|
|
|
|
2022-12-10 16:12:55 +01:00
|
|
|
Uses Home Assistant Automatic Device Discovery.
|
2020-12-29 19:35:59 +01:00
|
|
|
|
2022-12-10 16:12:55 +01:00
|
|
|
The use of Home Assistant is not mandatory. The mod will publish sensor values via MQTT just fine without it.
|
2020-12-29 19:35:59 +01:00
|
|
|
|
2022-12-10 16:12:55 +01:00
|
|
|
Uses the MQTT connection set in the WLED web user interface.
|
2020-12-29 19:35:59 +01:00
|
|
|
|
|
|
|
## Maintainer
|
|
|
|
|
|
|
|
twitter.com/mpronk89
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
- Reads BMP280, CCS811 and Si7021 senors
|
2022-12-10 16:12:55 +01:00
|
|
|
- Publishes via MQTT, configured via WLED webUI
|
2020-12-29 19:35:59 +01:00
|
|
|
- Announces device in Home Assistant for easy setup
|
|
|
|
- Efficient energy usage
|
|
|
|
- Updates every 60 seconds
|
|
|
|
|
2022-12-10 16:12:55 +01:00
|
|
|
## Example MQTT topics:
|
2020-12-29 19:35:59 +01:00
|
|
|
|
|
|
|
`$mqttDeviceTopic` is set in webui of WLED!
|
|
|
|
|
|
|
|
```
|
|
|
|
temperature: $mqttDeviceTopic/temperature
|
|
|
|
pressure: $mqttDeviceTopic/pressure
|
|
|
|
humidity: $mqttDeviceTopic/humidity
|
|
|
|
tvoc: $mqttDeviceTopic/tvoc
|
|
|
|
eCO2: $mqttDeviceTopic/eco2
|
|
|
|
IAQ: $mqttDeviceTopic/iaq
|
|
|
|
```
|
|
|
|
|
|
|
|
# Installation
|
|
|
|
|
|
|
|
## Hardware
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
|
|
1. BMP280/CCS811/Si7021 sensor. E.g. https://aliexpress.com/item/32979998543.html
|
2022-12-10 16:12:55 +01:00
|
|
|
2. A microcontroller that supports i2c. e.g. esp32
|
2020-12-29 19:35:59 +01:00
|
|
|
|
|
|
|
### installation
|
|
|
|
|
|
|
|
Attach the sensor to the i2c interface.
|
|
|
|
|
|
|
|
Default PINs esp32:
|
|
|
|
|
|
|
|
```
|
|
|
|
SCL_PIN = 22;
|
|
|
|
SDA_PIN = 21;
|
|
|
|
```
|
|
|
|
|
|
|
|
Default PINs ESP8266:
|
|
|
|
|
|
|
|
```
|
|
|
|
SCL_PIN = 5;
|
|
|
|
SDA_PIN = 4;
|
|
|
|
```
|
|
|
|
|
|
|
|
## Enable in WLED
|
|
|
|
|
|
|
|
1. Copy `usermod_v2_SensorsToMqtt.h` into the `wled00` directory.
|
|
|
|
2. Add to `build_flags` in platformio.ini:
|
|
|
|
|
|
|
|
```
|
|
|
|
-D USERMOD_SENSORSTOMQTT
|
|
|
|
```
|
|
|
|
|
|
|
|
3. And add to `lib_deps` in platformio.ini:
|
|
|
|
|
|
|
|
```
|
|
|
|
adafruit/Adafruit BMP280 Library @ 2.1.0
|
|
|
|
adafruit/Adafruit CCS811 Library @ 1.0.4
|
|
|
|
adafruit/Adafruit Si7021 Library @ 1.4.0
|
|
|
|
```
|
|
|
|
|
2022-12-10 16:12:55 +01:00
|
|
|
The #ifdefs in `usermods_list.cpp` should do the rest
|
2020-12-29 19:35:59 +01:00
|
|
|
|
|
|
|
# Credits
|
|
|
|
|
|
|
|
- Aircoookie for making WLED
|
|
|
|
- Other usermod creators for example code
|
|
|
|
- Bouke_Regnerus for https://community.home-assistant.io/t/example-indoor-air-quality-text-sensor-using-ccs811-sensor/125854
|
|
|
|
- You, for reading this
|