ESP8266 - bme680_bsec no sensor values after 24-48hours

Hello, first of all, thank you so much for that ESPHome thank you for the project and all those who are involved in it. I have set up a few sensors and i think the project is brilliant!

I currently have four sensors based on an ESP8266 / wemos (different types and hardware revisions). Three of them are running without any problems so far (with 1-wire/ds18B20, analog-in and BME280). A newly installed one with BME680 (bme680_bsec) initially runs without problems and as desired, but then after 24-48 hours no longer delivers any values from the BME680. Analogue-In and Binary-In continue to work without problems, and the sensor is still accessible and responsive. Values from the BME680 only come back after a hard reset (disconnection from the power supply for a few seconds). In the meantime, I have tested 3 different power sources with which all other sensors run without problems.

As error I receive

[E][bme680_bsec.sensor:134]: Communication failed (BSEC Status: 0, BME680 Status: -2)

from the log. BSEC Version is 1.4.8.0, sensor running under sample_rate ulp.

On this basis, does anyone already have an idea for the cause or what information or tests should i provide, if any?

Thanks!

Full config:

esphome:
  name: sensor-v2

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  # removed :-)

ota:
  # removed :-)

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  # removed :-)

i2c:
  sda: GPIO12 #D6
  scl: GPIO14 #D5

bme680_bsec:
  address: 0x77
  sample_rate: ulp

sensor:
  - platform: adc
    pin: A0
    name: "Ost EG AZi Brightness2"
    update_interval: 60s
    filters:
    - lambda: return x * (100);
    unit_of_measurement: "%"
    accuracy_decimals: 0
  - platform: bme680_bsec
    temperature:
      name: "BME680 Temperature"
      #oversampling: 16x
    pressure:
      name: "BME680 Pressure"
    humidity:
      name: "BME680 Humidity"
    gas_resistance:
      name: "BME680 Gas Resistance"
    iaq:
      name: "BME680 IAQ"
    co2_equivalent:
      name: "BME680 CO2 Equivalent"
    breath_voc_equivalent:
      name: "BME680 Breath VOC Equivalent"      
    
    #update_interval: 60s

text_sensor:
  - platform: bme680_bsec
    iaq_accuracy:
      name: "BME680 IAQ Accuracy"

binary_sensor:
  - platform: gpio
    pin: GPIO16 #D0
    name: "PIR Sensor"
    device_class: motion

captive_portal:

Full log:

