Silas Mariusz

rm -rf /
Help us, GOD!
Apr 5, 2008
10,210
31
2,315
153
39
Nowy Sącz
forum.qnap.net.pl
QNAP
TS-x77
Ethernet
1 GbE
Wybrane odczytyPełne odczyty z obydwu czujników
1684770507311.png
1684770468161.png

266-BME680-Environmental-Sensor-Wiring-Diagram-I2C.png


Czujnik BME680:
I2C WiringESP NodeMCU Pinout
SCLD1
SDAD2
VIN3V
GNDG

Warianty komunikatów:
IAQ (Jakość powietrza)Opis
<= 50Wspaniała
>= 51 && <= 100Dobra
>= 101 && <= 150Lekko zanieczyszczone
>= 151 && <= 200Średnio zanieczyszczone
>= 201 && <= 250Bardzo zanieczyszczone
>= 251 && <= 350Silnie zanieczyszczone
>= 351Ekstremalnie zanieczyszczone

Klasyfikacja CO2Opis
<= 5Etan
>= 6 && <= 10Izopren lub Etanol
>= 11 && <= 25Tlenek węgla (czad)
>= 26 && <= 99Aceton
>= 100 && <= 199Dla bezpieczeństwa przewietrz
>= 200 && <= 600Bardzo dobre
>= 601 && <= 1000Dobre
>= 1001 && <= 1400Akceptowalne
>= 1401 && <= 5000Należy przewietrzyć pomieszczenie
>= 5000Osiągnięto próg bezpieczeństwa CO2

Kod dla ESPhome
Code:
esphome:
  name: bme680
  friendly_name: BME680
esp8266:
  board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
  encryption:
    key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
ota:
  password: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
wifi:
  ssid: "MY_WIFI_NETWORKl"
  password: "12345678"
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-BME680"
    password: "12345678"
captive_portal:
i2c:
  sda: D2
  scl: D1
  scan: True
  id: bus_a
bme680_bsec:
  i2c_id: bus_a
  # Temperature offset
  # ------------------
  # Useful if device is in enclosure and reads too high
  # For example, if it reads 5C too high, set this to 5
  # This also corrects the relative humidity readings
  # Default: 0
  temperature_offset: 3
sensor:
  - platform: bme680_bsec
    temperature:
      name: "BME680 Temperature"
      id: bme680_temperature
      filters:
        - median
    pressure:
      name: "BME680 Pressure"
      id: bme680_pressure
      filters:
        - median
    humidity:
      name: "BME680 Humidity"
      id: bme680_humidity
      filters:
        - median
    gas_resistance:
      name: "BME680 Gas Resistance"
      id: bme680_gas_resistance
      filters:
        - median
    iaq:
      name: "BME680 IAQ"
      id: iaq
      filters:
        - median
    iaq_accuracy:
      # IAQ accuracy as a numeric value of 0, 1, 2, 3
      name: "BME680 Numeric IAQ Accuracy"
    co2_equivalent:
      name: "BME680 CO2 Equivalent"
      id: co2_equivalent
      filters:
        - median
    breath_voc_equivalent:
      name: "BME680 Breath VOC Equivalent"
      filters:
        - median
  - platform: template
    name: "BME680 Altitude"
    lambda: |-
      const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
      return ((id(bme680_temperature).state + 273.15) / 0.0065) *
        (powf((STANDARD_SEA_LEVEL_PRESSURE / id(bme680_pressure).state), 0.190234) - 1); // in meter
    update_interval: 15s
    icon: 'mdi:signal'
    unit_of_measurement: 'm'
  - platform: absolute_humidity
    name: "BME680 Absolute Humidity"
    temperature: bme680_temperature
    humidity: bme680_humidity
  - platform: template
    name: "BME680 Dew Point"
    lambda: |-
      return (243.5*(log(id(bme680_humidity).state/100)+((17.67*id(bme680_temperature).state)/
      (243.5+id(bme680_temperature).state)))/(17.67-log(id(bme680_humidity).state/100)-
      ((17.67*id(bme680_temperature).state)/(243.5+id(bme680_temperature).state))));
    unit_of_measurement: °C
    icon: 'mdi:thermometer-alert'
  - platform: template
    name: "BME680 Equivalent sea level pressure"
    lambda: |-
      const float STANDARD_ALTITUDE = 0.6; // in meters, see note
      return id(bme680_pressure).state / powf(1 - ((0.0065 * STANDARD_ALTITUDE) /
        (id(bme680_temperature).state + (0.0065 * STANDARD_ALTITUDE) + 273.15)), 5.257); // in hPa
    update_interval: 15s
    unit_of_measurement: 'hPa'
