-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesp32-voice.yaml
286 lines (245 loc) · 5.73 KB
/
esp32-voice.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
substitutions:
name: esp32-voice
friendly_name: esp32-voice
board: esp32dev
esphome:
name: ${name}
friendly_name: ${friendly_name}
on_boot:
- priority: -100
then:
- wait_until: api.connected
- delay: 1s
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
- priority: 900
then:
lambda: |-
id(cpu_speed) = ESP.getCpuFreqMHz();
esp32:
board: ${board}
framework:
type: arduino #esp-idf
version: recommended
# Enable logging
logger:
level: VERBOSE
# esp32_ble_tracker:
# bluetooth_proxy:
# active: true
# Enable Home Assistant API
api:
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.0.71
gateway: 192.168.0.1
subnet: 255.255.255.0
dns1: 192.168.0.20
dns2: 192.168.0.21
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-Voice Fallback Hotspot"
password: !secret ota_password
captive_portal:
globals:
- id: cpu_speed
type: int
restore_value: no
initial_value: '0'
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO27 #WS
i2s_bclk_pin: GPIO26 #SCK
microphone:
- platform: i2s_audio
adc_type: external
pdm: false
id: mic
channel: right
bits_per_sample: 32bit
i2s_audio_id: i2s_in
i2s_din_pin: GPIO13 #SD Pin from the INMP441 Microphone
# media_player:
# - platform: i2s_audio
# name: "esp_speaker"
# id: media_player_speaker
# i2s_audio_id: i2s_in
# dac_type: external
# i2s_dout_pin: GPIO25 # DIN Pin of the MAX98357A Audio Amplifier
# mode: mono
speaker:
- platform: i2s_audio
id: esp_speaker
dac_type: external
i2s_dout_pin: GPIO25
mode: mono
voice_assistant:
microphone: mic
id: va
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 4.0
use_wake_word: false
# media_player: media_player_speaker
speaker: esp_speaker
on_wake_word_detected:
- light.turn_on:
id: led_light
on_listening:
- light.turn_on:
id: led_light
effect: "Scan Effect With Custom Values"
red: 63%
green: 13%
blue: 93%
on_stt_end:
- light.turn_on:
id: led_light
effect: "None"
red: 0%
green: 100%
blue: 0%
on_error:
- light.turn_on:
id: led_light
effect: "None"
- if:
condition:
switch.is_on: use_wake_word
then:
- switch.turn_off: use_wake_word
- delay: 1sec
- switch.turn_on: use_wake_word
on_client_connected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_client_disconnected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
on_end:
- light.turn_off:
id: led_light
binary_sensor:
- platform: status
name: API Connection
id: api_connection
filters:
- delayed_on: 1s
on_press:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_release:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
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
on_turn_off:
- voice_assistant.stop
- lambda: id(va).set_use_wake_word(false);
wled:
light:
- platform: neopixelbus
id: led_light
type: grb
pin: GPIO32 # DIN pin of the LED Strip
num_leds: 30 # change the Number of LEDS accordign to your LED Strip.
name: "Light"
variant: ws2813
default_transition_length: 0.5s
effects:
- addressable_scan:
name: Scan Effect With Custom Values
move_interval: 50ms
scan_width: 2
sensor:
- platform: template
name: "ESP CPU Speed"
accuracy_decimals: 0
unit_of_measurement: Mhz
lambda: |-
return (id(cpu_speed));
entity_category: "diagnostic"
update_interval: 600s
- platform: template
id: sys_esp_temperature
name: ESP Temperature
lambda: return temperatureRead();
unit_of_measurement: °C
device_class: TEMPERATURE
update_interval: 45s
entity_category: "diagnostic"
- platform: uptime
name: Uptime
id: sys_uptime
update_interval: 60s
- platform: wifi_signal
name: RSSI
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: template
id: esp_memory
icon: mdi:memory
name: ESP Free Memory
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
unit_of_measurement: 'kB'
state_class: measurement
entity_category: "diagnostic"
update_interval: 60s
time:
- platform: sntp
id: time_now
button:
- platform: restart
icon: mdi:power-cycle
name: "ESP Reboot"
- platform: factory_reset
disabled_by_default: True
name: Factory Reset
id: factory_reset_al
text_sensor:
- platform: wifi_info
ip_address:
name: IP Address
ssid:
name: Connected SSID
bssid:
name: Connected BSSID
mac_address:
name: MAC Wifi Address
scan_results:
name: Latest Scan Results
dns_address:
name: DNS Address