Revert previous BSEC2 changes

This library proved to be just as useless for reliable IAQ as the
original BSEC library (swinging wildly based on nothing at all), so
revert back to tag 1.2 and ESP-IDF.
This commit is contained in:
2025-02-09 10:42:37 -05:00
parent 64bbb01ab0
commit c32ff6064b
2 changed files with 231 additions and 59 deletions

View File

@ -1,10 +1,10 @@
---
###############################################################################
# SuperSensor v1.x ESPHome configuration
# SuperSensor v1.0 ESPHome configuration
###############################################################################
#
# Copyright (C) 2023-2025 Joshua M. Boniface <joshua@boniface.me>
# Copyright (C) 2023 Joshua M. Boniface <joshua@boniface.me>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -26,7 +26,7 @@ esphome:
friendly_name: "Supersensor"
project:
name: joshuaboniface.supersensor
version: "1.3"
version: "1.1"
on_boot:
- priority: 600
then:
@ -55,21 +55,26 @@ 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
type: int
restore_value: yes
initial_value: "200"
- id: pir_hold_time
type: int
restore_value: yes
@ -292,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
@ -449,13 +454,6 @@ 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"
@ -507,25 +505,25 @@ binary_sensor:
name: "LD2410C Still Target"
sensor:
- platform: bme68x_bsec2
- platform: bme680
address: 0x77
update_interval: 5s
iir_filter: 127x
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
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
oversampling: 16x
gas_resistance:
name: "BME680 Gas Resistance"
id: bme680_gas_resistance
- platform: absolute_humidity
name: "BME680 Absolute Humidity"
@ -533,6 +531,28 @@ 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
@ -618,36 +638,29 @@ sensor:
entity_category: diagnostic
text_sensor:
- platform: bme68x_bsec2
iaq_accuracy:
name: "BME68x IAQ Accuracy"
- platform: template
name: "BME68x IAQ Classification"
name: "BME680 AQ Classification"
icon: "mdi:air-filter"
update_interval: 5s
lambda: |-
if ( int(id(bme680_iaq).state) <= 50) {
int aq = int(id(bme680_aq).state);
if (aq >= 90) {
return {"Excellent"};
}
else if (int(id(bme680_iaq).state) >= 51 && int(id(bme680_iaq).state) <= 100) {
else if (aq >= 80) {
return {"Good"};
}
else if (int(id(bme680_iaq).state) >= 101 && int(id(bme680_iaq).state) <= 150) {
return {"Lightly polluted"};
else if (aq >= 70) {
return {"Fair"};
}
else if (int(id(bme680_iaq).state) >= 151 && int(id(bme680_iaq).state) <= 200) {
return {"Moderately polluted"};
else if (aq >= 60) {
return {"Moderate"};
}
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 if (aq >= 50) {
return {"Bad"};
}
else {
return {"error"};
return {"Terrible"};
}
- platform: wifi_info
@ -723,6 +736,21 @@ switch:
entity_category: diagnostic
number:
- platform: template
name: "Gas Resistance Ceiling (kΩ)"
id: gas_resistance_ceiling_setter
min_value: 10
max_value: 500
step: 1
entity_category: config
lambda: |-
return id(gas_resistance_ceiling);
set_action:
then:
- globals.set:
id: gas_resistance_ceiling
value: !lambda 'return int(x);'
# PIR Hold Time:
# The number of seconds after motion detection for the PIR sensor to remain held on
- platform: template