text_sensor:
  - platform: bme680_bsec
    iaq_accuracy:
      name: "BME680 IAQ Accuracy"

  - platform: template
    name: "BME680 IAQ Classification"
    icon: "mdi:checkbox-marked-circle-outline"
    lambda: |-
      if ( int(id(iaq).state) <= 50) {
        return {"Wspaniałe powietrze"};
      }
      else if (int(id(iaq).state) >= 51 && int(id(iaq).state) <= 100) {
        return {"Dobra"};
      }
      else if (int(id(iaq).state) >= 101 && int(id(iaq).state) <= 150) {
        return {"Lekko niezdatne"};
      }
      else if (int(id(iaq).state) >= 151 && int(id(iaq).state) <= 200) {
        return {"Średnio niezdatne"};
      }
      else if (int(id(iaq).state) >= 201 && int(id(iaq).state) <= 250) {
        return {"Bardzo niezdatne"};
      }
      else if (int(id(iaq).state) >= 251 && int(id(iaq).state) <= 350) {
        return {"Silnie niezdatne"};
      }
      else if (int(id(iaq).state) >= 351) {
        return {"Ekstremalnie niezdatne"};
      }
      else {
        return {"error"};
      }
  - platform: template
    name: "BME680 Resistane Classification"
    icon: "mdi:periodic-table-co2"
    lambda: |-
      if ( int(id(bme680_gas_resistance).state) <= 7) {
        return {"UWAGA: Etan"};
      }
      else if (int(id(bme680_gas_resistance).state) >= 8 && int(id(bme680_gas_resistance).state) <= 12) {
        return {"UWAGA: Izopren lub Etanol"};
      }
      else if (int(id(bme680_gas_resistance).state) >= 13 && int(id(bme680_gas_resistance).state) <= 30) {
        return {"UWAGA: Tlenek węgla (czad)"};
      }
      else if (int(id(bme680_gas_resistance).state) >= 31 && int(id(bme680_gas_resistance).state) <= 100) {
        return {"UWAGA: Aceton"};
      }
        else if (int(id(bme680_gas_resistance).state) >= 101) {
        return {"Brak wycieku gazu"};
      }
      else {
        return {"error"};
      }
  - platform: template
    name: "BME680 Effect on health"
    icon: "mdi:periodic-table-co2"
    lambda: |-
      if ( int(id(co2_equivalent).state) <= 1499) {
        return {"Znakomite powietrze"};
      }
      else if (int(id(co2_equivalent).state) >= 1500 && int(id(bme680_gas_resistance).state) <= 2499) {
        return {"Problemy z koncentracją"};
      }
      else if (int(id(co2_equivalent).state) >= 2500 && int(id(co2_equivalent).state) <= 3499) {
        return {"Uczucie zmęczenia"};
      }
      else if (int(id(bme680_gas_resistance).state) >= 3499) {
        return {"Negatywny wpływ na zdrowie!"};
      }
      else {
        return {"error"};
      }
 
Update: jak coś to

bme680_bsec:
i2c_id: bus_a
address: 0x77

gdyby nie czytało
 
  • Like
Reactions: Silas Mariusz
Jeśli ktoś doświadczy problem z brakiem wartości z sensowrów po okresie 24/48h, a w logach pojawi sie mu taki błąd "Failed to set sensor settings (BME680 Error Code -2)" to polecam zmostkowac CS pin na BME680 z pinem GND.

Tutaj źrodło gdzie został rozwiązany podobny problem:
BME680 stops working · Issue #2421 · esphome/issues
"Not sure if this will help anyone, but what fixed it for me was grounding the CS pin of the BME680 to solve this problem even though its configured to communicate with I2C."
U mnie to rozwiązało problem i czujnik działa cały czas (pobiera dane).
 

Attachments

  • 1.jpg
    1.jpg
    611.4 KB · Views: 39
  • IMG_20230727_105412.jpg
    IMG_20230727_105412.jpg
    3.6 MB · Views: 35
  • IMG_20230727_105420.jpg
    IMG_20230727_105420.jpg
    1 MB · Views: 34

Users search this thread by keywords

  1. home assistant
  2. assistant
  3. esphome