Created
February 5, 2025 08:54
-
-
Save peyanski/8d6fb656164492ef52574f065f5007f7 to your computer and use it in GitHub Desktop.
DIY Smart Sensors Live Workshop - BME680 ESPhome code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i2c: | |
sda: 4 | |
scl: 5 | |
scan: True | |
web_server: | |
port: 80 | |
# version: 3 | |
ota: false | |
bme680_bsec: | |
- address: 0x77 | |
# - address: 0x76 | |
sensor: | |
- platform: bme680_bsec | |
temperature: | |
name: "BME680 Temperature" | |
pressure: | |
name: "BME680 Pressure" | |
humidity: | |
name: "BME680 Humidity" | |
iaq: | |
name: "BME680 IAQ" | |
id: iaq | |
co2_equivalent: | |
name: "BME680 CO2 Equivalent" | |
breath_voc_equivalent: | |
name: "BME680 Breath VOC Equivalent" | |
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 {"Excellent"}; | |
} | |
else if (int(id(iaq).state) >= 51 && int(id(iaq).state) <= 100) { | |
return {"Good"}; | |
} | |
else if (int(id(iaq).state) >= 101 && int(id(iaq).state) <= 150) { | |
return {"Lightly polluted"}; | |
} | |
else if (int(id(iaq).state) >= 151 && int(id(iaq).state) <= 200) { | |
return {"Moderately polluted"}; | |
} | |
else if (int(id(iaq).state) >= 201 && int(id(iaq).state) <= 250) { | |
return {"Heavily polluted"}; | |
} | |
else if (int(id(iaq).state) >= 251 && int(id(iaq).state) <= 350) { | |
return {"Severely polluted"}; | |
} | |
else if (int(id(iaq).state) >= 351) { | |
return {"Extremely polluted"}; | |
} | |
else { | |
return {"error"}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment