Last active
January 31, 2022 21:39
-
-
Save thushan/95da9487581412c96077daeeb802785d to your computer and use it in GitHub Desktop.
ESPHome configuration for M5Stack's AtomLite + ENV-II *SHT30 / BMP280* Sensor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
device_name: atomlite-outdoor-sensor | |
friendly_name: "Outdoor Sensor" | |
device_description: "Detects ambient temperature and pressure." | |
esphome: | |
name: ${device_name} | |
comment: ${device_description} | |
esp32: | |
board: m5stack-core-esp32 | |
framework: | |
type: arduino | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: ${friendly_name} | |
password: !secret fallback_wifi_password | |
captive_portal: | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
password: !secret esp32_secret | |
ota: | |
password: !secret esp32_secret | |
i2c: | |
sda: 26 | |
scl: 32 | |
scan: True | |
id: bus_a | |
text_sensor: | |
- platform: version | |
name: "Version" | |
sensor: | |
- platform: uptime | |
name: "Uptime" | |
- platform: wifi_signal | |
name: "WiFi Signal" | |
update_interval: 60s | |
## | |
# M5Stack ENV II | |
# https://m5stack-store.myshopify.com/products/env-ii-unit | |
# https://docs.m5stack.com/#/en/unit/envII?id=comparison-between-sht30-and-dht12 | |
## | |
## | |
# SHT30 | |
# https://esphome.io/components/sensor/sht3xd.html | |
- platform: sht3xd | |
temperature: | |
name: "SHT30 Temperature" | |
humidity: | |
name: "SHT30 Humidity" | |
id: sht30_humidity | |
address: 0x44 | |
update_interval: 60s | |
## | |
# BMP280 | |
# https://esphome.io/components/sensor/bmp280.html?highlight=bmp280 | |
- platform: bmp280 | |
temperature: | |
name: "BMP280 Temperature" | |
id: bme280_temperature | |
oversampling: 16x | |
pressure: | |
name: "BMP280 Pressure" | |
id: bme280_pressure | |
address: 0x76 | |
update_interval: 60s | |
# https://esphome.io/cookbook/bme280_environment.html | |
- platform: template | |
name: "Altitude" | |
lambda: |- | |
const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note | |
return ((id(bme280_temperature).state + 273.15) / 0.0065) * | |
(powf((STANDARD_SEA_LEVEL_PRESSURE / id(bme280_pressure).state), 0.190234) - 1); // in meter | |
update_interval: 60s | |
icon: 'mdi:signal' | |
unit_of_measurement: 'm' | |
- platform: template | |
name: "Absolute Humidity" | |
lambda: |- | |
const float mw = 18.01534; // molar mass of water g/mol | |
const float r = 8.31447215; // Universal gas constant J/mol/K | |
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / | |
(id(bme280_temperature).state + 243.5)) * id(sht30_humidity).state * mw) / | |
((273.15 + id(bme280_temperature).state) * r); // in grams/m^3 | |
accuracy_decimals: 2 | |
update_interval: 60s | |
icon: 'mdi:water' | |
unit_of_measurement: 'g/m³' | |
- platform: template | |
name: "Dew Point" | |
lambda: |- | |
return (243.5*(log(id(sht30_humidity).state/100)+((17.67*id(bme280_temperature).state)/ | |
(243.5+id(bme280_temperature).state)))/(17.67-log(id(sht30_humidity).state/100)- | |
((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state)))); | |
unit_of_measurement: °C | |
icon: 'mdi:thermometer-alert' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment