config files on 28-11-2023 12:46:43
This commit is contained in:
@@ -17,79 +17,197 @@ substitutions:
|
||||
pin_LEDS: GPIO27
|
||||
|
||||
packages:
|
||||
board: !include boards/m5atom.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
device_base: !include common/common.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
friendly_name: ${friendly_name}
|
||||
project:
|
||||
name: m5stack.atom-echo-voice-assistant
|
||||
version: "1.0"
|
||||
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:
|
||||
|
||||
esp32:
|
||||
board: m5stack-atom
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
improv_serial:
|
||||
|
||||
i2s_audio:
|
||||
i2s_lrclk_pin: ${pin_lrclk}
|
||||
i2s_bclk_pin: ${pin_bclk}
|
||||
i2s_lrclk_pin: GPIO33
|
||||
i2s_bclk_pin: GPIO19
|
||||
|
||||
microphone:
|
||||
- platform: i2s_audio
|
||||
id: atom_mic
|
||||
i2s_din_pin: ${pin_i2sdin}
|
||||
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:
|
||||
microphone: atom_mic
|
||||
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%
|
||||
brightness: 100%
|
||||
effect: pulse
|
||||
on_tts_start:
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: led
|
||||
brightness: 100%
|
||||
red: 0
|
||||
green: 100%
|
||||
blue: 0
|
||||
on_tts_end:
|
||||
then:
|
||||
- light.turn_off:
|
||||
id: led
|
||||
- light.turn_on:
|
||||
id: led
|
||||
blue: 0%
|
||||
red: 0%
|
||||
green: 100%
|
||||
brightness: 100%
|
||||
effect: pulse
|
||||
on_end:
|
||||
- delay: 100ms
|
||||
- wait_until:
|
||||
not:
|
||||
speaker.is_playing:
|
||||
- script.execute: reset_led
|
||||
on_error:
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: led
|
||||
brightness: 100%
|
||||
red: 100%
|
||||
green: 0%
|
||||
blue: 0
|
||||
- delay: 5s
|
||||
- light.turn_off:
|
||||
id: led
|
||||
|
||||
media_player:
|
||||
- platform: i2s_audio
|
||||
id: media_out
|
||||
name: "mediaplayer"
|
||||
dac_type: external
|
||||
i2s_dout_pin: ${pin_i2sdout}
|
||||
mode: mono
|
||||
- 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();
|
||||
}
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: ${pin_button}
|
||||
number: GPIO39
|
||||
inverted: true
|
||||
name: "button"
|
||||
on_press:
|
||||
- voice_assistant.start:
|
||||
on_release:
|
||||
- voice_assistant.stop:
|
||||
name: Button
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
id: echo_button
|
||||
on_click:
|
||||
- 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:
|
||||
|
||||
light:
|
||||
- platform: neopixelbus
|
||||
type: GRB
|
||||
variant: ws2812X
|
||||
pin: ${pin_LEDS}
|
||||
num_leds: 1
|
||||
name: "RGB_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:
|
||||
- random:
|
||||
name: "Random"
|
||||
transition_length: 4s
|
||||
update_interval: 5s
|
||||
- addressable_rainbow:
|
||||
name: Rainbow Effect
|
||||
speed: 10
|
||||
width: 50
|
||||
- pulse:
|
||||
transition_length: 250ms
|
||||
update_interval: 250ms
|
||||
|
||||
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
|
||||
blue: 100%
|
||||
red: 100%
|
||||
green: 0%
|
||||
brightness: 100%
|
||||
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
|
||||
|
||||
external_components:
|
||||
- source: github://pr#5230
|
||||
components:
|
||||
- esp_adf
|
||||
refresh: 0s
|
||||
|
||||
esp_adf:
|
||||
Reference in New Issue
Block a user