INFO Reading configuration /config/esphome/sensor-v2.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing sensor-v2 (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- ESPAsyncTCP-esphome @ 1.2.3
|   |-- Hash @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|   |-- libsodium @ 1.10018.1
|-- Wire @ 1.0
|-- SPI @ 1.0
|-- BSEC Software Library @ 1.6.1480
Compiling /data/sensor-v2/.pioenvs/sensor-v2/src/esphome/components/api/api_connection.cpp.o
Compiling /data/sensor-v2/.pioenvs/sensor-v2/src/esphome/components/api/api_server.cpp.o
Compiling /data/sensor-v2/.pioenvs/sensor-v2/src/esphome/components/mdns/mdns_component.cpp.o
Compiling /data/sensor-v2/.pioenvs/sensor-v2/src/esphome/core/application.cpp.o
Compiling /data/sensor-v2/.pioenvs/sensor-v2/src/esphome/core/util.cpp.o
Compiling /data/sensor-v2/.pioenvs/sensor-v2/src/main.cpp.o
Linking /data/sensor-v2/.pioenvs/sensor-v2/firmware.elf
RAM:   [=====     ]  49.1% (used 40204 bytes from 81920 bytes)
Flash: [=====     ]  53.4% (used 546733 bytes from 1023984 bytes)
Building /data/sensor-v2/.pioenvs/sensor-v2/firmware.bin
esp8266_copy_factory_bin(["/data/sensor-v2/.pioenvs/sensor-v2/firmware.bin"], ["/data/sensor-v2/.pioenvs/sensor-v2/firmware.elf"])
========================= [SUCCESS] Took 15.74 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of sensor-v2.local
INFO  -> 192.168.1.146
INFO Uploading /data/sensor-v2/.pioenvs/sensor-v2/firmware.bin (550880 bytes)
INFO Compressed to 383579 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from sensor-v2.local using esphome API
WARNING Can't connect to ESPHome API for sensor-v2.local: Timeout while connecting to ('192.168.1.146', 6053)
INFO Trying to reconnect to sensor-v2.local in the background
INFO Successfully connected to sensor-v2.local
[17:45:45][I][app:102]: ESPHome version 2022.10.2 compiled on Nov  5 2022, 17:43:52
[17:45:45][C][wifi:502]: WiFi:
[17:45:45][C][wifi:360]:   Local MAC: 2C:3A:E8:42:37:0A
[17:45:45][C][wifi:361]:   SSID: 'wlan-oqg33z3R'[redacted]
[17:45:45][C][wifi:362]:   IP Address: 192.168.1.146
[17:45:45][C][wifi:363]:   BSSID: F6:9F:C2:CC:F4:15[redacted]
[17:45:45][C][wifi:365]:   Hostname: 'sensor-v2'
[17:45:45][C][wifi:367]:   Signal strength: -69 dB ▂▄▆█
[17:45:45][C][wifi:371]:   Channel: 6
[17:45:45][C][wifi:372]:   Subnet: 255.255.255.0
[17:45:45][C][wifi:373]:   Gateway: 192.168.1.1
[17:45:45][C][wifi:374]:   DNS1: 192.168.1.1
[17:45:45][C][wifi:375]:   DNS2: 0.0.0.0
[17:45:45][C][logger:275]: Logger:
[17:45:45][C][logger:276]:   Level: DEBUG
[17:45:45][C][logger:277]:   Log Baud Rate: 115200
[17:45:45][C][logger:278]:   Hardware UART: UART0
[17:45:45][C][i2c.arduino:038]: I2C Bus:
[17:45:45][C][i2c.arduino:039]:   SDA Pin: GPIO12
[17:45:45][C][i2c.arduino:040]:   SCL Pin: GPIO14
[17:45:45][C][i2c.arduino:041]:   Frequency: 50000 Hz
[17:45:45][C][i2c.arduino:044]:   Recovery: bus successfully recovered
[17:45:45][I][i2c.arduino:054]: Results from i2c bus scan:
[17:45:45][I][i2c.arduino:056]: Found no i2c devices!
[17:45:45][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'PIR Sensor'
[17:45:45][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[17:45:45][C][gpio.binary_sensor:016]:   Pin: GPIO16
[17:45:45][C][bme680_bsec.sensor:124]: BME680 via BSEC:
[17:45:45][C][bme680_bsec.sensor:128]:   BSEC Version: 1.4.8.0
[17:45:45][C][bme680_bsec.sensor:131]:   Address: 0x77
[17:45:45][E][bme680_bsec.sensor:134]: Communication failed (BSEC Status: 0, BME680 Status: -2)
[17:45:45][C][bme680_bsec.sensor:138]:   Temperature Offset: 0.00
[17:45:45][C][bme680_bsec.sensor:139]:   IAQ Mode: Static
[17:45:45][C][bme680_bsec.sensor:140]:   Sample Rate: ULP
[17:45:45][C][bme680_bsec.sensor:141]:   State Save Interval: 21600000ms
[17:45:45][C][bme680_bsec.sensor:143]:   Temperature 'BME680 Temperature'
[17:45:45][C][bme680_bsec.sensor:143]:     Device Class: 'temperature'
[17:45:45][C][bme680_bsec.sensor:143]:     State Class: 'measurement'
[17:45:45][C][bme680_bsec.sensor:143]:     Unit of Measurement: '°C'
[17:45:45][C][bme680_bsec.sensor:143]:     Accuracy Decimals: 1
[17:45:45][C][bme680_bsec.sensor:143]:     Icon: 'mdi:thermometer'
[17:45:45][C][bme680_bsec.sensor:144]:     Sample Rate: Default
[17:45:45][C][bme680_bsec.sensor:145]:   Pressure 'BME680 Pressure'
[17:45:45][C][bme680_bsec.sensor:145]:     Device Class: 'pressure'
[17:45:45][C][bme680_bsec.sensor:145]:     State Class: 'measurement'
[17:45:45][C][bme680_bsec.sensor:145]:     Unit of Measurement: 'hPa'
[17:45:45][C][bme680_bsec.sensor:145]:     Accuracy Decimals: 1
[17:45:45][C][bme680_bsec.sensor:145]:     Icon: 'mdi:gauge'
[17:45:45][C][bme680_bsec.sensor:146]:     Sample Rate: Default
[17:45:45][C][bme680_bsec.sensor:147]:   Humidity 'BME680 Humidity'
[17:45:45][C][bme680_bsec.sensor:147]:     Device Class: 'humidity'
[17:45:45][C][bme680_bsec.sensor:147]:     State Class: 'measurement'
[17:45:45][C][bme680_bsec.sensor:147]:     Unit of Measurement: '%'
[17:45:45][C][bme680_bsec.sensor:147]:     Accuracy Decimals: 1
[17:45:45][C][bme680_bsec.sensor:147]:     Icon: 'mdi:water-percent'
[17:45:45][C][bme680_bsec.sensor:148]:     Sample Rate: Default
[17:45:45][C][bme680_bsec.sensor:149]:   Gas Resistance 'BME680 Gas Resistance'
[17:45:45][C][bme680_bsec.sensor:149]:     State Class: 'measurement'
[17:45:45][C][bme680_bsec.sensor:149]:     Unit of Measurement: 'Ω'
[17:45:45][C][bme680_bsec.sensor:149]:     Accuracy Decimals: 0
[17:45:45][C][bme680_bsec.sensor:149]:     Icon: 'mdi:gas-cylinder'
[17:45:45][C][bme680_bsec.sensor:150]:   IAQ 'BME680 IAQ'
[17:45:45][C][bme680_bsec.sensor:150]:     State Class: 'measurement'
[17:45:45][C][bme680_bsec.sensor:150]:     Unit of Measurement: 'IAQ'
[17:45:45][C][bme680_bsec.sensor:150]:     Accuracy Decimals: 0
[17:45:45][C][bme680_bsec.sensor:150]:     Icon: 'mdi:gauge'
[17:45:45][C][bme680_bsec.sensor:152]:   IAQ Accuracy 'BME680 IAQ Accuracy'
[17:45:45][C][bme680_bsec.sensor:152]:     Icon: 'mdi:checkbox-marked-circle-outline'
[17:45:45][C][bme680_bsec.sensor:153]:   CO2 Equivalent 'BME680 CO2 Equivalent'
[17:45:45][C][bme680_bsec.sensor:153]:     State Class: 'measurement'
[17:45:45][C][bme680_bsec.sensor:153]:     Unit of Measurement: 'ppm'
[17:45:45][C][bme680_bsec.sensor:153]:     Accuracy Decimals: 1
[17:45:45][C][bme680_bsec.sensor:153]:     Icon: 'mdi:test-tube'
[17:45:45][C][bme680_bsec.sensor:154]:   Breath VOC Equivalent 'BME680 Breath VOC Equivalent'
[17:45:45][C][bme680_bsec.sensor:154]:     State Class: 'measurement'
[17:45:45][C][bme680_bsec.sensor:154]:     Unit of Measurement: 'ppm'
[17:45:45][C][bme680_bsec.sensor:154]:     Accuracy Decimals: 1
[17:45:45][C][bme680_bsec.sensor:154]:     Icon: 'mdi:test-tube'
[17:45:45][C][adc:069]: ADC Sensor 'Ost EG AZi Brightness2'
[17:45:45][C][adc:069]:   Device Class: 'voltage'
[17:45:45][C][adc:069]:   State Class: 'measurement'
[17:45:45][C][adc:069]:   Unit of Measurement: '%'
[17:45:45][C][adc:069]:   Accuracy Decimals: 0
[17:45:45][C][adc:074]:   Pin: GPIO17
[17:45:45][C][adc:101]:   Update Interval: 60.0s
[17:45:45][C][captive_portal:088]: Captive Portal:
[17:45:45][C][mdns:100]: mDNS:
[17:45:45][C][mdns:101]:   Hostname: sensor-v2
[17:45:45][C][ota:089]: Over-The-Air Updates:
[17:45:45][C][ota:090]:   Address: sensor-v2.local:8266
[17:45:45][C][ota:093]:   Using Password.
[17:45:45][C][api:138]: API Server:
[17:45:45][C][api:139]:   Address: sensor-v2.local:6053
[17:45:45][C][api:141]:   Using noise encryption: YES
[17:45:47][D][sensor:126]: 'Ost EG AZi Brightness2': Sending state 17.28516 % with 0 decimals of accuracy

Hello.

I have the same problem Communication failed (BSEC Status: 0, BME680 Status: -2)

Did you manage to fix it?

Hi, please try run with the logging at VERY_VERBOSE and give us the output once the device fails again?

# Enable logging
logger:
  # level: DEBUG
  level: VERY_VERBOSE

I have the same problem with the same code.

Log output with VERY_VERBOSE as requested:

[23:58:52][I][app:102]: ESPHome version 2023.2.4 compiled on Mar 12 2023, 23:56:21
[23:58:52][C][wifi:504]: WiFi:
[23:58:52][C][wifi:362]:   Local MAC: 30:83:98:A9:F7:79
[23:58:52][C][wifi:363]:   SSID: 'JAGWS'[redacted]
[23:58:52][C][wifi:364]:   IP Address: 192.168.1.119
[23:58:52][C][wifi:365]:   BSSID: 60:22:32:2C:DB:FE[redacted]
[23:58:52][C][wifi:367]:   Hostname: 'wemos-d1-bme680'
[23:58:52][C][wifi:369]:   Signal strength: -69 dB ▂▄▆█
[23:58:52][V][wifi:371]:   Priority: 0.0
[23:58:52][C][wifi:373]:   Channel: 1
[23:58:52][C][wifi:374]:   Subnet: 255.255.255.0
[23:58:52][C][wifi:375]:   Gateway: 192.168.1.1
[23:58:52][C][wifi:376]:   DNS1: 192.168.1.1
[23:58:52][C][wifi:377]:   DNS2: 0.0.0.0
[23:58:52][C][logger:293]: Logger:
[23:58:52][C][logger:294]:   Level: VERY_VERBOSE
[23:58:52][C][logger:295]:   Log Baud Rate: 115200
[23:58:52][C][logger:296]:   Hardware UART: UART0
[23:58:52][C][i2c.arduino:052]: I2C Bus:
[23:58:53][C][i2c.arduino:053]:   SDA Pin: GPIO4
[23:58:53][C][i2c.arduino:054]:   SCL Pin: GPIO5
[23:58:53][C][i2c.arduino:055]:   Frequency: 50000 Hz
[23:58:53][C][i2c.arduino:058]:   Recovery: bus successfully recovered
[23:58:53][I][i2c.arduino:068]: Results from i2c bus scan:
[23:58:53][I][i2c.arduino:074]: Found i2c device at address 0x77
[23:58:53][C][bme680_bsec.sensor:124]: BME680 via BSEC:
[23:58:53][C][bme680_bsec.sensor:128]:   BSEC Version: 1.4.8.0
[23:58:53][C][bme680_bsec.sensor:131]:   Address: 0x76
[23:58:53][E][bme680_bsec.sensor:134]: Communication failed (BSEC Status: 0, BME680 Status: -2)
[23:58:53][C][bme680_bsec.sensor:138]:   Temperature Offset: 0.00
[23:58:53][C][bme680_bsec.sensor:139]:   IAQ Mode: Static
[23:58:53][C][bme680_bsec.sensor:140]:   Sample Rate: LP
[23:58:53][C][bme680_bsec.sensor:141]:   State Save Interval: 3600000ms
[23:58:53][C][bme680_bsec.sensor:143]:   Temperature 'BME680 Temperature'
[23:58:53][C][bme680_bsec.sensor:143]:     Device Class: 'temperature'
[23:58:53][C][bme680_bsec.sensor:143]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:143]:     Unit of Measurement: '°C'
[23:58:53][C][bme680_bsec.sensor:143]:     Accuracy Decimals: 1
[23:58:53][C][bme680_bsec.sensor:143]:     Icon: 'mdi:thermometer'
[23:58:53][C][bme680_bsec.sensor:144]:     Sample Rate: LP
[23:58:53][C][bme680_bsec.sensor:145]:   Pressure 'BME680 Pressure'
[23:58:53][C][bme680_bsec.sensor:145]:     Device Class: 'pressure'
[23:58:53][C][bme680_bsec.sensor:145]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:145]:     Unit of Measurement: 'hPa'
[23:58:53][C][bme680_bsec.sensor:145]:     Accuracy Decimals: 1
[23:58:53][C][bme680_bsec.sensor:145]:     Icon: 'mdi:gauge'
[23:58:53][C][bme680_bsec.sensor:146]:     Sample Rate: LP
[23:58:53][C][bme680_bsec.sensor:147]:   Humidity 'BME680 Humidity'
[23:58:53][C][bme680_bsec.sensor:147]:     Device Class: 'humidity'
[23:58:53][C][bme680_bsec.sensor:147]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:147]:     Unit of Measurement: '%'
[23:58:53][C][bme680_bsec.sensor:147]:     Accuracy Decimals: 1
[23:58:53][C][bme680_bsec.sensor:147]:     Icon: 'mdi:water-percent'
[23:58:53][C][bme680_bsec.sensor:148]:     Sample Rate: LP
[23:58:53][C][bme680_bsec.sensor:149]:   Gas Resistance 'BME680 Gas Resistance'
[23:58:53][C][bme680_bsec.sensor:149]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:149]:     Unit of Measurement: 'Ω'
[23:58:53][C][bme680_bsec.sensor:149]:     Accuracy Decimals: 0
[23:58:53][C][bme680_bsec.sensor:149]:     Icon: 'mdi:gas-cylinder'
[23:58:53][C][bme680_bsec.sensor:150]:   IAQ 'BME680 IAQ'
[23:58:53][C][bme680_bsec.sensor:150]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:150]:     Unit of Measurement: 'IAQ'
[23:58:53][C][bme680_bsec.sensor:150]:     Accuracy Decimals: 0
[23:58:53][C][bme680_bsec.sensor:150]:     Icon: 'mdi:gauge'
[23:58:53][C][bme680_bsec.sensor:151]:   Numeric IAQ Accuracy 'BME680 Numeric IAQ Accuracy'
[23:58:53][C][bme680_bsec.sensor:151]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:151]:     Unit of Measurement: ''
[23:58:53][C][bme680_bsec.sensor:151]:     Accuracy Decimals: 0
[23:58:53][C][bme680_bsec.sensor:151]:     Icon: 'mdi:checkbox-marked-circle-outline'
[23:58:53][C][bme680_bsec.sensor:152]:   IAQ Accuracy 'BME680 IAQ Accuracy'
[23:58:53][C][bme680_bsec.sensor:152]:     Icon: 'mdi:checkbox-marked-circle-outline'
[23:58:53][C][bme680_bsec.sensor:153]:   CO2 Equivalent 'BME680 CO2 Equivalent'
[23:58:53][C][bme680_bsec.sensor:153]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:153]:     Unit of Measurement: 'ppm'
[23:58:53][C][bme680_bsec.sensor:153]:     Accuracy Decimals: 1
[23:58:53][C][bme680_bsec.sensor:153]:     Icon: 'mdi:test-tube'
[23:58:53][C][bme680_bsec.sensor:154]:   Breath VOC Equivalent 'BME680 Breath VOC Equivalent'
[23:58:53][C][bme680_bsec.sensor:154]:     State Class: 'measurement'
[23:58:53][C][bme680_bsec.sensor:154]:     Unit of Measurement: 'ppm'
[23:58:53][C][bme680_bsec.sensor:154]:     Accuracy Decimals: 1
[23:58:53][C][bme680_bsec.sensor:154]:     Icon: 'mdi:test-tube'
[23:58:53][C][captive_portal:088]: Captive Portal:
[23:58:53][C][mdns:108]: mDNS:
[23:58:53][C][mdns:109]:   Hostname: wemos-d1-bme680
[23:58:53][V][mdns:110]:   Services:
[23:58:53][V][mdns:112]:   - _esphomelib, _tcp, 6053
[23:58:53][V][mdns:114]:     TXT: friendly_name = Wemos D1 BME680
[23:58:53][V][mdns:114]:     TXT: version = 2023.2.4
[23:58:53][V][mdns:114]:     TXT: mac = 308398a9f779
[23:58:53][V][mdns:114]:     TXT: platform = ESP8266
[23:58:53][V][mdns:114]:     TXT: board = d1_mini_lite
[23:58:53][V][mdns:114]:     TXT: network = wifi
[23:58:53][C][ota:093]: Over-The-Air Updates:
[23:58:53][C][ota:094]:   Address: wemos-d1-bme680.local:8266
[23:58:53][C][ota:097]:   Using Password.
[23:58:53][C][api:138]: API Server:
[23:58:53][C][api:139]:   Address: wemos-d1-bme680.local:6053
[23:58:53][C][api:141]:   Using noise encryption: YES
[23:59:07][VV][api.service:470]: on_ping_request: PingRequest {}
[23:59:07][VV][api.service:043]: send_ping_response: PingResponse {}
[23:59:22][VV][api.service:470]: on_ping_request: PingRequest {}
[23:59:22][VV][api.service:043]: send_ping_response: PingResponse {}
[23:59:22][VV][scheduler:206]: Running interval '' with interval=60000 last_execution=4294965236 (now=57948)
[23:59:37][VV][api.service:470]: on_ping_request: PingRequest {}
[23:59:37][VV][api.service:043]: send_ping_response: PingResponse {}
[23:59:52][VV][api.service:470]: on_ping_request: PingRequest {}
[23:59:52][VV][api.service:043]: send_ping_response: PingResponse {}

I found this:

Similar “-2” error and duration of time where it runs until failure.
It appears to be a signalling issue which can be resolved by grounding the CS pin on the module.

i had the same issue, and found that the BSEC Library is for the Sensor i2c Adress 0x77.
(not perfect that the docs for ESPHome have Default Adress 0x76)

I solved it to changed the i2c Adress of the Sensor to 0x77 (GND PIN one time at SPO PIN, then Restart, after that you see the 0x77 in the ESPHome Logs), and change the ESPHome Adress to 0x77, then it worked for me.

2 Likes

So, do you leave CS connected to Ground? Like… actually wire ground to CS?

Do you need to do this every time the ESP and BME sensor are powered off and on! Short the pin to ground?

Hi! When I said ground, it was just another (somewhat incorrect) word for negative. You just connect negative to CS (chip-select) and try that. Hope it helps.

Yup…ground made sense too lol. Thanks man. I’ll test that out. Thanks for the follow up!