Return to arduino and try bsec2 library

This commit is contained in:
Joshua Boniface 2025-02-07 10:26:18 -05:00
parent 82f56223f9
commit d5dae4ea98

View File

@ -26,7 +26,7 @@ esphome:
friendly_name: "Supersensor" friendly_name: "Supersensor"
project: project:
name: joshuaboniface.supersensor name: joshuaboniface.supersensor
version: "1.1" version: "1.2"
on_boot: on_boot:
- priority: 600 - priority: 600
then: then:
@ -55,19 +55,19 @@ dashboard_import:
esp32: esp32:
board: esp32dev board: esp32dev
framework: # framework:
type: esp-idf # type: esp-idf
version: 4.4.8 # version: 4.4.8
platform_version: 5.4.0 # platform_version: 5.4.0
sdkconfig_options: # sdkconfig_options:
CONFIG_ESP32_DEFAULT_CPU_FREQ_240: "y" # CONFIG_ESP32_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "240" # CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "240"
CONFIG_ESP32_DATA_CACHE_64KB: "y" # CONFIG_ESP32_DATA_CACHE_64KB: "y"
CONFIG_ESP32_DATA_CACHE_LINE_64B: "y" # CONFIG_ESP32_DATA_CACHE_LINE_64B: "y"
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y" # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ: "240" # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ: "240"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y" # CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y" # CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
globals: globals:
- id: gas_resistance_ceiling - id: gas_resistance_ceiling
@ -297,12 +297,12 @@ interval:
# wake_word: !lambda return wake_word; # wake_word: !lambda return wake_word;
# Include the Espressif Audio Development Framework for VAD support # Include the Espressif Audio Development Framework for VAD support
esp_adf: #esp_adf:
external_components: #external_components:
- source: github://pr#5230 # - source: github://pr#5230
components: # components:
- esp_adf # - esp_adf
refresh: 0s # refresh: 0s
voice_assistant: voice_assistant:
microphone: mic microphone: mic
@ -454,6 +454,13 @@ ld2410:
# g8_move_threshold: 80 # g8_move_threshold: 80
# g8_still_threshold: 81 # g8_still_threshold: 81
bme68x_bsec2_i2c:
address: 0x77
model: bme680
operating_age: 28d
sample_rate: LP
supply_voltage: 3.3V
binary_sensor: binary_sensor:
- platform: template - platform: template
name: "SuperSensor Occupancy" name: "SuperSensor Occupancy"
@ -505,25 +512,25 @@ binary_sensor:
name: "LD2410C Still Target" name: "LD2410C Still Target"
sensor: sensor:
- platform: bme680 - platform: bme68x_bsec2
address: 0x77
update_interval: 5s
iir_filter: 127x
temperature: temperature:
name: "BME680 Temperature" name: "BME680 Temperature"
id: bme680_temperature id: bme680_temperature
oversampling: 16x
pressure: pressure:
name: "BME680 Pressure" name: "BME680 Pressure"
id: bme680_pressure id: bme680_pressure
oversampling: 16x
humidity: humidity:
name: "BME680 Relative Humidity" name: "BME680 Relative Humidity"
id: bme680_humidity id: bme680_humidity
oversampling: 16x iaq:
gas_resistance: name: "BME680 IAQ"
name: "BME680 Gas Resistance" id: bme680_iaq
id: bme680_gas_resistance co2_equivalent:
name: "BME680 CO2 Equivalent"
id: bme680_co2e
breath_voc_equivalent:
name: "BME680 Breath VOC Equivalent"
id: bme680_bco2e
- platform: absolute_humidity - platform: absolute_humidity
name: "BME680 Absolute Humidity" name: "BME680 Absolute Humidity"
@ -531,28 +538,6 @@ sensor:
humidity: bme680_humidity humidity: bme680_humidity
id: bme680_absolute_humidity id: bme680_absolute_humidity
- platform: template
name: "BME680 AQ"
id: bme680_aq
icon: "mdi:gauge"
unit_of_measurement: "%"
accuracy_decimals: 0
update_interval: 5s
# Calculation from https://github.com/thstielow/raspi-bme680-iaq
lambda: |-
float ph_slope = 0.03;
float comp_gas = id(bme680_gas_resistance).state * pow(2.718281, (ph_slope * id(bme680_absolute_humidity).state));
float gas_ratio = pow((comp_gas / (id(gas_resistance_ceiling) * 1000)), 2);
if (gas_ratio > 1) {
gas_ratio = 1.0;
}
float air_quality = gas_ratio * 100;
int normalized_air_quality = (int)air_quality;
if (normalized_air_quality > 100) {
normalized_air_quality = 100;
}
return normalized_air_quality;
- platform: tsl2591 - platform: tsl2591
address: 0x29 address: 0x29
update_interval: 1s update_interval: 1s
@ -638,29 +623,36 @@ sensor:
entity_category: diagnostic entity_category: diagnostic
text_sensor: text_sensor:
- platform: bme68x_bsec2
iaq_accuracy:
name: "BME68x IAQ Accuracy"
- platform: template - platform: template
name: "BME680 AQ Classification" name: "BME68x IAQ Classification"
icon: "mdi:air-filter"
update_interval: 5s
lambda: |- lambda: |-
int aq = int(id(bme680_aq).state); if ( int(id(bme680_iaq).state) <= 50) {
if (aq >= 90) {
return {"Excellent"}; return {"Excellent"};
} }
else if (aq >= 80) { else if (int(id(bme680_iaq).state) >= 51 && int(id(bme680_iaq).state) <= 100) {
return {"Good"}; return {"Good"};
} }
else if (aq >= 70) { else if (int(id(bme680_iaq).state) >= 101 && int(id(bme680_iaq).state) <= 150) {
return {"Fair"}; return {"Lightly polluted"};
} }
else if (aq >= 60) { else if (int(id(bme680_iaq).state) >= 151 && int(id(bme680_iaq).state) <= 200) {
return {"Moderate"}; return {"Moderately polluted"};
} }
else if (aq >= 50) { else if (int(id(bme680_iaq).state) >= 201 && int(id(bme680_iaq).state) <= 250) {
return {"Bad"}; return {"Heavily polluted"};
}
else if (int(id(bme680_iaq).state) >= 251 && int(id(bme680_iaq).state) <= 350) {
return {"Severely polluted"};
}
else if (int(id(bme680_iaq).state) >= 351) {
return {"Extremely polluted"};
} }
else { else {
return {"Terrible"}; return {"error"};
} }
- platform: wifi_info - platform: wifi_info