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