diff --git a/docs/requirements.txt b/docs/requirements.txt index dd1f0ad..92c09d1 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,16 @@ +Babel==2.13.1 bracex==2.4 -click==8.1.7 +cairocffi==1.6.1 +CairoSVG==2.7.1 +certifi==2022.12.7 +cffi==1.16.0 +charset-normalizer==3.1.0 +click==8.1.3 colorama==0.4.6 +cssselect2==0.7.0 +defusedxml==0.7.1 ghp-import==2.1.0 +idna==3.4 importlib-metadata==6.8.0 Jinja2==3.1.2 Markdown==3.5.1 @@ -9,12 +18,26 @@ MarkupSafe==2.1.3 mergedeep==1.3.4 mkdocs==1.5.3 mkdocs-awesome-pages-plugin==2.9.2 +mkdocs-material==9.4.6 +mkdocs-material-extensions==1.3 natsort==8.4.0 packaging==23.2 +paginate==0.5.6 +pathspec==0.11.2 +Pillow==10.1.0 +platformdirs==3.11.0 +pycparser==2.21 +Pygments==2.16.1 +pymdown-extensions==10.3.1 python-dateutil==2.8.2 PyYAML==6.0.1 pyyaml_env_tag==0.1 +regex==2023.10.3 +requests==2.31.0 six==1.16.0 +tinycss2==1.2.1 +urllib3==2.0.7 watchdog==3.0.0 wcmatch==8.5 +webencodings==0.5.1 zipp==3.17.0 diff --git a/docs/sensors.md b/docs/sensors.md index 41ab043..b6ae1c4 100644 --- a/docs/sensors.md +++ b/docs/sensors.md @@ -5,7 +5,7 @@ want but notice the compatibility.
-## 🌡️Temperature, Humidity, Pressure & Air Quality +## 🌡️Temperature, Humidity, Pressure, VOC & Air Quality For these measurements we recommend the industrial sensors BME680/BME688 or the BME280 (cheaper but without air @@ -25,6 +25,8 @@ Related to [#7](https://github.com/Schluggi/AIOsense/issues/7) sometimes SMD soldering can be inaccessible or difficult. You can use a BME PCB module instead. +The default offset is -6 °C. + ### Where to buy? | Part | Shops | @@ -90,9 +92,7 @@ for their high quality digital audio. | INMP441 | [Amazon DE³](https://amzn.to/40y8twJ), [AliExpress](https://de.aliexpress.com/wholesale?catId=0&initiative_id=SB_20221127114658&SearchText=inmp441&spm=a2g0o.tm800107193.1000002.0&dida=y) | ### Compatibility - -> **WARNING**: Not supported yet! -> This sensor is fully compatible with any other sensor or module. +> **AIOsense v2.1.0**: This sensor is fully compatible with any other sensor or module besides the buzzer. Please disconnect the buzzer first.
diff --git a/esphome/esphome.yaml b/esphome/esphome.yaml index 6369571..4382ca3 100644 --- a/esphome/esphome.yaml +++ b/esphome/esphome.yaml @@ -1,20 +1,19 @@ substitutions: name: "aiosense-bedroom" # lowercase only, have to be unique friendly_name: "AIOsense Bedroom" # device name and entity prefix - version: "2.1.0" # your AIOsense version # bh1750_update_interval: 5s - # bmex80_address: "0x76" # for some modules you have to change it to 0x77 - # bmex80_update_interval: 30s + # bme_address: "0x76" # for some modules you have to change it to 0x77 + # bme_update_interval: 30s + # co2_offset: "0" # bsec only # humidity_offset: "0" + # iaq_offset: "0" # bsec only # illuminance_offset: "0" # pressure_offset: "0" - # temperature_offset: "0" - - # bme680_bsec_sample_rate: lp # lp -> 3s, ulp ->5min - # bme680_bsec_temperature_offset: "0" + temperature_offset: "-6" + # voc_offset: "0" # bsec only # LD2410(c) does not work? Please notice: # https://aiosense.readthedocs.io/en/latest/debugging/#ld2410c-does-not-work @@ -28,29 +27,35 @@ substitutions: packages: remote_package: url: https://github.com/schluggi/AIOsense - ref: main + ref: esphome-v3.0.0 refresh: 1d files: - esphome/packages/config/base.yaml - # --- select your board --- - - esphome/packages/config/esp32-c3-mini.yaml + # ----- board ----- + # - esphome/packages/config/esp32-c3-mini.yaml # - esphome/packages/config/esp32-d1-mini.yaml # - esphome/packages/config/esp32-s2-mini.yaml + - esphome/packages/config/esp32-s3-mini.yaml # - esphome/packages/config/esp8266-d1-mini.yaml - # --- select your sensors --- + # ----- modules ----- - esphome/packages/sensors/bh1750.yaml - # - esphome/packages/sensors/buzzer.yaml # AIOsense >= 2.1.x only # - esphome/packages/sensors/bme280.yaml # enable for bme280 - - esphome/packages/sensors/bme680.yaml # disable for bme280 - # - esphome/packages/sensors/bme680_bsec.yaml # does not work yet - - esphome/packages/sensors/occupancy.yaml # only if pir & mmWave are on + - esphome/packages/sensors/bme68x_bsec.yaml # disable for bme280 + - esphome/packages/sensors/buzzer.yaml # PCB >= v2.1.0 + - esphome/packages/sensors/occupancy.yaml # only if pir & mmWave are activated - esphome/packages/sensors/pir.yaml - - esphome/packages/sensors/rgb_led.yaml # esp32-c3-mini only - # - esphome/packages/sensors/led.yaml # d1-mini only + + # ----- voice assistant (use rgb_led for esp32-c3 & esp32-s3 only----- + # - esphome/packages/sensors/voice_assistant-rgb_led.yaml + - esphome/packages/sensors/voice_assistant-led.yaml + + # ----- led modules (use rgb_led for esp32-c3 & esp32-s3 only) ----- + - esphome/packages/sensors/rgb_led.yaml + # - esphome/packages/sensors/led.yaml - # --- select your radar sensor --- + # ----- mmWave radar sensor ----- # - esphome/packages/sensors/ld2410.yaml - esphome/packages/sensors/sen0395.yaml diff --git a/esphome/packages/config/base.yaml b/esphome/packages/config/base.yaml index 776d9f5..ee36fd5 100644 --- a/esphome/packages/config/base.yaml +++ b/esphome/packages/config/base.yaml @@ -1,5 +1,5 @@ substitutions: - version: "2.0.0" + version: "3.0.0" esphome: name: "${name}" diff --git a/esphome/packages/config/esp32-c3-mini.yaml b/esphome/packages/config/esp32-c3-mini.yaml index a937a51..a6922f0 100644 --- a/esphome/packages/config/esp32-c3-mini.yaml +++ b/esphome/packages/config/esp32-c3-mini.yaml @@ -1,8 +1,12 @@ substitutions: - buzzer_pin: GPIO0 - pir_pin: GPIO4 + buzzer_pin: A0 + i2s_bclk_pin: A1 + i2s_din_pin: "${buzzer_pin}" + i2s_lrclk_pin: A5 + pir_pin: A4 rgb_led_pin: GPIO7 - sen0395_io_pin: GPIO2 + rgb_led_type: GRB + sen0395_io_pin: A2 uart_rx_pin: GPIO20 uart_tx_pin: GPIO21 diff --git a/esphome/packages/config/esp32-d1-mini.yaml b/esphome/packages/config/esp32-d1-mini.yaml index 87c5701..e9e887d 100644 --- a/esphome/packages/config/esp32-d1-mini.yaml +++ b/esphome/packages/config/esp32-d1-mini.yaml @@ -1,5 +1,8 @@ substitutions: - buzzer_pin: GPIO19 # untested + buzzer_pin: GPIO19 + i2s_bclk_pin: GPIO14 + i2s_din_pin: "${buzzer_pin}" + i2s_lrclk_pin: GPIO15 led_pin: GPIO2 pir_pin: GPIO23 sen0395_io_pin: GPIO26 diff --git a/esphome/packages/config/esp32-s2-mini.yaml b/esphome/packages/config/esp32-s2-mini.yaml index 5b46340..076c026 100644 --- a/esphome/packages/config/esp32-s2-mini.yaml +++ b/esphome/packages/config/esp32-s2-mini.yaml @@ -1,5 +1,8 @@ substitutions: buzzer_pin: GPIO9 + i2s_bclk_pin: GPIO7 + i2s_din_pin: "${buzzer_pin}" + i2s_lrclk_pin: GPIO12 led_invert: "true" led_pin: GPIO15 pir_pin: GPIO11 diff --git a/esphome/packages/config/esp32-s3-mini.yaml b/esphome/packages/config/esp32-s3-mini.yaml new file mode 100644 index 0000000..9f65767 --- /dev/null +++ b/esphome/packages/config/esp32-s3-mini.yaml @@ -0,0 +1,26 @@ +substitutions: + buzzer_pin: GPIO13 + i2s_bclk_pin: GPIO12 + i2s_din_pin: "${buzzer_pin}" + i2s_lrclk_pin: GPIO10 + pir_pin: GPIO11 + rgb_led_pin: GPIO47 + rgb_led_type: RGB + sen0395_io_pin: GPIO4 + uart_rx_pin: GPIO44 + uart_tx_pin: GPIO43 + +esp32: + board: esp32-s3-devkitc-1 + variant: esp32s3 + framework: + type: arduino + version: latest + +i2c: + sda: GPIO35 + scl: GPIO36 + +sensor: + - platform: internal_temperature + name: "CPU Temperature" diff --git a/esphome/packages/sensors/bme280.yaml b/esphome/packages/sensors/bme280.yaml index 3b1642e..ca78993 100644 --- a/esphome/packages/sensors/bme280.yaml +++ b/esphome/packages/sensors/bme280.yaml @@ -1,8 +1,8 @@ # https://esphome.io/cookbook/bme280_environment.html substitutions: - bmex80_address: "0x76" - bmex80_update_interval: 30s + bme_address: "0x76" + bme_update_interval: 30s humidity_offset: "0" pressure_offset: "0" temperature_offset: "0" @@ -62,8 +62,8 @@ number: sensor: - platform: bme280 id: bme280_sensor - address: "${bmex80_address}" - update_interval: "${bmex80_update_interval}" + address: "${bme_address}" + update_interval: "${bme_update_interval}" temperature: name: "Temperature" filters: diff --git a/esphome/packages/sensors/bme680.yaml b/esphome/packages/sensors/bme680.yaml index e9cb264..7fa2700 100644 --- a/esphome/packages/sensors/bme680.yaml +++ b/esphome/packages/sensors/bme680.yaml @@ -1,8 +1,8 @@ # https://esphome.io/components/sensor/bme680.html substitutions: - bmex80_address: "0x76" - bmex80_update_interval: "30s" + bme_address: "0x76" + bme_update_interval: "30s" humidity_offset: "0" pressure_offset: "0" temperature_offset: "0" @@ -62,8 +62,8 @@ number: sensor: - platform: bme680 id: bme680_sensor - address: "${bmex80_address}" - update_interval: "${bmex80_update_interval}" + address: "${bme_address}" + update_interval: "${bme_update_interval}" temperature: name: "Temperature" filters: diff --git a/esphome/packages/sensors/bme680_bsec.yaml b/esphome/packages/sensors/bme680_bsec.yaml deleted file mode 100644 index faaa340..0000000 --- a/esphome/packages/sensors/bme680_bsec.yaml +++ /dev/null @@ -1,62 +0,0 @@ -# https://esphome.io/components/sensor/bme680_bsec.html - -substitutions: - bmex80_address: "0x76" - bme680_bsec_sample_rate: lp - bme680_bsec_temperature_offset: "0" - -bme680_bsec: - address: "${bmex80_address}" - sample_rate: "${bme680_bsec_sample_rate}" - state_save_interval: 2h - temperature_offset: "${bme680_bsec_temperature_offset}" - -sensor: - - platform: bme680_bsec - temperature: - name: "Temperature" - pressure: - name: "Pressure" - humidity: - name: "Humidity" - iaq: - name: "IAQ" - id: iaq - co2_equivalent: - name: "CO2 Equivalent" - breath_voc_equivalent: - name: "Breath VOC Equivalent" - -text_sensor: - - platform: bme680_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"}; - } diff --git a/esphome/packages/sensors/bme68x_bsec.yaml b/esphome/packages/sensors/bme68x_bsec.yaml new file mode 100644 index 0000000..86a138e --- /dev/null +++ b/esphome/packages/sensors/bme68x_bsec.yaml @@ -0,0 +1,180 @@ +substitutions: + bme_address: "0x76" + co2_offset: "0" + humidity_offset: "0" + iaq_offset: "0" + pressure_offset: "0" + temperature_offset: "0" + voc_offset: "0" + +external_components: + - source: github://schluggi/esphome@dev + components: + - bme68x_bsec + +bme68x_bsec: + address: "${bme_address}" + bsec_configuration: 0,0,2,2,189,1,0,0,0,0,0,0,213,8,0,0,52,0,1,0,0,192,168,71,64,49,119,76,0,0,97,69,0,0,97,69,137,65,0,63,0,0,0,63,0,0,64,63,205,204,204,62,10,0,3,0,216,85,0,100,0,0,96,64,23,183,209,56,28,0,2,0,0,244,1,150,0,50,0,0,128,64,0,0,32,65,144,1,0,0,112,65,0,0,0,63,16,0,3,0,10,215,163,60,10,215,35,59,10,215,35,59,13,0,5,0,0,0,0,0,100,35,41,29,86,88,0,9,0,229,208,34,62,0,0,0,0,0,0,0,0,218,27,156,62,225,11,67,64,0,0,160,64,0,0,0,0,0,0,0,0,94,75,72,189,93,254,159,64,66,62,160,191,0,0,0,0,0,0,0,0,33,31,180,190,138,176,97,64,65,241,99,190,0,0,0,0,0,0,0,0,167,121,71,61,165,189,41,192,184,30,189,64,12,0,10,0,0,0,0,0,0,0,0,0,173,6,11,0,1,2,2,207,61,208,65,149,110,24,66,180,108,177,65,219,148,13,192,70,132,58,66,163,58,140,192,12,99,178,192,185,59,255,193,178,213,175,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,211,55,195,237,6,56,67,0,0,0,0,0,0,0,0,26,3,255,63,61,246,7,192,171,201,228,192,249,144,215,63,237,199,104,193,128,158,216,64,117,140,155,63,137,120,129,67,108,109,253,191,0,0,0,0,81,64,57,68,103,241,231,64,109,29,152,192,209,43,193,63,93,54,30,65,197,46,92,64,128,27,224,192,6,20,144,191,56,179,130,64,0,0,0,0,43,156,59,196,33,217,100,194,104,77,72,65,15,103,175,191,249,252,12,193,63,117,253,192,233,5,141,65,155,42,25,64,13,88,249,191,0,0,0,0,48,141,122,190,204,150,44,192,36,162,29,193,96,59,39,189,54,202,48,65,151,205,68,64,79,105,55,193,53,120,53,192,77,211,32,192,0,0,0,0,193,207,92,65,239,201,76,65,208,70,82,66,81,63,96,65,48,179,0,194,251,96,242,193,176,51,96,194,153,114,98,66,144,247,64,65,0,0,0,0,219,179,180,63,175,218,119,191,51,71,207,191,245,145,129,63,53,16,244,65,138,208,117,65,138,97,36,66,228,15,32,195,126,91,103,191,0,0,0,0,26,151,170,193,64,105,49,193,46,223,189,193,129,203,168,193,40,91,49,66,4,87,107,65,205,202,37,65,244,36,154,66,240,85,39,193,0,0,0,0,166,96,87,192,114,7,68,191,233,32,214,63,84,249,40,192,45,78,132,64,145,33,253,61,49,43,187,192,244,32,77,67,224,250,71,191,0,0,0,0,103,75,214,190,206,141,252,63,99,15,178,65,80,79,166,190,214,25,146,192,165,29,24,194,18,228,219,193,113,246,235,194,49,115,232,63,0,0,0,0,17,211,124,64,56,252,251,62,25,118,148,193,168,234,94,64,131,157,82,64,217,119,236,65,120,245,240,65,17,69,168,195,49,51,8,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,217,97,66,182,104,101,194,0,0,0,0,0,0,0,0,6,142,142,195,229,54,143,67,0,0,0,0,0,0,0,0,25,224,153,66,217,51,154,194,0,0,0,0,0,0,0,0,142,36,105,194,199,63,110,66,0,0,0,0,0,0,0,0,206,73,250,193,138,69,249,65,0,0,0,0,0,0,0,0,123,173,127,66,20,116,128,194,0,0,0,0,0,0,0,0,49,65,49,64,205,213,107,192,0,0,0,0,0,0,0,0,189,250,179,194,164,98,180,66,0,0,0,0,0,0,0,0,96,182,197,67,155,71,197,195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,185,28,179,73,64,25,141,76,223,26,138,76,222,207,133,76,87,134,164,75,23,127,159,75,166,9,155,75,94,120,170,73,95,221,177,73,93,44,182,73,0,0,0,0,0,0,0,0,0,0,0,0,30,55,120,73,215,98,32,76,7,79,34,76,161,238,36,76,119,151,160,75,119,96,157,75,202,75,154,75,118,89,111,73,133,239,116,73,219,140,120,73,0,0,128,63,0,0,128,63,0,0,128,63,0,0,0,87,1,254,0,2,1,5,48,117,100,0,44,1,112,23,151,7,132,3,197,0,92,4,144,1,64,1,64,1,144,1,48,117,48,117,48,117,48,117,100,0,100,0,100,0,48,117,48,117,48,117,100,0,100,0,48,117,48,117,8,7,8,7,8,7,8,7,8,7,100,0,100,0,100,0,100,0,48,117,48,117,48,117,100,0,100,0,100,0,48,117,48,117,100,0,100,0,255,255,255,255,255,255,255,255,255,255,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,255,255,255,255,255,255,255,255,255,255,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,255,255,255,255,255,255,255,255,255,255,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,112,23,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,220,5,220,5,220,5,255,255,255,255,255,255,220,5,220,5,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,48,117,0,5,10,5,0,2,0,10,0,30,0,5,0,5,0,5,0,5,0,5,0,5,0,64,1,100,0,100,0,100,0,200,0,200,0,200,0,64,1,64,1,64,1,10,0,0,0,0,145,33,0,0 + state_save_interval: 30min + +esphome: + min_version: 2023.10.0 + +sensor: + - platform: bme68x_bsec + temperature: + name: "Temperature" + filters: + - offset: ${temperature_offset} + - lambda: "return x + id(temperature_offset_ui).state;" + pressure: + name: "Pressure" + device_class: atmospheric_pressure + filters: + - offset: ${pressure_offset} + - lambda: "return x + id(pressure_offset_ui).state;" + humidity: + name: "Humidity" + filters: + - offset: ${humidity_offset} + - lambda: "return x + id(humidity_offset_ui).state;" + iaq: + name: "IAQ" + id: iaq + device_class: aqi + filters: + - offset: ${iaq_offset} + - lambda: "return x + id(iaq_offset_ui).state;" + co2_equivalent: + name: "CO2 Equivalent" + device_class: carbon_dioxide + filters: + - offset: ${co2_offset} + - lambda: "return x + id(co2_offset_ui).state;" + breath_voc_equivalent: + name: "Breath VOC Equivalent" + device_class: volatile_organic_compounds + filters: + - offset: ${voc_offset} + - lambda: "return x + id(voc_offset_ui).state;" + +number: + - platform: template + name: "Temperature Offset" + id: temperature_offset_ui + unit_of_measurement: "°C" + min_value: -10 + max_value: 10 + step: 0.1 + mode: box + update_interval: never + optimistic: true + restore_value: true + initial_value: 0 + icon: "mdi:thermometer" + entity_category: config + + - platform: template + name: "Humidity Offset" + id: humidity_offset_ui + unit_of_measurement: "%" + min_value: -50 + max_value: 50 + step: 0.1 + mode: box + update_interval: never + optimistic: true + restore_value: true + initial_value: 0 + icon: "mdi:water-percent" + entity_category: config + + - platform: template + name: "Pressure Offset" + id: pressure_offset_ui + unit_of_measurement: "hPa" + min_value: -500 + max_value: 500 + step: 1 + mode: box + update_interval: never + optimistic: true + restore_value: true + initial_value: 0 + icon: "mdi:gauge" + entity_category: config + + - platform: template + name: "CO2 Offset" + id: co2_offset_ui + unit_of_measurement: "ppm" + min_value: -1000 + max_value: 1000 + step: 1 + mode: box + update_interval: never + optimistic: true + restore_value: true + initial_value: 0 + icon: "mdi:test-tube" + entity_category: config + + - platform: template + name: "VOC Offset" + id: voc_offset_ui + unit_of_measurement: "ppm" + min_value: -1000 + max_value: 1000 + step: 1 + mode: box + update_interval: never + optimistic: true + restore_value: true + initial_value: 0 + icon: "mdi:test-tube" + entity_category: config + + - platform: template + name: "IAQ Offset" + id: iaq_offset_ui + unit_of_measurement: "IAQ" + min_value: -400 + max_value: 400 + step: 1 + mode: box + update_interval: never + optimistic: true + restore_value: true + initial_value: 0 + icon: "mdi:gauge" + entity_category: config + +text_sensor: + - 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"}; + } diff --git a/esphome/packages/sensors/buzzer.yaml b/esphome/packages/sensors/buzzer.yaml index 4be493e..db6eac6 100644 --- a/esphome/packages/sensors/buzzer.yaml +++ b/esphome/packages/sensors/buzzer.yaml @@ -21,5 +21,6 @@ rtttl: esphome: on_boot: - then: - - rtttl.play: "two short:d=4,o=5,b=100:16e6,16e6" + - priority: 10 + then: + - rtttl.play: "two short:d=4,o=5,b=100:16e6,16e6" diff --git a/esphome/packages/sensors/led.yaml b/esphome/packages/sensors/led.yaml index a9ed8fe..3860919 100644 --- a/esphome/packages/sensors/led.yaml +++ b/esphome/packages/sensors/led.yaml @@ -26,7 +26,8 @@ light: esphome: on_boot: - then: - - light.turn_on: led - - delay: 3s - - light.turn_off: led + - priority: 0 + then: + - light.turn_on: led + - delay: 2s + - light.turn_off: led diff --git a/esphome/packages/sensors/rgb_led.yaml b/esphome/packages/sensors/rgb_led.yaml index 3ab8faf..869447d 100644 --- a/esphome/packages/sensors/rgb_led.yaml +++ b/esphome/packages/sensors/rgb_led.yaml @@ -7,7 +7,7 @@ light: - platform: neopixelbus name: "LED" id: led - type: GRB + type: "${rgb_led_type}" variant: WS2812X num_leds: 1 pin: "${rgb_led_pin}" @@ -42,7 +42,8 @@ light: esphome: on_boot: - then: - - light.turn_on: led - - delay: 3s - - light.turn_off: led + - priority: 0 + then: + - light.turn_on: led + - delay: 2s + - light.turn_off: led diff --git a/esphome/packages/sensors/sen0395.yaml b/esphome/packages/sensors/sen0395.yaml index 40a9911..b58b0f3 100644 --- a/esphome/packages/sensors/sen0395.yaml +++ b/esphome/packages/sensors/sen0395.yaml @@ -4,6 +4,9 @@ uart: rx_pin: "${uart_rx_pin}" baud_rate: 115200 +dfrobot_sen0395: + uart_id: uart_bus + binary_sensor: - platform: gpio name: "mmWave" @@ -14,119 +17,210 @@ binary_sensor: mode: INPUT_PULLDOWN switch: - - platform: template + - platform: dfrobot_sen0395 name: "mmWave Sensor" - id: "mmwave_sensor" + type: sensor_active + + - platform: dfrobot_sen0395 + name: "mmWave Presence Via Uart" + type: presence_via_uart + disabled_by_default: true + + - platform: dfrobot_sen0395 + name: "mmWave Autostart" + type: start_after_boot + disabled_by_default: true + + - platform: dfrobot_sen0395 + name: "mmWave LED" + type: turn_on_led + +number: + - platform: template + name: "mmWave Sensitivity" + id: mmwave_sensitivity entity_category: config + min_value: 0 + max_value: 9 + initial_value: 7 optimistic: true - restore_mode: RESTORE_DEFAULT_ON - assumed_state: true - turn_on_action: - - uart.write: "sensorStart" - - delay: 1s - turn_off_action: - - uart.write: "sensorStop" - - delay: 1s + step: 1 + restore_value: true - platform: template - name: "mmWave LED" - id: "mmwave_led" + name: "mmWave Off Latency" + id: mmwave_off_latency entity_category: config + min_value: 0 + max_value: 60 + initial_value: 10 optimistic: true - restore_mode: RESTORE_DEFAULT_OFF - assumed_state: true - turn_on_action: - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: "setLedMode 1 0" - - delay: 1s - - uart.write: "saveConfig" - - delay: 3s - - switch.turn_on: mmwave_sensor - turn_off_action: - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: "setLedMode 1 1" - - delay: 1s - - uart.write: "saveConfig" - - delay: 3s - - switch.turn_on: mmwave_sensor + step: 0.025 + restore_value: true + unit_of_measurement: s + mode: box -number: - platform: template - name: "mmWave Distance" - id: mmwave_distance + name: "mmWave On Latency" + id: mmwave_on_latency entity_category: config min_value: 0 - max_value: 800 - initial_value: 315 + max_value: 60 + initial_value: 2.5 optimistic: true - step: 50 + step: 0.025 restore_value: true - unit_of_measurement: cm - mode: slider - set_action: - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: !lambda int cm = (int)ceil(x / 15.0); - std::string cms = "detRangeCfg -1 0 " + to_string(cm); - return std::vector(cms.begin(), cms.end()); - - delay: 1s - - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" - - delay: 1s - - switch.turn_on: mmwave_sensor + unit_of_measurement: s + mode: box - platform: template - name: "mmWave Off Latency" - id: mmwave_latency + name: "mmWave Segment 1 Begin" + id: mmwave_segment_1_begin entity_category: config min_value: 0 - max_value: 65000 - initial_value: 12500 + max_value: 9 + initial_value: 0 optimistic: true - step: 25 + step: 0.15 restore_value: true - unit_of_measurement: ms - mode: box - set_action: - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: !lambda int ms = (int)ceil(x / 25.0); - std::string mss = "outputLatency -1 0 " + to_string(ms); - return std::vector(mss.begin(), mss.end()); - - delay: 1s - - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" - - delay: 1s - - switch.turn_on: mmwave_sensor + unit_of_measurement: m + mode: BOX - platform: template - name: "mmWave Sensitivity" - id: mmwave_sensitivity + name: "mmWave Segment 1 End" + id: mmwave_segment_1_end entity_category: config min_value: 0 max_value: 9 - initial_value: 7 + initial_value: 3 + optimistic: true + step: 0.15 + restore_value: true + unit_of_measurement: m + mode: BOX + + - platform: template + name: "mmWave Segment 2 Begin" + id: mmwave_segment_2_begin + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 0 + optimistic: true + step: 0.15 + restore_value: true + unit_of_measurement: m + mode: BOX + + - platform: template + name: "mmWave Segment 2 End" + id: mmwave_segment_2_end + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 0 + optimistic: true + step: 0.15 + restore_value: true + unit_of_measurement: m + mode: BOX + + - platform: template + name: "mmWave Segment 3 Begin" + id: mmwave_segment_3_begin + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 0 + optimistic: true + step: 0.15 + restore_value: true + unit_of_measurement: m + mode: BOX + + - platform: template + name: "mmWave Segment 3 End" + id: mmwave_segment_3_end + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 0 + optimistic: true + step: 0.15 + restore_value: true + unit_of_measurement: m + mode: BOX + + - platform: template + name: "mmWave Segment 4 Begin" + id: mmwave_segment_4_begin + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 0 + optimistic: true + step: 0.15 + restore_value: true + unit_of_measurement: m + mode: BOX + + - platform: template + name: "mmWave Segment 4 End" + id: mmwave_segment_4_end + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 0 + optimistic: true + step: 0.15 + restore_value: true + unit_of_measurement: m + mode: BOX + + - platform: template + name: "mmWave Segments" + id: mmwave_segments + entity_category: config + min_value: 1 + max_value: 4 + initial_value: 1 optimistic: true step: 1 restore_value: true - set_action: - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: - !lambda std::string mss = "setSensitivity " + to_string((int)x); - return std::vector(mss.begin(), mss.end()); - - delay: 1s - - uart.write: "saveConfig" - - delay: 1s - - switch.turn_on: mmwave_sensor + mode: SLIDER button: - platform: template name: "mmWave Factory Reset" + entity_category: diagnostic + on_press: + - dfrobot_sen0395.settings: + factory_reset: true + + - platform: template + name: "mmWave Restart" + entity_category: diagnostic + on_press: + - dfrobot_sen0395.reset + + - platform: template + name: "mmWave Apply Settings" entity_category: config on_press: - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: "resetCfg" - - delay: 3s - - switch.turn_on: mmwave_sensor + - dfrobot_sen0395.settings: + sensitivity: !lambda return id(mmwave_sensitivity).state; + detection_segments: + - !lambda return id(mmwave_segment_1_begin).state; + - !lambda return id(mmwave_segment_1_end).state; + + - !lambda if(id(mmwave_segments).state >= 2){ return id(mmwave_segment_2_begin).state; } else { return -1; }; + - !lambda if(id(mmwave_segments).state >= 2){ return id(mmwave_segment_2_end).state; } else { return -1; }; + + - !lambda if(id(mmwave_segments).state >= 3){ return id(mmwave_segment_3_begin).state; } else { return -1; }; + - !lambda if(id(mmwave_segments).state >= 3){ return id(mmwave_segment_3_end).state; } else { return -1; }; + + - !lambda if(id(mmwave_segments).state == 4){ return id(mmwave_segment_4_begin).state; } else { return -1; }; + - !lambda if(id(mmwave_segments).state == 4){ return id(mmwave_segment_4_end).state; } else { return -1; }; + output_latency: + delay_after_detect: !lambda return id(mmwave_on_latency).state; + delay_after_disappear: !lambda return id(mmwave_off_latency).state; diff --git a/esphome/packages/sensors/voice_assistant-led.yaml b/esphome/packages/sensors/voice_assistant-led.yaml new file mode 100644 index 0000000..16c07cc --- /dev/null +++ b/esphome/packages/sensors/voice_assistant-led.yaml @@ -0,0 +1,101 @@ +i2s_audio: + id: i2s_in + i2s_lrclk_pin: "${i2s_lrclk_pin}" # WS + i2s_bclk_pin: "${i2s_bclk_pin}" # SCK + +microphone: + - platform: i2s_audio + id: mic_i2s + channel: left + adc_type: external + i2s_din_pin: "${i2s_din_pin}" # SD + i2s_audio_id: i2s_in + pdm: false + +voice_assistant: + id: va + microphone: mic_i2s + noise_suppression_level: 2 + auto_gain: 31dBFS + volume_multiplier: 2.0 + on_listening: + - light.turn_on: + id: led + effect: strobe + on_tts_start: + - light.turn_on: + id: led + effect: strobe + on_end: + - delay: 100ms + - script.execute: reset_led + on_error: + - light.turn_on: + id: led + effect: none + - delay: 1s + - script.execute: reset_led + - script.wait: reset_led + - lambda: |- + if (code == "wake-provider-missing" || code == "wake-engine-missing") { + id(use_wake_word).turn_off(); + } + +script: + - id: reset_led + then: + - if: + condition: + - switch.is_on: use_wake_word + - switch.is_on: listen_light + then: + - light.turn_on: + id: led + effect: none + else: + - light.turn_off: led + +switch: + - platform: template + name: "VA Use Wake Word" + id: use_wake_word + optimistic: true + restore_mode: RESTORE_DEFAULT_ON + entity_category: config + on_turn_on: + - lambda: id(va).set_use_wake_word(true); + - if: + condition: + not: + - voice_assistant.is_running + then: + - voice_assistant.start_continuous + - script.execute: reset_led + on_turn_off: + - voice_assistant.stop + - lambda: id(va).set_use_wake_word(false); + - script.execute: reset_led + + - platform: template + name: "VA Listen Light" + id: listen_light + optimistic: true + restore_mode: RESTORE_DEFAULT_ON + entity_category: config + on_turn_on: + - script.execute: reset_led + on_turn_off: + - script.execute: reset_led + +esphome: + min_version: 2023.10.0 + on_boot: + - priority: -100 + then: + - wait_until: api.connected + - delay: 1s + - if: + condition: + switch.is_on: use_wake_word + then: + - voice_assistant.start_continuous: diff --git a/esphome/packages/sensors/voice_assistant-rgb_led.yaml b/esphome/packages/sensors/voice_assistant-rgb_led.yaml new file mode 100644 index 0000000..aa26c73 --- /dev/null +++ b/esphome/packages/sensors/voice_assistant-rgb_led.yaml @@ -0,0 +1,117 @@ +i2s_audio: + id: i2s_in + i2s_lrclk_pin: "${i2s_lrclk_pin}" # WS + i2s_bclk_pin: "${i2s_bclk_pin}" # SCK + +microphone: + - platform: i2s_audio + id: mic_i2s + channel: left + adc_type: external + i2s_din_pin: "${i2s_din_pin}" # SD + i2s_audio_id: i2s_in + pdm: false + +voice_assistant: + id: va + microphone: mic_i2s + noise_suppression_level: 2 + auto_gain: 31dBFS + volume_multiplier: 2.0 + on_listening: + - light.turn_on: + id: led + blue: 100% + red: 0% + green: 0% + brightness: 100% + effect: pulse + on_tts_start: + - light.turn_on: + id: led + blue: 0% + red: 0% + green: 100% + brightness: 100% + effect: pulse + on_end: + - delay: 100ms + - script.execute: reset_led + on_error: + - light.turn_on: + id: led + blue: 0% + red: 100% + green: 0% + brightness: 100% + effect: none + - delay: 1s + - script.execute: reset_led + - script.wait: reset_led + - lambda: |- + if (code == "wake-provider-missing" || code == "wake-engine-missing") { + id(use_wake_word).turn_off(); + } + +script: + - id: reset_led + then: + - if: + condition: + - switch.is_on: use_wake_word + - switch.is_on: listen_light + then: + - light.turn_on: + id: led + blue: 100% + red: 100% + green: 0% + brightness: 100% + effect: none + else: + - light.turn_off: led + +switch: + - platform: template + name: "VA Use Wake Word" + id: use_wake_word + optimistic: true + restore_mode: RESTORE_DEFAULT_ON + entity_category: config + on_turn_on: + - lambda: id(va).set_use_wake_word(true); + - if: + condition: + not: + - voice_assistant.is_running + then: + - voice_assistant.start_continuous + - script.execute: reset_led + on_turn_off: + - voice_assistant.stop + - lambda: id(va).set_use_wake_word(false); + - script.execute: reset_led + + - platform: template + name: "VA Listen Light" + id: listen_light + optimistic: true + restore_mode: RESTORE_DEFAULT_ON + entity_category: config + on_turn_on: + - script.execute: reset_led + on_turn_off: + - script.execute: reset_led + +esphome: + min_version: 2023.10.0 + on_boot: + - priority: -100 + then: + - wait_until: api.connected + - delay: 1s + - if: + condition: + switch.is_on: use_wake_word + then: + - voice_assistant.start_continuous: diff --git a/mkdocs.yml b/mkdocs.yml index 8c910b9..12e70aa 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,18 +1,32 @@ site_name: AIOsense -site_url: https://aiosense.readthedocs.io/en/latest/ +repo_name: Schluggi/AIOsense repo_url: https://github.com/Schluggi/AIOsense -edit_uri: https://github.com/Schluggi/AIOsense/edit/main/docs theme: - name: readthedocs + name: material highlightjs: true + icon: + repo: fontawesome/brands/github + palette: + - scheme: default + toggle: + icon: material/brightness-7 + name: Switch to dark mode + + - scheme: slate + toggle: + icon: material/brightness-4 + name: Switch to light mode + plugins: - - search - awesome-pages: filename: nav.yml strict: false + - search + - social + - tags markdown_extensions: - attr_list # for image scale