2023-05-27 15:28:18 +02:00
|
|
|
substitutions:
|
|
|
|
name: "m5stack-atom-echo"
|
|
|
|
friendly_name: "M5Stack Atom Echo"
|
|
|
|
|
|
|
|
esphome:
|
|
|
|
name: ${name}
|
|
|
|
friendly_name: ${friendly_name}
|
|
|
|
name_add_mac_suffix: False
|
|
|
|
project:
|
2025-01-06 09:12:47 +01:00
|
|
|
name: m5stack.atom-echo-voice-assistant
|
|
|
|
version: "24.7.24"
|
|
|
|
min_version: 2024.9.0
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
esp32:
|
|
|
|
board: m5stack-atom
|
|
|
|
framework:
|
2025-01-06 09:12:47 +01:00
|
|
|
type: esp-idf
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
# Enable Home Assistant API
|
|
|
|
api:
|
|
|
|
encryption:
|
|
|
|
key: !secret apikey
|
2024-07-01 14:02:31 +02:00
|
|
|
|
2023-05-27 15:28:18 +02:00
|
|
|
ota:
|
2025-01-06 09:12:47 +01:00
|
|
|
- platform: esphome
|
|
|
|
password: !secret ota
|
|
|
|
id: ota_esphome
|
|
|
|
- platform: http_request
|
|
|
|
id: ota_http_request
|
|
|
|
|
|
|
|
update:
|
|
|
|
- platform: http_request
|
|
|
|
id: update_http_request
|
|
|
|
name: Firmware
|
|
|
|
source: https://firmware.esphome.io/voice-assistant/m5stack-atom-echo/manifest.json
|
|
|
|
|
|
|
|
http_request:
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
wifi:
|
2025-01-06 09:12:47 +01:00
|
|
|
on_connect:
|
|
|
|
- delay: 5s # Gives time for improv results to be transmitted
|
|
|
|
- ble.disable:
|
|
|
|
on_disconnect:
|
|
|
|
- ble.enable:
|
2023-05-27 15:28:18 +02:00
|
|
|
ssid: Voltage-legacy
|
|
|
|
password: !secret voltage_legacy_psk
|
2023-05-27 16:52:05 +02:00
|
|
|
use_address: ${name}.home
|
2023-05-27 15:28:18 +02:00
|
|
|
power_save_mode: high
|
|
|
|
fast_connect: on
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
|
|
ap:
|
|
|
|
ssid: "Raspiaudio Fallback Hotspot"
|
|
|
|
password: !secret fallback_psk
|
|
|
|
|
2025-01-06 09:12:47 +01:00
|
|
|
improv_serial:
|
|
|
|
|
|
|
|
esp32_improv:
|
|
|
|
authorizer: none
|
|
|
|
|
2023-05-27 15:28:18 +02:00
|
|
|
logger:
|
|
|
|
|
|
|
|
dashboard_import:
|
2025-01-06 09:12:47 +01:00
|
|
|
package_import_url: github://esphome/firmware/voice-assistant/m5stack-atom-echo.adopted.yaml@main
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
captive_portal:
|
|
|
|
|
2025-01-06 09:12:47 +01:00
|
|
|
button:
|
|
|
|
- platform: safe_mode
|
|
|
|
id: button_safe_mode
|
|
|
|
name: Safe Mode Boot
|
|
|
|
- platform: factory_reset
|
|
|
|
id: factory_reset_btn
|
|
|
|
name: Factory reset
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
i2s_audio:
|
2025-01-06 09:12:47 +01:00
|
|
|
- id: i2s_audio_bus
|
|
|
|
i2s_lrclk_pin: GPIO33
|
|
|
|
i2s_bclk_pin: GPIO19
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
microphone:
|
|
|
|
- platform: i2s_audio
|
|
|
|
id: echo_microphone
|
|
|
|
i2s_din_pin: GPIO23
|
|
|
|
adc_type: external
|
|
|
|
pdm: true
|
|
|
|
|
2025-01-06 09:12:47 +01:00
|
|
|
speaker:
|
|
|
|
- platform: i2s_audio
|
|
|
|
id: echo_speaker
|
|
|
|
i2s_dout_pin: GPIO22
|
|
|
|
dac_type: external
|
|
|
|
channel: mono
|
|
|
|
|
2023-05-27 15:28:18 +02:00
|
|
|
voice_assistant:
|
2025-01-06 09:12:47 +01:00
|
|
|
id: va
|
2023-05-27 15:28:18 +02:00
|
|
|
microphone: echo_microphone
|
2025-01-06 09:12:47 +01:00
|
|
|
speaker: echo_speaker
|
|
|
|
noise_suppression_level: 2
|
|
|
|
auto_gain: 31dBFS
|
|
|
|
volume_multiplier: 2.0
|
|
|
|
vad_threshold: 3
|
|
|
|
on_listening:
|
2023-05-27 15:28:18 +02:00
|
|
|
- light.turn_on:
|
|
|
|
id: led
|
|
|
|
blue: 100%
|
|
|
|
red: 0%
|
|
|
|
green: 0%
|
2025-01-06 09:12:47 +01:00
|
|
|
effect: "Slow Pulse"
|
|
|
|
on_stt_vad_end:
|
2023-05-27 15:28:18 +02:00
|
|
|
- light.turn_on:
|
|
|
|
id: led
|
2025-01-06 09:12:47 +01:00
|
|
|
blue: 100%
|
2023-05-27 15:28:18 +02:00
|
|
|
red: 0%
|
2025-01-06 09:12:47 +01:00
|
|
|
green: 0%
|
|
|
|
effect: "Fast Pulse"
|
|
|
|
on_tts_start:
|
2023-05-27 15:28:18 +02:00
|
|
|
- light.turn_on:
|
|
|
|
id: led
|
2025-01-06 09:12:47 +01:00
|
|
|
blue: 100%
|
2023-05-27 15:28:18 +02:00
|
|
|
red: 0%
|
2025-01-06 09:12:47 +01:00
|
|
|
green: 0%
|
|
|
|
brightness: 100%
|
|
|
|
effect: none
|
2023-05-27 15:28:18 +02:00
|
|
|
on_end:
|
2025-01-06 09:12:47 +01:00
|
|
|
- delay: 100ms
|
2023-05-27 15:28:18 +02:00
|
|
|
- wait_until:
|
|
|
|
not:
|
2025-01-06 09:12:47 +01:00
|
|
|
speaker.is_playing:
|
|
|
|
- script.execute: reset_led
|
2023-05-27 15:28:18 +02:00
|
|
|
on_error:
|
|
|
|
- light.turn_on:
|
|
|
|
id: led
|
|
|
|
red: 100%
|
|
|
|
green: 0%
|
2025-01-06 09:12:47 +01:00
|
|
|
blue: 0%
|
|
|
|
brightness: 100%
|
2023-05-27 15:28:18 +02:00
|
|
|
effect: none
|
|
|
|
- delay: 1s
|
2025-01-06 09:12:47 +01:00
|
|
|
- script.execute: reset_led
|
|
|
|
on_client_connected:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
switch.is_on: use_wake_word
|
|
|
|
then:
|
|
|
|
- voice_assistant.start_continuous:
|
|
|
|
- script.execute: reset_led
|
|
|
|
on_client_disconnected:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
switch.is_on: use_wake_word
|
|
|
|
then:
|
|
|
|
- voice_assistant.stop:
|
|
|
|
- light.turn_off: led
|
|
|
|
on_timer_finished:
|
|
|
|
- voice_assistant.stop:
|
|
|
|
- switch.turn_on: timer_ringing
|
|
|
|
- wait_until:
|
|
|
|
not:
|
|
|
|
microphone.is_capturing:
|
|
|
|
- light.turn_on:
|
|
|
|
id: led
|
|
|
|
red: 0%
|
|
|
|
green: 100%
|
|
|
|
blue: 0%
|
|
|
|
brightness: 100%
|
|
|
|
effect: "Fast Pulse"
|
|
|
|
- while:
|
|
|
|
condition:
|
|
|
|
switch.is_on: timer_ringing
|
|
|
|
then:
|
|
|
|
- lambda: id(echo_speaker).play(id(timer_finished_wave_file), sizeof(id(timer_finished_wave_file)));
|
|
|
|
- delay: 1s
|
|
|
|
- wait_until:
|
|
|
|
not:
|
|
|
|
speaker.is_playing:
|
2023-05-27 15:28:18 +02:00
|
|
|
- light.turn_off: led
|
2025-01-06 09:12:47 +01:00
|
|
|
- switch.turn_off: timer_ringing
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
switch.is_on: use_wake_word
|
|
|
|
then:
|
|
|
|
- voice_assistant.start_continuous:
|
|
|
|
- script.execute: reset_led
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
binary_sensor:
|
|
|
|
- platform: gpio
|
|
|
|
pin:
|
|
|
|
number: GPIO39
|
|
|
|
inverted: true
|
|
|
|
name: Button
|
2025-01-06 09:12:47 +01:00
|
|
|
disabled_by_default: true
|
|
|
|
entity_category: diagnostic
|
2023-05-27 15:28:18 +02:00
|
|
|
id: echo_button
|
|
|
|
on_multi_click:
|
|
|
|
- timing:
|
2025-01-06 09:12:47 +01:00
|
|
|
- ON for at least 50ms
|
|
|
|
- OFF for at least 50ms
|
2023-05-27 15:28:18 +02:00
|
|
|
then:
|
2025-01-06 09:12:47 +01:00
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
switch.is_on: timer_ringing
|
|
|
|
then:
|
|
|
|
- switch.turn_off: timer_ringing
|
|
|
|
else:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
switch.is_off: use_wake_word
|
|
|
|
then:
|
|
|
|
- if:
|
|
|
|
condition: voice_assistant.is_running
|
|
|
|
then:
|
|
|
|
- voice_assistant.stop:
|
|
|
|
- script.execute: reset_led
|
|
|
|
else:
|
|
|
|
- voice_assistant.start:
|
|
|
|
else:
|
|
|
|
- voice_assistant.stop
|
|
|
|
- delay: 1s
|
|
|
|
- script.execute: reset_led
|
|
|
|
- script.wait: reset_led
|
|
|
|
- voice_assistant.start_continuous:
|
2023-05-27 15:28:18 +02:00
|
|
|
- timing:
|
2025-01-06 09:12:47 +01:00
|
|
|
- ON for at least 10s
|
2023-05-27 15:28:18 +02:00
|
|
|
then:
|
2025-01-06 09:12:47 +01:00
|
|
|
- button.press: factory_reset_btn
|
2023-05-27 15:28:18 +02:00
|
|
|
|
|
|
|
light:
|
|
|
|
- platform: esp32_rmt_led_strip
|
|
|
|
id: led
|
|
|
|
name: None
|
2025-01-06 09:12:47 +01:00
|
|
|
disabled_by_default: true
|
|
|
|
entity_category: config
|
2023-05-27 15:28:18 +02:00
|
|
|
pin: GPIO27
|
|
|
|
default_transition_length: 0s
|
|
|
|
chipset: SK6812
|
|
|
|
num_leds: 1
|
|
|
|
rgb_order: grb
|
|
|
|
rmt_channel: 0
|
|
|
|
effects:
|
|
|
|
- pulse:
|
2025-01-06 09:12:47 +01:00
|
|
|
name: "Slow Pulse"
|
2023-05-27 15:28:18 +02:00
|
|
|
transition_length: 250ms
|
2025-01-06 09:12:47 +01:00
|
|
|
update_interval: 250ms
|
|
|
|
min_brightness: 50%
|
|
|
|
max_brightness: 100%
|
|
|
|
- pulse:
|
|
|
|
name: "Fast Pulse"
|
|
|
|
transition_length: 100ms
|
|
|
|
update_interval: 100ms
|
|
|
|
min_brightness: 50%
|
|
|
|
max_brightness: 100%
|
|
|
|
|
|
|
|
script:
|
|
|
|
- id: reset_led
|
|
|
|
then:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
- switch.is_on: use_wake_word
|
|
|
|
- switch.is_on: use_listen_light
|
|
|
|
then:
|
|
|
|
- light.turn_on:
|
|
|
|
id: led
|
|
|
|
red: 100%
|
|
|
|
green: 89%
|
|
|
|
blue: 71%
|
|
|
|
brightness: 60%
|
|
|
|
effect: none
|
|
|
|
else:
|
|
|
|
- light.turn_off: led
|
|
|
|
|
|
|
|
switch:
|
|
|
|
- platform: template
|
|
|
|
name: 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: Use listen light
|
|
|
|
id: use_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
|
|
|
|
- platform: template
|
|
|
|
id: timer_ringing
|
|
|
|
optimistic: true
|
|
|
|
internal: true
|
|
|
|
restore_mode: ALWAYS_OFF
|
|
|
|
on_turn_on:
|
|
|
|
- delay: 15min
|
|
|
|
- switch.turn_off: timer_ringing
|
|
|
|
|
|
|
|
external_components:
|
|
|
|
- source: github://pr#5230
|
|
|
|
components:
|
|
|
|
- esp_adf
|
|
|
|
refresh: 0s
|
|
|
|
- source:
|
|
|
|
type: git
|
|
|
|
url: https://github.com/jesserockz/esphome-components
|
|
|
|
ref: main
|
|
|
|
components: [file]
|
|
|
|
refresh: 0s
|
|
|
|
|
|
|
|
esp_adf:
|
|
|
|
|
|
|
|
file:
|
|
|
|
- id: timer_finished_wave_file
|
|
|
|
file: https://github.com/esphome/firmware/raw/main/voice-assistant/sounds/timer_finished.wav
|