Wybrane odczyty | Pełne odczyty z obydwu czujników |
---|---|
|
Czujnik BME680:
I2C Wiring | ESP NodeMCU Pinout |
---|---|
SCL | D1 |
SDA | D2 |
VIN | 3V |
GND | G |
Warianty komunikatów:
IAQ (Jakość powietrza) | Opis |
---|---|
<= 50 | Wspaniała |
>= 51 && <= 100 | Dobra |
>= 101 && <= 150 | Lekko zanieczyszczone |
>= 151 && <= 200 | Średnio zanieczyszczone |
>= 201 && <= 250 | Bardzo zanieczyszczone |
>= 251 && <= 350 | Silnie zanieczyszczone |
>= 351 | Ekstremalnie zanieczyszczone |
Klasyfikacja CO2 | Opis |
---|---|
<= 5 | Etan |
>= 6 && <= 10 | Izopren lub Etanol |
>= 11 && <= 25 | Tlenek węgla (czad) |
>= 26 && <= 99 | Aceton |
>= 100 && <= 199 | Dla bezpieczeństwa przewietrz |
>= 200 && <= 600 | Bardzo dobre |
>= 601 && <= 1000 | Dobre |
>= 1001 && <= 1400 | Akceptowalne |
>= 1401 && <= 5000 | Należy przewietrzyć pomieszczenie |
>= 5000 | Osią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"};
}