Hi. I’m having problems connecting BME280 sensor to HA vi ESP8266 and ESPHome. I’m relatively new to this, so I don’t know where to start looking for a solution.
This is my ESPHome config:
esphome:
name: esphome-web-4668b7
friendly_name: ESPHome Web 4668b7
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "YflV1B8DSL0ibto71sSGqbaYV/ztX/MiHELkzkii7jQ="
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-4668B7"
password: "i8sFl3AZZirt"
captive_portal:
i2c:
sda: 4
scl: 5
scan: true
sensor:
- platform: bme280
temperature:
name: "BME280 Temperature"
id: bme280_temperature
pressure:
name: "BME280 Pressure"
id: bme280_pressure
humidity:
name: "BME280 Relative Humidity"
id: bme280_humidity
address: 0x77
update_interval: 15s
Log file can be found here .
vincen
(Vincèn)
July 15, 2023, 2:04pm
2
Schema of wiring ? as clearly your I2C wiring is wrong according at logs
You’re absolutely correct. I’ve got it working now. Not only it was only wrong wiring, but it was also wrong sensor. Turns out it is BMP not BME . This is working config:
i2c:
sda: 4
scl: 5
scan: true
sensor:
- platform: bmp280
temperature:
name: "BMP280 Temperature"
id: bmp280_temperature
pressure:
name: "BMP280 Pressure"
id: bmp280_pressure
# humidity:
# name: "BME280 Relative Humidity"
# id: bme280_humidity
address: 0x76
update_interval: 15s
- platform: template
name: "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'
Wiring:
SCL -> GPIO5 (D1)
SDA -> GPIO4 (D2)
GND -> G
VIN -> 3V
P.S. Nice JR on your avatar picture. I have 3 short haired females. Best doggos in the world!
vincen
(Vincèn)
July 15, 2023, 2:31pm
4
Perfect
héhé yeah here it’s Camino (laying under my desk right now while working, he is fantastic