Compare commits

..

No commits in common. "7221213ac44918a3e37be8da09e58359aab32266" and "565df10fe0bacad895b37136a45bc2f61d96cf68" have entirely different histories.

View File

@ -27,7 +27,6 @@ esphome:
project:
name: joshuaboniface.supersensor
version: "2.0"
min_version: 2025.5.0
on_boot:
- priority: 600
then:
@ -39,9 +38,19 @@ esphome:
- light.turn_on:
id: output_led
effect: flash_white
preferences:
flash_write_interval: 15sec
- priority: -600
then:
- wait_until:
api.connected:
- delay: 5s
- if:
condition:
switch.is_on: enable_voice_support
then:
- logger.log: "Initializing voice assistant on boot"
- switch.turn_off: voice_support_active
- delay: 2s
- switch.turn_on: voice_support_active
dashboard_import:
package_import_url: github://joshuaboniface/supersensor2/supersensor.yaml
@ -50,6 +59,8 @@ 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"
@ -248,28 +259,28 @@ script:
id(supersensor_occupancy).publish_state(new_state);
}
preferences:
flash_write_interval: 15sec
logger:
level: INFO
baud_rate: 115200
api:
reboot_timeout: 15min
on_client_connected:
- script.execute: light_off
- if:
condition:
- switch.is_on: enable_voice_support
then:
- micro_wake_word.start:
on_client_disconnected:
- light.turn_on:
id: output_led
effect: flash_white
- if:
condition:
- switch.is_on: enable_voice_support
then:
- micro_wake_word.stop:
services:
- service: restart_voice_assistant
then:
- logger.log: "Manually restarting voice assistant"
- voice_assistant.stop:
- delay: 2s
- if:
condition:
switch.is_on: enable_voice_support
then:
- switch.turn_off: voice_support_active
- delay: 1s
- switch.turn_on: voice_support_active
ota:
platform: esphome
@ -296,7 +307,44 @@ time:
then:
- logger.log: "Time synchronized with Home Assistant"
uart:
id: ld2410_uart
rx_pin: GPIO19
tx_pin: GPIO18
baud_rate: 256000
data_bits: 8
stop_bits: 1
parity: NONE
i2c:
sda: GPIO27
scl: GPIO26
scan: true
i2s_audio:
i2s_lrclk_pin: GPIO17 # WS
i2s_bclk_pin: GPIO16 # SCK
microphone:
- platform: i2s_audio
id: mic
adc_type: external
i2s_din_pin: GPIO4 # SD
pdm: false
interval:
- interval: 5s
then:
- if:
condition:
and:
- switch.is_on: enable_voice_support
- switch.is_on: voice_support_active
- not: voice_assistant.is_running
then:
- logger.log: "Voice assistant not running but should be; restarting"
- voice_assistant.start_continuous:
# Regular state reporting to HASS
- interval: 30s
then:
@ -316,72 +364,59 @@ interval:
App.safe_reboot();
}
uart:
id: ld2410_uart
rx_pin: GPIO19
tx_pin: GPIO18
baud_rate: 256000
data_bits: 8
stop_bits: 1
parity: NONE
i2c:
sda: GPIO27
scl: GPIO26
scan: true
i2s_audio:
- id: i2s_input
i2s_lrclk_pin:
number: GPIO17 # WS
i2s_bclk_pin:
number: GPIO16 # SCK
microphone:
- platform: i2s_audio
id: mic
i2s_audio_id: i2s_input
i2s_din_pin: GPIO4 # SD
adc_type: external
pdm: false
channel: left
micro_wake_word:
id: mww
microphone:
microphone: mic
gain_factor: 31
stop_after_detection: false
models:
- model: hey_jarvis
id: mww_hey_jarvis
- model: hey_mycroft
id: mww_hey_mycroft
- model: ok_nabu
id: mww_okay_nabu
- model: alexa
id: mww_alexa
vad:
on_wake_word_detected:
- logger.log: "A wake word was detected!"
- if:
condition:
voice_assistant.is_running:
then:
voice_assistant.stop:
- voice_assistant.start:
wake_word: !lambda return wake_word;
then:
- voice_assistant.start:
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
voice_assistant:
id: va
microphone: mic
micro_wake_word: mww
use_wake_word: false
noise_suppression_level: 0
auto_gain: 31 dbfs
volume_multiplier: 8
noise_suppression_level: 3
auto_gain: 31dBFS
volume_multiplier: 8.0
id: assist
on_error:
- logger.log: "voice error"
- if:
condition:
and:
- switch.is_on: voice_support_active
- not: voice_assistant.is_running
then:
- voice_assistant.start_continuous:
on_end:
- logger.log: "voice ended"
- if:
condition:
and:
- switch.is_on: voice_support_active
- not: voice_assistant.is_running
then:
- voice_assistant.start_continuous:
on_client_connected:
- light.turn_off:
id: output_led
transition_length: 2s
- script.execute: light_off
- lambda: |-
id(voice_support_active).publish_state(true);
on_client_disconnected:
- light.turn_on:
id: output_led
effect: flash_white
on_wake_word_detected:
- logger.log: "Wake word detected in VA pipeline"
- light.turn_on:
id: output_led
brightness: 100%
@ -389,7 +424,6 @@ voice_assistant:
green: 0
blue: 1
on_listening:
- logger.log: "Listening for commands"
- light.turn_on:
id: output_led
brightness: 100%
@ -397,13 +431,14 @@ voice_assistant:
green: 0
blue: 1
on_stt_vad_end:
- logger.log: "Processing STT result"
- light.turn_on:
id: output_led
brightness: 75%
red: 0
green: 1
blue: 1
blue: 1
on_stt_end:
- script.execute: light_off
on_tts_start:
- if:
condition:
@ -650,6 +685,16 @@ sensor:
update_interval: 5s
entity_category: diagnostic
- platform: template
name: "ESP32 CPU Frequency"
icon: mdi:cpu-32-bit
accuracy_decimals: 1
unit_of_measurement: MHz
update_interval: 5s
lambda: |-
return ets_get_cpu_frequency();
entity_category: diagnostic
- platform: template
name: "ESP32 Free Memory"
icon: mdi:memory
@ -673,9 +718,7 @@ binary_sensor:
- platform: gpio
name: "PIR GPIO"
id: pir_gpio
pin:
number: GPIO32
mode: INPUT_PULLUP
pin: GPIO32
internal: false
device_class: motion
on_press:
@ -746,9 +789,26 @@ switch:
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
- micro_wake_word.start:
- switch.turn_on: voice_support_active
on_turn_off:
- micro_wake_word.stop:
- switch.turn_off: voice_support_active
# Active voice support flag/switch
- platform: template
name: "Voice Support Active"
icon: mdi:account-voice
id: voice_support_active
optimistic: true
restore_mode: ALWAYS_OFF
entity_category: config
on_turn_on:
- lambda: id(assist).set_use_wake_word(true);
- voice_assistant.stop:
- delay: 1s
- voice_assistant.start_continuous:
on_turn_off:
- voice_assistant.stop:
- lambda: id(assist).set_use_wake_word(false);
# Global enable/disable for presence LED
- platform: template
@ -772,12 +832,12 @@ switch:
number:
# Temperature offset:
# A calibration from -30 to +5 for the temperature sensor
# A calibration from -10 to +5 for the temperature sensor
- platform: template
name: "Temperature Offset"
id: temperature_offset_setter
min_value: -30
max_value: 10
min_value: -10
max_value: 5
step: 0.1
lambda: |-
return id(temperature_offset);
@ -788,12 +848,12 @@ number:
value: !lambda 'return float(x);'
# Humidity offset:
# A calibration from -20 to +20 for the humidity sensor
# A calibration from -10 to +10 for the humidity sensor
- platform: template
name: "Humidity Offset"
id: humidity_offset_setter
min_value: -20
max_value: 20
min_value: -10
max_value: 10
step: 0.1
lambda: |-
return id(humidity_offset);
@ -891,6 +951,7 @@ number:
name: "LD2410C Gate8 Still Threshold"
select:
# Occupancy Detect Mode:
# This selector defines the detection mode for the integrated occupancy sensor. Depending on the
# selected option, only the given sensor(s) will be used to judge when occupancy begins (i.e.
@ -1019,39 +1080,6 @@ select:
distance_resolution:
name: "LD2410C Distance Resolution"
- platform: template
name: "Wake word sensitivity"
optimistic: true
initial_option: Moderately sensitive
restore_value: true
entity_category: config
options:
- Slightly sensitive
- Moderately sensitive
- Very sensitive
on_value:
# Sets specific wake word probabilities computed for each particular model
# Note probability cutoffs are set as a quantized uint8 value, each comment has the corresponding floating point cutoff
# False Accepts per Hour values are tested against all units and channels from the Dinner Party Corpus.
# These cutoffs apply only to the specific models included in the firmware: okay_nabu@20241226.3, hey_jarvis@v2, hey_mycroft@v2
lambda: |-
if (x == "Slightly sensitive") {
id(mww_jarvis).set_probability_cutoff(247); // 0.97 -> 0.563 FAPH on DipCo (Manifest's default)
id(mww_hey_mycroft).set_probability_cutoff(253); // 0.99 -> 0.567 FAPH on DipCo
id(mww_okay_nabu).set_probability_cutoff(217); // 0.85 -> 0.000 FAPH on DipCo (Manifest's default)
id(mww_alexa).set_probability_cutoff(217); // 0.85 -> 0.000 FAPH on DipCo (Manifest's default)
} else if (x == "Moderately sensitive") {
id(mww_hey_jarvis).set_probability_cutoff(235); // 0.92 -> 0.939 FAPH on DipCo
id(mww_hey_mycroft).set_probability_cutoff(242); // 0.95 -> 1.502 FAPH on DipCo (Manifest's default)
id(mww_okay_nabu).set_probability_cutoff(176); // 0.69 -> 0.376 FAPH on DipCo
id(mww_alexa).set_probability_cutoff(176); // 0.69 -> 0.376 FAPH on DipCo
} else if (x == "Very sensitive") {
id(mww_hey_jarvis).set_probability_cutoff(212); // 0.83 -> 1.502 FAPH on DipCo
id(mww_hey_mycroft).set_probability_cutoff(237); // 0.93 -> 1.878 FAPH on DipCo
id(mww_okay_nabu).set_probability_cutoff(143); // 0.56 -> 0.751 FAPH on DipCo
id(mww_alexa).set_probability_cutoff(143); // 0.56 -> 0.751 FAPH on DipCo
}
text_sensor:
- platform: wifi_info
ip_address: