-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathesp32-audiokit-voice-assistant.yaml
190 lines (166 loc) · 3.5 KB
/
esp32-audiokit-voice-assistant.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
substitutions:
friendly_name: ESP32 AudioKit - voice assistant
# Audiokit Buttons
KEY1: "36"
KEY2: "13" # may be in use for other purposes, see onboard config switch
KEY3: "19" # also activates LED D4 if pressed
KEY4: "23" # do not use on A1S V2.3 with initial pinout -> I2C ES8388
KEY5: "18" # do not use on A1S V2.3 with initial pinout -> I2C ES8388
KEY6: "5" # do not use on A1S V2.3 with initial pinout -> I2S
# Audiokit LEDs
LED_D4: "22"
LED_D5: ${KEY3}
esp32:
board: esp32dev
esphome:
name: esp32-audiokit-voice-assistant
min_version: 2023.5.0
# enable amplifier
on_boot:
then:
- switch.turn_on: gpio_amp
external_components:
source:
type: git
url: https://github.com/sehraf/esphome-components
ref: main
components: [ac101]
refresh: 1s
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "..."
ota:
password: "..."
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-Audiokit-Voice-Assistant"
password: "..."
captive_portal:
status_led:
pin:
number: ${LED_D4}
inverted: true
allow_other_uses: true
# buttons
binary_sensor:
- platform: gpio
pin:
number: ${KEY2}
inverted: true
mode: INPUT_PULLUP
name: Volume Down
on_click:
- media_player.volume_down: media_out
- platform: gpio
pin:
number: ${KEY3}
inverted: true
mode: INPUT_PULLUP
allow_other_uses: true
name: Volume Up
on_click:
- media_player.volume_up: media_out
- platform: gpio
pin:
number: ${KEY4}
inverted: true
mode: INPUT_PULLUP
name: Voice Assistant
id: echo_button
on_press:
- voice_assistant.start:
on_release:
- voice_assistant.stop:
on_click:
- media_player.toggle: media_out
- platform: gpio
pin:
number: ${KEY5}
inverted: true
mode: INPUT_PULLUP
name: Web Radio
on_click:
- media_player.play_media: http://listener3.mp3.tb-group.fm/hb.mp3
- platform: gpio
pin:
number: GPIO39
inverted: true
mode:
input: true
name: "Jack Status"
# voice assistant
voice_assistant:
microphone: mic_id
speaker: speaker_out
# I2S Audio
i2s_audio:
i2s_lrclk_pin: 26
i2s_bclk_pin: 27
microphone:
- platform: i2s_audio
adc_type: external
i2s_din_pin: 35
pdm: false
id: mic_id
bits_per_sample: 16bit
media_player:
- platform: i2s_audio
id: media_out
name: Media Player
dac_type: external
i2s_dout_pin:
number: 25
allow_other_uses: true
mode: stereo
# on_play:
# switch.turn_on: gpio_amp
# on_idle:
# switch.turn_off: gpio_amp
speaker:
- platform: i2s_audio
id: speaker_out
dac_type: external
i2s_dout_pin:
number: 25
allow_other_uses: true
mode: mono
# AC101 (I2C)
i2c:
sda: 33
scl: 32
scan: true
ac101:
# address: 0x1a
# Amplifier
switch:
- platform: gpio
pin: 21
name: "AMP Switch"
id: gpio_amp
restore_mode: ALWAYS_ON
light:
- platform: binary
name: "Test LED 1"
output: light_output_1
- platform: binary
name: "Test LED 2"
output: light_output_2
output:
- id: light_output_1
platform: gpio
pin:
number: ${LED_D4}
inverted: true
allow_other_uses: true
- id: light_output_2
platform: gpio
pin:
number: ${LED_D5}
inverted: true
allow_other_uses: true