Skip to content

Commit

Permalink
Merge branch 'main' into min_version
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz committed Jul 25, 2024
2 parents 10ce963 + 05f8f62 commit 945ec08
Show file tree
Hide file tree
Showing 6 changed files with 336 additions and 108 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
run: |
sed -i 's/${{ steps.esphome-build.outputs.name }}\//\/${{ matrix.firmware }}\/${{ matrix.device }}\//g' output/${{ matrix.device }}/manifest.json
- uses: actions/[email protected]
if: ${{ ! contains(matrix.device, 'adopted') }}
with:
name: build-${{ matrix.firmware }}-${{ matrix.device }}
path: output
Expand All @@ -102,7 +103,7 @@ jobs:
- project: esphome-web
name: ESPHome Web
steps:
- uses: actions/[email protected].7
- uses: actions/[email protected].8
with:
pattern: build-${{ matrix.project }}-*
merge-multiple: true
Expand Down Expand Up @@ -134,7 +135,7 @@ jobs:
- project: media-player
name: Media Player
steps:
- uses: actions/[email protected].7
- uses: actions/[email protected].8
with:
pattern: build-${{ matrix.project }}-*
merge-multiple: true
Expand Down Expand Up @@ -164,7 +165,7 @@ jobs:
- full-manifests
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected].7
- uses: actions/[email protected].8
with:
pattern: "!build-*"
path: output
Expand Down
280 changes: 280 additions & 0 deletions voice-assistant/m5stack-atom-echo.adopted.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
---
esphome:
name: m5stack-atom-echo
friendly_name: M5Stack Atom Echo
min_version: 2024.6.0
name_add_mac_suffix: true

esp32:
board: m5stack-atom
framework:
type: esp-idf

logger:
api:

ota:
- platform: esphome
id: ota_esphome

wifi:
ap:

button:
- platform: safe_mode
id: button_safe_mode
name: Safe Mode Boot

- platform: factory_reset
id: factory_reset_btn
name: Factory reset

i2s_audio:
- id: i2s_audio_bus
i2s_lrclk_pin: GPIO33
i2s_bclk_pin: GPIO19

microphone:
- platform: i2s_audio
id: echo_microphone
i2s_din_pin: GPIO23
adc_type: external
pdm: true

speaker:
- platform: i2s_audio
id: echo_speaker
i2s_dout_pin: GPIO22
dac_type: external
mode: mono

voice_assistant:
id: va
microphone: echo_microphone
speaker: echo_speaker
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 2.0
vad_threshold: 3
on_listening:
- light.turn_on:
id: led
blue: 100%
red: 0%
green: 0%
effect: "Slow Pulse"
on_stt_vad_end:
- light.turn_on:
id: led
blue: 100%
red: 0%
green: 0%
effect: "Fast Pulse"
on_tts_start:
- light.turn_on:
id: led
blue: 100%
red: 0%
green: 0%
brightness: 100%
effect: none
on_end:
- delay: 100ms
- wait_until:
not:
speaker.is_playing:
- script.execute: reset_led
on_error:
- light.turn_on:
id: led
red: 100%
green: 0%
blue: 0%
brightness: 100%
effect: none
- delay: 1s
- 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:
- light.turn_off: led
- switch.turn_off: timer_ringing
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
- script.execute: reset_led

binary_sensor:
- platform: gpio
pin:
number: GPIO39
inverted: true
name: Button
disabled_by_default: true
entity_category: diagnostic
id: echo_button
on_multi_click:
- timing:
- ON for at least 50ms
- OFF for at least 50ms
then:
- 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:
- timing:
- ON for at least 10s
then:
- button.press: factory_reset_btn

light:
- platform: esp32_rmt_led_strip
id: led
name: None
disabled_by_default: true
entity_category: config
pin: GPIO27
default_transition_length: 0s
chipset: SK6812
num_leds: 1
rgb_order: grb
rmt_channel: 0
effects:
- pulse:
name: "Slow Pulse"
transition_length: 250ms
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: github://jesserockz/esphome-components
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
4 changes: 2 additions & 2 deletions voice-assistant/m5stack-atom-echo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ esphome:
name_add_mac_suffix: true
project:
name: m5stack.atom-echo-voice-assistant
version: "24.7.4.1"
version: "24.7.24"

esp32:
board: m5stack-atom
Expand All @@ -31,7 +31,7 @@ update:
http_request:

dashboard_import:
package_import_url: github://esphome/firmware/voice-assistant/m5stack-atom-echo.yaml@main
package_import_url: github://esphome/firmware/voice-assistant/m5stack-atom-echo.adopted.yaml@main

wifi:
on_connect:
Expand Down
Loading

0 comments on commit 945ec08

Please sign in to comment.