98 lines
2.6 KiB
YAML
98 lines
2.6 KiB
YAML
# ===== Wake Word Sensitivity =====
|
|
select:
|
|
- platform: template
|
|
name: "Wake Word Sensitivity"
|
|
optimistic: true
|
|
initial_option: "Slightly sensitive"
|
|
restore_value: true
|
|
entity_category: config
|
|
icon: mdi:ear-hearing
|
|
options:
|
|
- Slightly sensitive
|
|
- Moderately sensitive
|
|
- Very sensitive
|
|
on_value:
|
|
lambda: |-
|
|
if (x == "Slightly sensitive") {
|
|
id(wake_word_model).set_probability_cutoff(247); // 0.97
|
|
} else if (x == "Moderately sensitive") {
|
|
id(wake_word_model).set_probability_cutoff(235); // 0.92
|
|
} else if (x == "Very sensitive") {
|
|
id(wake_word_model).set_probability_cutoff(212); // 0.83
|
|
}
|
|
|
|
# ===== Voice Assistant =====
|
|
voice_assistant:
|
|
id: va
|
|
microphone: mic
|
|
speaker: spk
|
|
micro_wake_word: mww
|
|
noise_suppression_level: ${mic_noise_suppression_level}
|
|
auto_gain: ${mic_auto_gain}
|
|
volume_multiplier: ${mic_volume_multiplier}
|
|
on_listening:
|
|
- logger.log: "[VA] on_listening — mic open, sending audio to HA"
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Listening Pulse"
|
|
on_stt_vad_end:
|
|
- logger.log: "[VA] on_stt_vad_end — speech detected, processing"
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Processing"
|
|
on_stt_end:
|
|
- lambda: |-
|
|
ESP_LOGI("va", "STT result: %s", x.c_str());
|
|
- light.turn_off:
|
|
id: led_bar
|
|
on_tts_start:
|
|
- lambda: |-
|
|
ESP_LOGI("va", "TTS start: %s", x.c_str());
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Speaking"
|
|
on_tts_end:
|
|
- logger.log: "[VA] on_tts_end"
|
|
on_tts_stream_end:
|
|
- logger.log: "[VA] on_tts_stream_end"
|
|
on_error:
|
|
- lambda: |-
|
|
ESP_LOGE("va", "VA error: code=%s, message=%s", code.c_str(), message.c_str());
|
|
- if:
|
|
condition:
|
|
lambda: 'return code != "duplicate_wake_up_detected";'
|
|
then:
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Error Flash"
|
|
- delay: 2s
|
|
- micro_wake_word.start:
|
|
on_end:
|
|
- logger.log: "[VA] on_end"
|
|
- wait_until:
|
|
not:
|
|
voice_assistant.is_running:
|
|
- light.turn_off:
|
|
id: led_bar
|
|
- if:
|
|
condition:
|
|
and:
|
|
- voice_assistant.connected:
|
|
- not:
|
|
micro_wake_word.is_running:
|
|
then:
|
|
- micro_wake_word.start:
|
|
on_idle:
|
|
- logger.log: "[VA] on_idle"
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Idle Breathe"
|
|
- if:
|
|
condition:
|
|
and:
|
|
- voice_assistant.connected:
|
|
- not:
|
|
micro_wake_word.is_running:
|
|
then:
|
|
- micro_wake_word.start:
|