This time we will use a BMP280 for temperature and air pressure.
As usual, connect SDA / SCL / VCC and ground to the adequate pins of your D1 mini
Next program firmware in Home Assistant, using ESPHome. You need the following lines :
sensor:
- platform: bmp280
temperature:
name: "BMP280 Temperature"
id: bmp280_temperature
pressure:
name: "BMP280 Pressure"
id: bmp280_pressure
address: 0x76
update_interval: 15s
- platform: template
name: "BMP280 Altitude"
lambda: |-
const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
return ((id(bmp280_temperature).state + 273.15) / 0.0065) *
(powf((STANDARD_SEA_LEVEL_PRESSURE / id(bmp280_pressure).state), 0.190234) - 1); // in meter
update_interval: 15s
icon: 'mdi:signal'
unit_of_measurement: 'm'
That’s all, you’re ready to use this values on your automations.
Leave a Reply