Skip to content

Instantly share code, notes, and snippets.

@peyanski
Created February 5, 2025 08:54
Show Gist options
  • Save peyanski/8d6fb656164492ef52574f065f5007f7 to your computer and use it in GitHub Desktop.
Save peyanski/8d6fb656164492ef52574f065f5007f7 to your computer and use it in GitHub Desktop.
DIY Smart Sensors Live Workshop - BME680 ESPhome code
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