@@ -8,7 +8,19 @@ esphome:
8
8
project :
9
9
name : esphome.voice-assistant
10
10
version : " 1.0"
11
- min_version : 2023.11.4
11
+ min_version : 2023.11.5
12
+ on_boot :
13
+ priority : 600
14
+ then :
15
+ - display.page.show : initializing_page
16
+ - component.update : s3_box_lcd
17
+ - delay : 30s
18
+ - if :
19
+ condition :
20
+ lambda : return id(init_in_progress);
21
+ then :
22
+ - lambda : id(init_in_progress) = false;
23
+ - script.execute : reset_display
12
24
13
25
esp32 :
14
26
board : esp32s3box
@@ -37,11 +49,9 @@ external_components:
37
49
38
50
api :
39
51
on_client_connected :
40
- then :
41
- - script.execute : reset_display
52
+ - script.execute : reset_display
42
53
on_client_disconnected :
43
- then :
44
- - script.execute : reset_display
54
+ - script.execute : reset_display
45
55
46
56
ota :
47
57
logger :
@@ -53,14 +63,12 @@ dashboard_import:
53
63
wifi :
54
64
ap :
55
65
on_connect :
56
- then :
57
- - script.execute : reset_display
58
- - delay : 5s # Gives time for improv results to be transmitted
59
- - ble.disable :
66
+ - delay : 5s # Gives time for improv results to be transmitted
67
+ - ble.disable :
68
+ - script.execute : reset_display
60
69
on_disconnect :
61
- then :
62
- - script.execute : reset_display
63
- - ble.enable :
70
+ - ble.enable :
71
+ - script.execute : reset_display
64
72
65
73
improv_serial :
66
74
@@ -103,7 +111,7 @@ binary_sensor:
103
111
else :
104
112
- voice_assistant.start :
105
113
else :
106
- - voice_assistant.stop
114
+ - voice_assistant.stop :
107
115
- delay : 1s
108
116
- script.execute : reset_display
109
117
- script.wait : reset_display
@@ -149,65 +157,73 @@ voice_assistant:
149
157
on_listening :
150
158
- display.page.show : listening_page
151
159
- component.update : s3_box_lcd
152
- on_tts_start :
153
- - display.page.show : talking_page
154
- - component.update : s3_box_lcd
155
- on_end :
156
- - delay : 100ms
157
- - wait_until :
158
- not :
159
- speaker.is_playing :
160
- - script.execute : reset_display
161
160
on_stt_vad_end :
162
161
- display.page.show : thinking_page
163
162
- component.update : s3_box_lcd
164
- on_error :
165
- - display.page.show : error_page
163
+ on_tts_stream_start :
164
+ - display.page.show : replying_page
166
165
- component.update : s3_box_lcd
167
- - delay : 1s
166
+ on_tts_stream_end :
168
167
- script.execute : reset_display
169
- on_client_connected :
168
+ on_error :
170
169
- if :
171
170
condition :
172
- switch.is_on : use_wake_word
173
- then :
174
- - voice_assistant.start_continuous :
171
+ lambda : return !id(init_in_progress);
172
+ then :
173
+ - display.page.show : error_page
174
+ - component.update : s3_box_lcd
175
+ - delay : 1s
175
176
- script.execute : reset_display
176
- on_client_disconnected :
177
+ on_client_connected :
177
178
- if :
178
179
condition :
179
180
switch.is_on : use_wake_word
180
181
then :
181
- - voice_assistant.stop :
182
- - display.page.show : sleeping_page
183
- - component.update : s3_box_lcd
182
+ - wait_until :
183
+ not : ble.enabled
184
+ - voice_assistant.start_continuous :
185
+ - lambda : id(init_in_progress) = false;
186
+ - script.execute : reset_display
187
+ on_client_disconnected :
188
+ - script.execute : reset_display
184
189
185
190
script :
186
191
- id : reset_display
187
192
then :
188
193
- if :
189
194
condition :
190
- wifi.connected :
195
+ lambda : return !id(init_in_progress);
191
196
then :
192
197
- if :
193
198
condition :
194
- api .connected :
199
+ wifi .connected :
195
200
then :
196
201
- if :
197
202
condition :
198
- switch.is_on : use_wake_word
203
+ api.connected :
199
204
then :
200
- - display.page.show : idle_page
201
- - component.update : s3_box_lcd
205
+ - if :
206
+ condition :
207
+ voice_assistant.connected :
208
+ then :
209
+ - if :
210
+ condition :
211
+ switch.is_on : use_wake_word
212
+ then :
213
+ - display.page.show : idle_page
214
+ - component.update : s3_box_lcd
215
+ else :
216
+ - display.page.show : muted_page
217
+ - component.update : s3_box_lcd
218
+ else :
219
+ - display.page.show : no_pipeline_page
220
+ - component.update : s3_box_lcd
202
221
else :
203
- - display.page.show : vad_off_page
222
+ - display.page.show : no_api_page
204
223
- component.update : s3_box_lcd
205
224
else :
206
- - display.page.show : no_api_page
225
+ - display.page.show : no_wifi_page
207
226
- component.update : s3_box_lcd
208
- else :
209
- - display.page.show : no_wifi_page
210
- - component.update : s3_box_lcd
211
227
212
228
switch :
213
229
- platform : template
@@ -230,49 +246,45 @@ switch:
230
246
- lambda : id(va).set_use_wake_word(false);
231
247
- script.execute : reset_display
232
248
249
+ globals :
250
+ - id : init_in_progress
251
+ type : bool
252
+ restore_value : no
253
+ initial_value : ' true'
254
+
233
255
image :
234
- -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
235
- id : casita_error
236
- resize : 200x200
237
- type : RGB24
238
- use_transparency : true
239
- -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
256
+ # Standard path IDLE > LISTENING > THINKING > REPLYING
257
+ -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
240
258
id : casita_idle
241
259
resize : 200x200
242
260
type : RGB24
243
261
use_transparency : true
244
- - file : https://github.com/esphome/firmware/raw/main/voice-assistant/casita/Happy @2x.png
262
+ - file : https://github.com/esphome/firmware/raw/main/voice-assistant/casita/Normal @2x.png
245
263
id : casita_listening
246
264
resize : 200x200
247
265
type : RGB24
248
266
use_transparency : true
249
- -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
250
- id : casita_no_api
251
- resize : 200x200
252
- type : RGB24
253
- use_transparency : true
254
- -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
255
- id : casita_no_wifi
256
- resize : 200x200
257
- type : RGB24
258
- use_transparency : true
259
- -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
260
- id : casita_sleeping
267
+ -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
268
+ id : casita_thinking
261
269
resize : 200x200
262
270
type : RGB24
263
271
use_transparency : true
264
- - file : https://github.com/esphome/firmware/raw/main/voice-assistant/casita/Grinning @2x.png
265
- id : casita_talking
272
+ - file : https://github.com/esphome/firmware/raw/main/voice-assistant/casita/Happy @2x.png
273
+ id : casita_replying
266
274
resize : 200x200
267
275
type : RGB24
268
276
use_transparency : true
269
- -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
270
- id : casita_thinking
277
+
278
+ # Error cases (More specific flies to come soon)
279
+ -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
280
+ id : casita_error
271
281
resize : 200x200
272
282
type : RGB24
273
283
use_transparency : true
274
- -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
275
- id : casita_vad_off
284
+
285
+ # Initialization illustration
286
+ -
file :
https://github.com/esphome/firmware/raw/main/voice-assistant/casita/[email protected]
287
+ id : casita_initializing
276
288
resize : 200x200
277
289
type : RGB24
278
290
use_transparency : true
@@ -293,39 +305,42 @@ display:
293
305
inverted : true
294
306
update_interval : never
295
307
pages :
296
- - id : error_page
297
- lambda : |-
298
- it.fill(Color::WHITE);
299
- it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_error));
300
308
- id : idle_page
301
309
lambda : |-
302
- it.fill(Color::WHITE );
310
+ it.fill(Color::BLACK );
303
311
it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_idle));
304
312
- id : listening_page
305
313
lambda : |-
306
314
it.fill(Color::WHITE);
307
315
it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_listening));
316
+ - id : thinking_page
317
+ lambda : |-
318
+ it.fill(Color::WHITE);
319
+ it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 105, id(casita_thinking));
320
+ - id : replying_page
321
+ lambda : |-
322
+ it.fill(Color::WHITE);
323
+ it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_replying));
324
+ - id : error_page
325
+ lambda : |-
326
+ it.fill(Color::BLACK);
327
+ it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_error));
308
328
- id : no_api_page
309
329
lambda : |-
310
330
it.fill(Color::BLACK);
311
- it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_no_api ));
331
+ it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_error ));
312
332
- id : no_wifi_page
313
333
lambda : |-
314
334
it.fill(Color::BLACK);
315
- it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_no_wifi));
316
- - id : sleeping_page
317
- lambda : |-
318
- it.fill(Color::WHITE);
319
- it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_sleeping));
320
- - id : talking_page
335
+ it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_error));
336
+ - id : no_pipeline_page
321
337
lambda : |-
322
- it.fill(Color::WHITE );
323
- it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_talking ));
324
- - id : thinking_page
338
+ it.fill(Color::BLACK );
339
+ it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_error ));
340
+ - id : initializing_page
325
341
lambda : |-
326
- it.fill(Color::WHITE );
327
- it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 105 , id(casita_thinking ));
328
- - id : vad_off_page
342
+ it.fill(Color::BLACK );
343
+ it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100 , id(casita_initializing ));
344
+ - id : muted_page
329
345
lambda : |-
330
346
it.fill(Color::BLACK);
331
- it.image((it.get_width() / 2) - 100, (it.get_height() / 2) - 100, id(casita_vad_off));
0 commit comments