New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for BSEC 2.0.6 and BSEC_OUTPUT_GAS_ESTIMATE_1/2/3/4 #1332
Comments
I am interested in BME688 support also. I found this Arduino library that does not include BSEC, but might at least allow readings from the BME688 VOC sensor. |
I just updated the existing component to the BSEC2 library: https://github.com/neffs/esphome/tree/bsec2 Before creating a PR we should figure out if it should be an additional component (e.g. bme68x_bsec) or replace the old version. In theory this should also work with BME680, but I don't have one to check. Help would be appreciated. Adding the additional GAS_ESTIMATE values will be easy, but we also need to provide a way to configure the model. |
Please submit a PR with your work. |
Thank you @neffs <3 ! |
It also works on a Pico W with the following build flags modified from #3917
Thanks @neffs.
Could the bme680_bsec component be depreciated and replaced with a bme68x_bsec2 component? This would cover the newer bme688 sensor. |
Hello, First, thank you @neffs for your contributions, it's really cool to have the support for bme688 :) I'm trying to test the code from you pull request and I can't compile it. This is my configuration:
|
Here's my config for an ESP32-S2 Mini board (lolin_s2_mini) + ### BME680: esphome:
name: esp-device-name
external_components:
- source: github://neffs/esphome@bsec2_bme68x
components:
- bme68x_bsec
esp32:
board: lolin_s2_mini
variant: ESP32S2
framework:
type: arduino
# Enable logging
logger:
api:
encryption:
key: "xxxxxxxxxxxxx"
ota:
wifi:
ssid: "xxxxxxxxx"
password: "xxxxxxxxxx"
captive_portal:
i2c:
sda: 11
scl: 12
bme68x_bsec:
# Default: 0x76 or 0x77
address: 0x77
temperature_offset: 0
# Default: static or mobile
# iaq_mode: static # currently not working
# Default: lp or ulp
sample_rate: lp
# Default: 6h
state_save_interval: 6h
# Download from Bosch website: https://www.bosch-sensortec.com/software-tools/software/bme688-software/
# File: BSEC 2.x
# bsec2-4-0-0_generic_release_23012023.zip\BSEC2.4.0.0_Generic_Release_23012023\config\bme680\bme680_iaq_33v_3s_28d
bsec_configuration: 0,0,4,2,189,1,0,0,(...copy from the file above...)
sensor:
- platform: bme68x_bsec
temperature:
name: "Temperature"
id: "temperature"
humidity:
name: "Humidity"
id: "humidity"
pressure:
name: "Pressure"
id: "pressure"
icon: "mdi:gauge"
co2_equivalent:
name: "CO2 Equivalent"
icon: "mdi:molecule-co2"
breath_voc_equivalent:
name: "VOC Equivalent"
icon: "mdi:molecule"
iaq:
name: "IAQ"
id: iaq
icon: "mdi:approximately-equal"
gas_resistance:
name: "Gas Resistance"
icon: "mdi:omega"
- platform: absolute_humidity
name: Absolute Humidity
icon: "mdi:water"
temperature: temperature
humidity: humidity
text_sensor:
- platform: bme68x_bsec
iaq_accuracy:
name: "IAQ Accuracy"
- platform: template
name: "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"};
} This config should work for both the BME680 and BME688. Thank you @neffs for your efforts. |
Describe the problem you have/What new integration you would like
Support for the customised BME688 algorithm that is learned from the dev-board and then put through the Bosch ML software tool. For Arduino sketches, I believe additional config files need to be included in the main program, which allow a customised data model to be referenced. BSEC 2.0.6 is the latest version, which is only available from the BoschSensorTec website after signing a form. The BoschSensorTec github is not currently at this version.
Please describe your use case for this integration and alternatives you've tried:
By using the ML output from a sensor board, the BME688 claims to be able to distinguish between different types of gases. A trained model should be able to tell the difference between coffee and tea for example. The use case I am looking to achieve is to be able to detect 3d printer fumes from various filament types, including ABS and PLA.
Additional context
I dont believe the latest API is in the ESPHome code base.
Specifically there are outputs returned from the sensor called "BSEC_OUTPUT_GAS_ESTIMATE_1" (and 2/3/4), which show "Gas_Estimate [probability 0.00-1]. Outputs corresponding to different target groups(Classes) with the probability of occurrence".
These target groups (classes) are specified during the ML training and are for the different types of gas that you want to test for.
There is a lot of information in the zip file that is available from the Bosch website, after signing up for the download file, including test data.
The text was updated successfully, but these errors were encountered: