File size: 65,781 Bytes
c5af1a9
9da872f
91cfdeb
9da872f
91cfdeb
9da872f
91cfdeb
 
 
 
 
 
9da872f
91cfdeb
9da872f
91cfdeb
 
 
 
 
b10ca0f
91cfdeb
 
b10ca0f
9da872f
91cfdeb
9da872f
 
8689b0f
 
 
33becb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8689b0f
33becb5
 
 
 
 
 
 
 
 
 
 
 
 
 
8689b0f
33becb5
 
 
 
 
 
 
 
 
 
 
8689b0f
33becb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8689b0f
33becb5
8689b0f
33becb5
20e58a2
 
 
33becb5
8689b0f
33becb5
 
 
 
 
 
8689b0f
33becb5
 
 
8689b0f
 
33becb5
 
94a04ed
33becb5
8689b0f
9da872f
 
91cfdeb
 
 
 
 
 
20e58a2
91cfdeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a11246
91cfdeb
b10ca0f
91cfdeb
9da872f
 
 
 
91cfdeb
 
 
 
 
 
 
 
 
a6cdaca
 
91cfdeb
 
 
a6cdaca
91cfdeb
a6cdaca
 
91cfdeb
 
 
a6cdaca
 
91cfdeb
b10ca0f
 
 
 
 
 
91cfdeb
b10ca0f
 
91cfdeb
 
 
9da872f
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91cfdeb
4467722
b10ca0f
 
4467722
b10ca0f
 
 
 
 
 
 
4467722
b10ca0f
 
 
 
91cfdeb
b10ca0f
91cfdeb
b10ca0f
91cfdeb
b10ca0f
91cfdeb
 
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91cfdeb
 
b10ca0f
 
 
 
 
 
91cfdeb
 
 
b10ca0f
91cfdeb
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d84e937
f7f01c8
d84e937
 
f7f01c8
d84e937
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9abf97
 
 
 
 
26e543e
 
 
 
 
 
 
 
 
 
 
 
b9abf97
b10ca0f
 
b9abf97
b10ca0f
b9abf97
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
b9abf97
91cfdeb
4467722
f3abae3
 
b10ca0f
f3abae3
b10ca0f
f3abae3
b10ca0f
f3abae3
b10ca0f
 
91cfdeb
 
b10ca0f
 
f7f01c8
f3abae3
91cfdeb
 
 
 
f7f01c8
f3abae3
b10ca0f
 
 
 
 
 
 
 
f7f01c8
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d84e937
f3abae3
91cfdeb
f3abae3
91cfdeb
d84e937
 
 
 
 
 
 
 
f3abae3
91cfdeb
b10ca0f
 
 
d84e937
b10ca0f
 
 
 
 
d84e937
b10ca0f
 
f3abae3
78b7237
91cfdeb
 
78b7237
 
 
91cfdeb
a33ba57
b10ca0f
d84e937
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
78b7237
 
 
 
b10ca0f
78b7237
b10ca0f
 
 
 
 
 
78b7237
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
a33ba57
91cfdeb
a33ba57
b10ca0f
 
 
 
 
 
 
a6cdaca
 
 
 
 
91cfdeb
b10ca0f
 
 
a33ba57
a6cdaca
 
 
 
 
 
91cfdeb
 
 
a33ba57
b10ca0f
a6cdaca
 
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
a6cdaca
a33ba57
91cfdeb
a33ba57
b10ca0f
a6cdaca
 
 
 
a33ba57
b10ca0f
a6cdaca
 
 
a33ba57
b10ca0f
a33ba57
91cfdeb
a33ba57
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
a33ba57
b10ca0f
 
 
 
 
 
 
 
 
a33ba57
91cfdeb
b10ca0f
91cfdeb
b10ca0f
 
 
 
 
 
 
a33ba57
b10ca0f
a33ba57
b10ca0f
 
 
 
 
 
 
 
 
 
20e58a2
a33ba57
20e58a2
 
 
 
a33ba57
b10ca0f
20e58a2
 
 
b10ca0f
91cfdeb
a33ba57
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a33ba57
 
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a6cdaca
 
 
 
 
b10ca0f
 
a6cdaca
 
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9e2e76
91cfdeb
 
 
b10ca0f
 
a6cdaca
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f422a0
 
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91cfdeb
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91cfdeb
 
b10ca0f
91cfdeb
b10ca0f
 
91cfdeb
 
 
b10ca0f
 
91cfdeb
b10ca0f
91cfdeb
 
 
 
 
b10ca0f
 
91cfdeb
b10ca0f
91cfdeb
 
 
 
 
b10ca0f
 
91cfdeb
b10ca0f
91cfdeb
 
b10ca0f
 
91cfdeb
 
b10ca0f
91cfdeb
b10ca0f
91cfdeb
b10ca0f
91cfdeb
b10ca0f
91cfdeb
99f80f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f422a0
 
b9e2e76
b10ca0f
9da872f
 
91cfdeb
9da872f
91cfdeb
 
 
9da872f
91cfdeb
9da872f
 
 
 
 
 
 
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91cfdeb
9da872f
 
 
91cfdeb
9da872f
 
b10ca0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91cfdeb
9da872f
 
 
8689b0f
 
 
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
# Reachy Mini for Home Assistant - Project Plan

## Project Overview

Integrate Home Assistant voice assistant functionality into Reachy Mini Wi-Fi robot, communicating with Home Assistant via ESPHome protocol.

## Local Reference Directories (DO NOT modify any files in reference directories)
1. [linux-voice-assistant](reference/linux-voice-assistant) - Linux-based Home Assistant voice assistant app for reference
2. [Reachy Mini SDK](reference/reachy_mini) - Reachy Mini SDK local directory for reference
3. [reachy_mini_conversation_app](reference/reachy_mini_conversation_app) - Reachy Mini conversation app for reference
4. [reachy-mini-desktop-app](reference/reachy-mini-desktop-app) - Reachy Mini desktop app for reference
5. [sendspin](reference/sendspin-cli/) - Sendspin client for reference

## Core Design Principles

1. **Zero Configuration** - Users only need to install the app, no manual configuration required
2. **Native Hardware** - Use robot's built-in microphone and speaker
3. **Home Assistant Centralized Management** - All configuration done on Home Assistant side
4. **Motion Feedback** - Provide head movement and antenna animation feedback during voice interaction
5. **Project Constraints** - Strictly follow [Reachy Mini SDK](reachy_mini) architecture design and constraints
6. **Code Quality** - Follow Python development standards with consistent code style, clear structure, complete comments, comprehensive documentation, high test coverage, high code quality, readability, maintainability, extensibility, and reusability
7. **Feature Priority** - Voice conversation with Home Assistant is highest priority; other features are auxiliary and must not affect voice conversation functionality or response speed
8. **No LED Functions** - LEDs are hidden inside the robot; all LED control is ignored
9. **Preserve Functionality** - Any code modifications should optimize while preserving completed features; do not remove features to solve problems. When issues occur, prioritize solving problems after referencing examples, not adding various log outputs

## Technical Architecture

```

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚                              Reachy Mini (ARM64)                            β”‚

β”‚                                                                             β”‚

β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ AUDIO INPUT ───────────────────────────┐  β”‚

β”‚  β”‚  ReSpeaker XVF3800 (16kHz)                                            β”‚  β”‚

β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚

β”‚  β”‚  β”‚ 4-Mic Array  β”‚ β†’ β”‚ XVF3800 DSP                                  β”‚  β”‚  β”‚

β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚ β€’ Echo Cancellation (AEC)                    β”‚  β”‚  β”‚

β”‚  β”‚                     β”‚ β€’ Noise Suppression (NS)                     β”‚  β”‚  β”‚

β”‚  β”‚                     β”‚ β€’ Auto Gain Control (AGC, max 30dB)          β”‚  β”‚  β”‚

β”‚  β”‚                     β”‚ β€’ Direction of Arrival (DOA)                 β”‚  β”‚  β”‚

β”‚  β”‚                     β”‚ β€’ Voice Activity Detection (VAD)             β”‚  β”‚  β”‚

β”‚  β”‚                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚

β”‚  β”‚                                      β”‚                                β”‚  β”‚

β”‚  β”‚                                      β–Ό                                β”‚  β”‚

β”‚  β”‚                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚

β”‚  β”‚                     β”‚ Wake Word Detection (microWakeWord)          β”‚  β”‚  β”‚

β”‚  β”‚                     β”‚ β€’ "Okay Nabu" / "Hey Jarvis"                 β”‚  β”‚  β”‚

β”‚  β”‚                     β”‚ β€’ Stop word detection                        β”‚  β”‚  β”‚

β”‚  β”‚                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚

β”‚                                                                             β”‚

β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ AUDIO OUTPUT ──────────────────────────┐  β”‚

β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  β”‚

β”‚  β”‚  β”‚ TTS Player               β”‚    β”‚ Music Player (Sendspin)          β”‚ β”‚  β”‚

β”‚  β”‚  β”‚ β€’ Voice assistant speech β”‚    β”‚ β€’ Multi-room audio streaming     β”‚ β”‚  β”‚

β”‚  β”‚  β”‚ β€’ Sound effects          β”‚    β”‚ β€’ Auto-discovery via mDNS        β”‚ β”‚  β”‚

β”‚  β”‚  β”‚ β€’ Priority over music    β”‚    β”‚ β€’ Auto-pause during conversation β”‚ β”‚  β”‚

β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  β”‚

β”‚  β”‚                 β”‚                              β”‚                      β”‚  β”‚

β”‚  β”‚                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚  β”‚

β”‚  β”‚                                β–Ό                                      β”‚  β”‚

β”‚  β”‚                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚

β”‚  β”‚                 β”‚ ReSpeaker Speaker (16kHz)                        β”‚  β”‚  β”‚

β”‚  β”‚                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚

β”‚                                                                             β”‚

β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ VISION & TRACKING ─────────────────────────┐  β”‚

β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  β”‚

β”‚  β”‚  β”‚ Camera (VPU accelerated) β”‚ β†’  β”‚ YOLO Face Detection              β”‚ β”‚  β”‚

β”‚  β”‚  β”‚ β€’ MJPEG stream server    β”‚    β”‚ β€’ AdamCodd/YOLOv11n-face         β”‚ β”‚  β”‚

β”‚  β”‚  β”‚ β€’ ESPHome Camera entity  β”‚    β”‚ β€’ Adaptive frame rate:           β”‚ β”‚  β”‚

β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚   - 15fps: conversation/face     β”‚ β”‚  β”‚

β”‚  β”‚                                  β”‚   - 3fps: idle (power saving)    β”‚ β”‚  β”‚

β”‚  β”‚                                  β”‚ β€’ look_at_image() pose calc      β”‚ β”‚  β”‚

β”‚  β”‚                                  β”‚ β€’ Smooth return after face lost  β”‚ β”‚  β”‚

β”‚  β”‚                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚

β”‚                                                                             β”‚

β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ MOTION CONTROL ────────────────────────────┐  β”‚

β”‚  β”‚  MovementManager (10Hz Control Loop)                                  β”‚  β”‚

β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚  β”‚

β”‚  β”‚  β”‚ Motion Layers (Priority: Move > Action > SpeechSway > Breath)  β”‚   β”‚  β”‚

β”‚  β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚  β”‚

β”‚  β”‚  β”‚ β”‚ Move Queue β”‚ β”‚ Actions    β”‚ β”‚ SpeechSway β”‚ β”‚ Breathing    β”‚  β”‚   β”‚  β”‚

β”‚  β”‚  β”‚ β”‚ (Emotions) β”‚ β”‚ (Nod/Shake)β”‚ β”‚ (Voice VAD)β”‚ β”‚ (Idle anim)  β”‚  β”‚   β”‚  β”‚

β”‚  β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚  β”‚

β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  β”‚

β”‚  β”‚                                                                       β”‚  β”‚

β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚  β”‚

β”‚  β”‚  β”‚ Face Tracking Offsets (Secondary Pose Overlay)                 β”‚   β”‚  β”‚

β”‚  β”‚  β”‚ β€’ Pitch offset: +9Β° (down compensation)                        β”‚   β”‚  β”‚

β”‚  β”‚  β”‚ β€’ Yaw offset: -7Β° (right compensation)                         β”‚   β”‚  β”‚

β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  β”‚

β”‚  β”‚                                                                       β”‚  β”‚

β”‚  β”‚   State Machine: on_wakeup β†’ on_listening β†’ on_speaking β†’ on_idle     β”‚  β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚

β”‚                                                                             β”‚

β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ TAP DETECTION ─────────────────────────────┐  β”‚

β”‚  β”‚  IMU Accelerometer (Wireless version only) - DISABLED                 β”‚  β”‚

β”‚  β”‚  β€’ Tap-to-wake: REMOVED (too many false triggers)                     β”‚  β”‚

β”‚  β”‚  β€’ Continuous conversation now controlled via Home Assistant switch   β”‚  β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚

β”‚                                                                             β”‚

β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ ESPHOME SERVER ────────────────────────────┐  β”‚

β”‚  β”‚  Port 6053 (mDNS auto-discovery)                                      β”‚  β”‚

β”‚  β”‚  β€’ 43+ entities (sensors, controls, media player, camera)             β”‚  β”‚

β”‚  β”‚  β€’ Voice Assistant pipeline integration                               β”‚  β”‚

β”‚  β”‚  β€’ Real-time state synchronization                                    β”‚  β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

                                       β”‚

                                       β”‚ ESPHome Protocol (protobuf)

                                       β–Ό

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚                            Home Assistant                                   β”‚

β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚

β”‚  β”‚ STT Engine       β”‚  β”‚ Intent Processingβ”‚  β”‚ TTS Engine                 β”‚ β”‚

β”‚  β”‚ (User configured)β”‚  β”‚ (Conversation)   β”‚  β”‚ (User configured)          β”‚ β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

```

## Completed Features

### Core Features
- [x] ESPHome protocol server implementation
- [x] mDNS service discovery (auto-discovered by Home Assistant)
- [x] Local wake word detection (microWakeWord)
- [x] Continuous conversation mode (controlled via Home Assistant switch)
- [x] Audio stream transmission to Home Assistant
- [x] TTS audio playback
- [x] Stop word detection

### Reachy Mini Integration
- [x] Use Reachy Mini SDK microphone input
- [x] Use Reachy Mini SDK speaker output
- [x] Head motion control (nod, shake, gaze)
- [x] Antenna animation control
- [x] Voice state feedback actions
- [x] YOLO face tracking (replaces DOA sound source localization)
- [x] 5Hz unified motion control loop

### Application Architecture
- [x] Compliant with Reachy Mini App architecture



## File List

```

reachy_mini_ha_voice/

β”œβ”€β”€ reachy_mini_ha_voice/

β”‚   β”œβ”€β”€ __init__.py             # Package initialization

β”‚   β”œβ”€β”€ __main__.py             # Command line entry

β”‚   β”œβ”€β”€ main.py                 # ReachyMiniApp entry

β”‚   β”œβ”€β”€ voice_assistant.py      # Voice assistant service

β”‚   β”œβ”€β”€ satellite.py            # ESPHome protocol handling

β”‚   β”œβ”€β”€ audio_player.py         # Audio player

β”‚   β”œβ”€β”€ camera_server.py        # MJPEG camera stream server + face tracking

β”‚   β”œβ”€β”€ head_tracker.py         # YOLO face detector

β”‚   β”œβ”€β”€ motion.py               # Motion control (high-level API)

β”‚   β”œβ”€β”€ movement_manager.py     # Unified movement manager (100Hz control loop)

β”‚   β”œβ”€β”€ animation_player.py     # JSON-driven animation system

β”‚   β”œβ”€β”€ models.py               # Data models

β”‚   β”œβ”€β”€ entity.py               # ESPHome base entity

β”‚   β”œβ”€β”€ entity_extensions.py    # Extended entity types

β”‚   β”œβ”€β”€ entity_registry.py      # Entity registry

β”‚   β”œβ”€β”€ reachy_controller.py    # Reachy Mini controller wrapper

β”‚   β”œβ”€β”€ tap_detector.py         # IMU tap detection

β”‚   β”œβ”€β”€ gesture_detector.py     # Gesture detection

β”‚   β”œβ”€β”€ api_server.py           # API server

β”‚   β”œβ”€β”€ zeroconf.py             # mDNS discovery

β”‚   └── util.py                 # Utility functions

β”œβ”€β”€ animations/                 # Animation definitions

β”‚   └── conversation_animations.json  # Conversation state animations

β”œβ”€β”€ wakewords/                  # Wake word models (auto-download)

β”‚   β”œβ”€β”€ okay_nabu.json

β”‚   β”œβ”€β”€ okay_nabu.tflite

β”‚   β”œβ”€β”€ hey_jarvis.json

β”‚   β”œβ”€β”€ hey_jarvis.tflite

β”‚   β”œβ”€β”€ stop.json

β”‚   └── stop.tflite

β”œβ”€β”€ sounds/                     # Sound effect files (auto-download)

β”‚   β”œβ”€β”€ wake_word_triggered.flac

β”‚   └── timer_finished.flac

β”œβ”€β”€ pyproject.toml              # Project configuration

β”œβ”€β”€ README.md                   # Documentation

└── PROJECT_PLAN.md             # Project plan

```

## Dependencies

```toml

dependencies = [

    "reachy-mini",           # Reachy Mini SDK

    "sounddevice>=0.4.6",    # Audio processing (backup)

    "soundfile>=0.12.0",     # Audio file reading

    "numpy>=1.24.0",         # Numerical computation

    "pymicro-wakeword>=2.0.0,<3.0.0",  # Wake word detection

    "pyopen-wakeword>=1.0.0,<2.0.0",   # Backup wake word

    "aioesphomeapi>=42.0.0", # ESPHome protocol

    "zeroconf>=0.100.0",     # mDNS discovery

    "scipy>=1.10.0",         # Motion control

    "pydantic>=2.0.0",       # Data validation

]

```

## Usage Flow

1. **Install App**
   - Install `reachy-mini-ha-voice` from Reachy Mini App Store

2. **Start App**
   - App auto-starts ESPHome server (port 6053)
   - Auto-downloads required models and sounds

3. **Connect Home Assistant**
   - Home Assistant auto-discovers device (mDNS)
   - Or manually add: Settings β†’ Devices & Services β†’ Add Integration β†’ ESPHome

4. **Use Voice Assistant**
   - Say "Okay Nabu" to wake
   - Speak command
   - Reachy Mini provides motion feedback

## ESPHome Entity Planning

Based on deep analysis of Reachy Mini SDK, the following entities are exposed to Home Assistant:

### Implemented Entities

| Entity Type | Name | Description |
|-------------|------|-------------|
| Media Player | `media_player` | Audio playback control |
| Voice Assistant | `voice_assistant` | Voice assistant pipeline |

### Implemented Control Entities (Read/Write)

#### Phase 1-3: Basic Controls and Pose

| ESPHome Entity Type | Name | SDK API | Range/Options | Description |
|---------------------|------|---------|---------------|-------------|
| `Number` | `speaker_volume` | `AudioPlayer.set_volume()` | 0-100 | Speaker volume |
| `Select` | `motor_mode` | `set_motor_control_mode()` | enabled/disabled/gravity_compensation | Motor mode selection |

| `Switch` | `motors_enabled` | `enable_motors()` / `disable_motors()` | on/off | Motor torque switch |
| `Button` | `wake_up` | `mini.wake_up()` | - | Wake robot action |
| `Button` | `go_to_sleep` | `mini.goto_sleep()` | - | Sleep robot action |
| `Number` | `head_x` | `goto_target(head=...)` | Β±50mm | Head X position control |
| `Number` | `head_y` | `goto_target(head=...)` | Β±50mm | Head Y position control |
| `Number` | `head_z` | `goto_target(head=...)` | Β±50mm | Head Z position control |
| `Number` | `head_roll` | `goto_target(head=...)` | -40Β° ~ +40Β° | Head roll angle control |
| `Number` | `head_pitch` | `goto_target(head=...)` | -40Β° ~ +40Β° | Head pitch angle control |
| `Number` | `head_yaw` | `goto_target(head=...)` | -180Β° ~ +180Β° | Head yaw angle control |
| `Number` | `body_yaw` | `goto_target(body_yaw=...)` | -160Β° ~ +160Β° | Body yaw angle control |
| `Number` | `antenna_left` | `goto_target(antennas=...)` | -90Β° ~ +90Β° | Left antenna angle control |
| `Number` | `antenna_right` | `goto_target(antennas=...)` | -90Β° ~ +90Β° | Right antenna angle control |

#### Phase 4: Gaze Control

| ESPHome Entity Type | Name | SDK API | Range/Options | Description |
|---------------------|------|---------|---------------|-------------|
| `Number` | `look_at_x` | `look_at_world(x, y, z)` | World coordinates | Gaze point X coordinate |
| `Number` | `look_at_y` | `look_at_world(x, y, z)` | World coordinates | Gaze point Y coordinate |
| `Number` | `look_at_z` | `look_at_world(x, y, z)` | World coordinates | Gaze point Z coordinate |


### Implemented Sensor Entities (Read-only)

#### Phase 1 & 5: Basic Status and Audio Sensors

| ESPHome Entity Type | Name | SDK API | Description |
|---------------------|------|---------|-------------|
| `Text Sensor` | `daemon_state` | `DaemonStatus.state` | Daemon status |
| `Binary Sensor` | `backend_ready` | `backend_status.ready` | Backend ready status |
| `Text Sensor` | `error_message` | `DaemonStatus.error` | Current error message |
| `Sensor` | `doa_angle` | `DoAInfo.angle` | Sound source direction angle (Β°) |
| `Binary Sensor` | `speech_detected` | `DoAInfo.speech_detected` | Speech detection status |

#### Phase 6: Diagnostic Information

| ESPHome Entity Type | Name | SDK API | Description |
|---------------------|------|---------|-------------|
| `Sensor` | `control_loop_frequency` | `control_loop_stats` | Control loop frequency (Hz) |
| `Text Sensor` | `sdk_version` | `DaemonStatus.version` | SDK version |
| `Text Sensor` | `robot_name` | `DaemonStatus.robot_name` | Robot name |
| `Binary Sensor` | `wireless_version` | `DaemonStatus.wireless_version` | Wireless version flag |
| `Binary Sensor` | `simulation_mode` | `DaemonStatus.simulation_enabled` | Simulation mode flag |
| `Text Sensor` | `wlan_ip` | `DaemonStatus.wlan_ip` | Wireless IP address |

#### Phase 7: IMU Sensors (Wireless version only)

| ESPHome Entity Type | Name | SDK API | Description |
|---------------------|------|---------|-------------|
| `Sensor` | `imu_accel_x` | `mini.imu["accelerometer"][0]` | X-axis acceleration (m/sΒ²) |
| `Sensor` | `imu_accel_y` | `mini.imu["accelerometer"][1]` | Y-axis acceleration (m/sΒ²) |
| `Sensor` | `imu_accel_z` | `mini.imu["accelerometer"][2]` | Z-axis acceleration (m/sΒ²) |
| `Sensor` | `imu_gyro_x` | `mini.imu["gyroscope"][0]` | X-axis angular velocity (rad/s) |
| `Sensor` | `imu_gyro_y` | `mini.imu["gyroscope"][1]` | Y-axis angular velocity (rad/s) |
| `Sensor` | `imu_gyro_z` | `mini.imu["gyroscope"][2]` | Z-axis angular velocity (rad/s) |
| `Sensor` | `imu_temperature` | `mini.imu["temperature"]` | IMU temperature (Β°C) |

#### Phase 8-12: Extended Features

| ESPHome Entity Type | Name | Description |
|---------------------|------|-------------|
| `Select` | `emotion` | Emotion selector (Happy/Sad/Angry/Fear/Surprise/Disgust) |
| `Number` | `microphone_volume` | Microphone volume (0-100%) |
| `Camera` | `camera` | ESPHome Camera entity (live preview) |
| `Number` | `led_brightness` | LED brightness (0-100%) |
| `Select` | `led_effect` | LED effect (off/solid/breathing/rainbow/doa) |
| `Number` | `led_color_r` | LED red component (0-255) |
| `Number` | `led_color_g` | LED green component (0-255) |
| `Number` | `led_color_b` | LED blue component (0-255) |
| `Switch` | `agc_enabled` | Auto gain control switch |
| `Number` | `agc_max_gain` | AGC max gain (0-30 dB) |
| `Number` | `noise_suppression` | Noise suppression level (0-100%) |
| `Binary Sensor` | `echo_cancellation_converged` | Echo cancellation convergence status |

> **Note**: Head position (x/y/z) and angles (roll/pitch/yaw), body yaw, antenna angles are all **controllable** entities,
> using `Number` type for bidirectional control. Call `goto_target()` when setting new values, call `get_current_head_pose()` etc. when reading current values.

### Implementation Priority

1. **Phase 1 - Basic Status and Volume** (High Priority) βœ… **Completed**
   - [x] `daemon_state` - Daemon status sensor
   - [x] `backend_ready` - Backend ready status
   - [x] `error_message` - Error message
   - [x] `speaker_volume` - Speaker volume control

2. **Phase 2 - Motor Control** (High Priority) βœ… **Completed**
   - [x] `motors_enabled` - Motor switch
   - [x] `motor_mode` - Motor mode selection (enabled/disabled/gravity_compensation)

   - [x] `wake_up` / `go_to_sleep` - Wake/sleep buttons

3. **Phase 3 - Pose Control** (Medium Priority) βœ… **Completed**
   - [x] `head_x/y/z` - Head position control
   - [x] `head_roll/pitch/yaw` - Head angle control
   - [x] `body_yaw` - Body yaw angle control
   - [x] `antenna_left/right` - Antenna angle control

4. **Phase 4 - Gaze Control** (Medium Priority) βœ… **Completed**
   - [x] `look_at_x/y/z` - Gaze point coordinate control

5. **Phase 5 - DOA (Direction of Arrival)** βœ… **Re-added for wakeup turn-to-sound**
   - [x] `doa_angle` - Sound source direction (degrees, 0-180Β°, where 0Β°=left, 90Β°=front, 180Β°=right)
   - [x] `speech_detected` - Speech detection status
   - [x] Turn-to-sound at wakeup (robot turns toward speaker when wake word detected)
   - [x] Direction correction: `yaw = Ο€/2 - doa` (fixed left/right inversion)
   - Note: DOA only read once at wakeup to avoid daemon pressure; face tracking takes over after

6. **Phase 6 - Diagnostic Information** (Low Priority) βœ… **Completed**
   - [x] `control_loop_frequency` - Control loop frequency
   - [x] `sdk_version` - SDK version
   - [x] `robot_name` - Robot name
   - [x] `wireless_version` - Wireless version flag
   - [x] `simulation_mode` - Simulation mode flag
   - [x] `wlan_ip` - Wireless IP address

7. **Phase 7 - IMU Sensors** (Optional, wireless version only) βœ… **Completed**
   - [x] `imu_accel_x/y/z` - Accelerometer
   - [x] `imu_gyro_x/y/z` - Gyroscope
   - [x] `imu_temperature` - IMU temperature

8. **Phase 8 - Emotion Control** βœ… **Completed**
   - [x] `emotion` - Emotion selector (Happy/Sad/Angry/Fear/Surprise/Disgust)

9. **Phase 9 - Audio Control** βœ… **Completed**
   - [x] `microphone_volume` - Microphone volume control (0-100%)

10. **Phase 10 - Camera Integration** βœ… **Completed**
    - [x] `camera` - ESPHome Camera entity (live preview)

11. **Phase 11 - LED Control** ❌ **Disabled (LEDs hidden inside robot)**
    - [ ] `led_brightness` - LED brightness (0-100%) - Commented out
    - [ ] `led_effect` - LED effect (off/solid/breathing/rainbow/doa) - Commented out
    - [ ] `led_color_r/g/b` - LED RGB color (0-255) - Commented out

12. **Phase 12 - Audio Processing Parameters** βœ… **Completed**
    - [x] `agc_enabled` - Auto gain control switch
    - [x] `agc_max_gain` - AGC max gain (0-30 dB)
    - [x] `noise_suppression` - Noise suppression level (0-100%)
    - [x] `echo_cancellation_converged` - Echo cancellation convergence status (read-only)

13. **Phase 13 - Sendspin Audio Playback Support** βœ… **Completed**
    - [x] `sendspin_enabled` - Sendspin switch (Switch)
    - [x] `sendspin_url` - Sendspin server URL (Text Sensor)
    - [x] `sendspin_connected` - Sendspin connection status (Binary Sensor)
    - [x] AudioPlayer integrates aiosendspin library
    - [x] TTS audio sent to both local speaker and Sendspin server

14. **Phase 22 - Gesture Detection** βœ… **Completed**
    - [x] `gesture_detected` - Detected gesture name (Text Sensor)
    - [x] `gesture_confidence` - Gesture detection confidence % (Sensor)
    - [x] HaGRID ONNX models: hand_detector.onnx + crops_classifier.onnx
    - [x] Real-time state push to Home Assistant
    - [x] 18 supported gestures:
      | Gesture | Emoji | Gesture | Emoji |

      |---------|-------|---------|-------|

      | call | πŸ€™ | like | πŸ‘ |

      | dislike | πŸ‘Ž | mute | 🀫 |

      | fist | ✊ | ok | πŸ‘Œ |

      | four | πŸ–οΈ | one | ☝️ |

      | palm | βœ‹ | peace | ✌️ |

      | peace_inverted | πŸ”»βœŒοΈ | rock | 🀘 |

      | stop | πŸ›‘ | stop_inverted | πŸ”»πŸ›‘ |

      | three | 3️⃣ | three2 | 🀟 |

      | two_up | ✌️☝️ | two_up_inverted | πŸ”»βœŒοΈβ˜οΈ |


---

## πŸŽ‰ Phase 1-13 + Phase 22 Entities Completed!

**Total Completed: 45 entities**
- Phase 1: 4 entities (Basic status and volume)
- Phase 2: 4 entities (Motor control)
- Phase 3: 9 entities (Pose control)
- Phase 4: 3 entities (Gaze control)
- Phase 5: 2 entities (Audio sensors)
- Phase 6: 6 entities (Diagnostic information)
- Phase 7: 7 entities (IMU sensors)
- Phase 8: 1 entity (Emotion control)
- Phase 9: 1 entity (Microphone volume)
- Phase 10: 1 entity (Camera)
- Phase 11: 0 entities (LED control - Disabled)
- Phase 12: 4 entities (Audio processing parameters)
- Phase 13: 3 entities (Sendspin audio output)
- Phase 22: 2 entities (Gesture detection)


---

## πŸš€ Voice Assistant Enhancement Features Implementation Status

### Phase 14 - Emotion Action Feedback System (Partial) 🟑

**Implementation Status**: Basic infrastructure ready, supports manual trigger, uses voice-driven natural micro-movements during conversation

**Implemented Features**:
- βœ… Phase 8 Emotion Selector entity (`emotion`)
- βœ… Basic emotion action playback API (`_play_emotion`)
- βœ… Emotion mapping: Happy/Sad/Angry/Fear/Surprise/Disgust
- βœ… Integration with HuggingFace action library (`pollen-robotics/reachy-mini-emotions-library`)
- βœ… SpeechSway system for natural head micro-movements during conversation (non-blocking)
- βœ… Tap detection disabled during emotion playback (polls daemon API for completion)

**Design Decisions**:
- 🎯 No auto-play of full emotion actions during conversation to avoid blocking
- 🎯 Use voice-driven head sway (SpeechSway) for natural motion feedback
- 🎯 Emotion actions retained as manual trigger feature via ESPHome entity
- 🎯 Tap detection waits for actual move completion via `/api/move/running` polling

**Not Implemented**:
- ❌ Auto-trigger emotion actions based on voice assistant response (decided not to implement to avoid blocking)
- ❌ Intent recognition and emotion matching
- ❌ Dance action library integration
- ❌ Context awareness (e.g., weather query - sunny plays happy, rainy plays sad)

**Code Locations**:
- `entity_registry.py:633-658` - Emotion Selector entity
- `satellite.py:_play_emotion()` - Emotion playback with move UUID tracking
- `satellite.py:_wait_for_move_completion()` - Polls daemon API for move completion
- `motion.py:132-156` - Conversation start motion control (uses SpeechSway)
- `movement_manager.py:541-595` - Move queue management (allows SpeechSway overlay)

**Actual Behavior**:

| Voice Assistant Event | Actual Action | Implementation Status |
|----------------------|---------------|----------------------|
| Wake word detected | Turn toward sound source + nod confirmation | βœ… Implemented |
| Conversation start | Voice-driven head micro-movements (SpeechSway) | βœ… Implemented |
| During conversation | Continuous voice-driven micro-movements + breathing animation | βœ… Implemented |
| Conversation end | Return to neutral position + breathing animation | βœ… Implemented |
| Manual emotion trigger | Play via ESPHome `emotion` entity | βœ… Implemented |

**Technical Details**:
```python

# motion.py - Use SpeechSway instead of full emotion actions during conversation

def on_speaking_start(self):

    self._is_speaking = True

    self._movement_manager.set_state(RobotState.SPEAKING)

    # SpeechSway automatically generates natural head micro-movements based on audio loudness

    # No full emotion actions played to avoid blocking conversation experience



# movement_manager.py - Motion layering system

# 1. Move queue (emotion actions) - Sets base pose

# 2. Action (nod/shake etc.) - Overlays on base pose

# 3. SpeechSway - Voice-driven micro-movements, can coexist with Move

# 4. Breathing - Idle breathing animation

```

**Original Plan** (Decided not to implement to avoid blocking conversation):

| Voice Assistant Event | Original Planned Action | Reason Not Implemented |
|----------------------|------------------------|------------------------|
| Positive response received | Play "happy" action | Full action would block conversation fluency |
| Negative response received | Play "sad" action | Full action would block conversation fluency |
| Play music/entertainment | Play "dance" action | Full action would block conversation fluency |
| Timer completed | Play "alert" action | Full action would block conversation fluency |
| Error/cannot understand | Play "confused" action | Full action would block conversation fluency |

**Manual Emotion Trigger Example**:
```yaml

# Home Assistant automation example - Manual emotion trigger

automation:

  - alias: "Reachy Good Morning Greeting"

    trigger:

      - platform: time

        at: "07:00:00"

    action:

      - service: select.select_option

        target:

          entity_id: select.reachy_mini_emotion

        data:

          option: "Happy"

```

### Phase 15 - Face Tracking (Complements DOA Turn-to-Sound) βœ… **Completed**

**Goal**: Implement natural face tracking so robot looks at speaker during conversation.

**Design Decision**: 
- βœ… DOA (Direction of Arrival): Used once at wakeup to turn toward sound source
- βœ… YOLO face detection: Takes over after initial turn for continuous tracking
- Reason: DOA provides quick initial orientation, face tracking provides accurate continuous tracking

**Wakeup Turn-to-Sound Flow**:
1. Wake word detected β†’ Read DOA angle once (avoid daemon pressure)
2. If DOA angle > 10Β°: Turn head toward sound source (80% of angle, conservative)
3. Face tracking takes over for continuous tracking during conversation

**Implemented Features**:

| Feature | Description | Implementation Location | Status |
|---------|-------------|------------------------|--------|
| DOA turn-to-sound | Turn toward speaker at wakeup | `satellite.py:_turn_to_sound_source()` | βœ… Implemented |
| YOLO face detection | Uses `AdamCodd/YOLOv11n-face-detection` model | `head_tracker.py` | βœ… Implemented |
| Adaptive frame rate tracking | 15fps during conversation, 3fps when idle without face | `camera_server.py` | βœ… Implemented |
| look_at_image() | Calculate target pose from face position | `camera_server.py` | βœ… Implemented |
| Smooth return to neutral | Smooth return within 1 second after face lost | `camera_server.py` | βœ… Implemented |
| face_tracking_offsets | As secondary pose overlay to motion control | `movement_manager.py` | βœ… Implemented |
| DOA entities | `doa_angle` and `speech_detected` exposed to Home Assistant | `entity_registry.py` | βœ… Implemented |
| Model download retry | 3 retries, 5 second interval | `head_tracker.py` | βœ… Implemented |
| Conversation mode integration | Auto-switch tracking frequency on voice assistant state change | `satellite.py` | βœ… Implemented |

**Resource Optimization (v0.5.1, updated v0.6.2)**:
- During conversation (listening/thinking/speaking): High-frequency tracking 15fps
- Idle with face detected: High-frequency tracking 15fps
- Idle without face for 5s: Low-power mode 2fps
- Idle without face for 30s: Ultra-low power mode 0.5fps (every 2 seconds)
- Gesture detection only runs when face detected recently (within 5s)
- Immediately restore high-frequency tracking when face detected

**Code Locations**:
- `satellite.py:_turn_to_sound_source()` - DOA turn-to-sound at wakeup
- `head_tracker.py` - YOLO face detector (`HeadTracker` class)
- `camera_server.py:_capture_frames()` - Adaptive frame rate face tracking
- `camera_server.py:set_conversation_mode()` - Conversation mode switch API
- `satellite.py:_set_conversation_mode()` - Voice assistant state integration
- `movement_manager.py:set_face_tracking_offsets()` - Face tracking offset API

**Technical Details**:
```python

# camera_server.py - Adaptive frame rate face tracking

class MJPEGCameraServer:

    def __init__(self):

        self._fps_high = 15  # During conversation/face detected

        self._fps_low = 2    # Idle without face (5-30s)

        self._fps_idle = 0.5 # Ultra-low power (>30s without face)

        self._low_power_threshold = 5.0   # 5s without face switches to low power

        self._idle_threshold = 30.0       # 30s without face switches to idle mode

    

    def _should_run_ai_inference(self, current_time):

        # Conversation mode: Always high-frequency tracking

        if self._in_conversation:

            return True

        # High-frequency mode: Track every frame

        if self._current_fps == self._fps_high:

            return True

        # Low/idle power mode: Periodic detection

        return time.since_last_check >= 1/self._current_fps



# satellite.py - Voice assistant state integration

def _reachy_on_listening(self):

    self._set_conversation_mode(True)  # Start conversation, high-frequency tracking

    

def _reachy_on_idle(self):

    self._set_conversation_mode(False)  # End conversation, adaptive tracking

```


### Phase 16 - Cartoon Style Motion Mode (Partial) 🟑

**Goal**: Use SDK interpolation techniques for more expressive robot movements.

**SDK Support**: `InterpolationTechnique` enum
- `LINEAR` - Linear, mechanical feel
- `MIN_JERK` - Minimum jerk, natural and smooth (default)
- `EASE_IN_OUT` - Ease in-out, elegant
- `CARTOON` - Cartoon style, with bounce effect, lively and cute

**Implemented Features**:
- βœ… 100Hz unified control loop (`movement_manager.py`) - Restored to 100Hz after daemon update
- βœ… JSON-driven animation system (`AnimationPlayer`) - Inspired by SimpleDances project
- βœ… Conversation state animations (idle/listening/thinking/speaking)
- βœ… Pose change detection - Only send commands on significant changes (threshold 0.005)
- βœ… State query caching - 2s TTL, reduces daemon load
- βœ… Smooth interpolation (ease in-out curve)
- βœ… Command queue mode - Thread-safe external API
- βœ… Error throttling - Prevents log explosion
- βœ… Connection health monitoring - Auto-detect and recover from connection loss

**Animation System (v0.5.13)**:
- `AnimationPlayer` class loads animations from `conversation_animations.json`
- Each animation defines: pitch/yaw/roll amplitudes, position offsets, antenna movements, frequency
- Smooth transitions between animations (configurable duration)
- State-to-animation mapping: idle→idle, listening→listening, thinking→thinking, speaking→speaking

**Not Implemented**:
- ❌ Dynamic interpolation technique switching (CARTOON/EASE_IN_OUT etc.)
- ❌ Exaggerated cartoon bounce effects

**Code Locations**:
- `animation_player.py` - AnimationPlayer class
- `animations/conversation_animations.json` - Animation definitions
- `movement_manager.py` - 100Hz control loop with animation integration

**Scene Implementation Status**:

| Scene | Recommended Interpolation | Effect | Status |
|-------|--------------------------|--------|--------|
| Wake nod | `CARTOON` | Lively bounce effect | ❌ Not implemented |
| Thinking head up | `EASE_IN_OUT` | Elegant transition | βœ… Implemented (smooth interpolation) |
| Speaking micro-movements | `MIN_JERK` | Natural and fluid | βœ… Implemented (SpeechSway) |
| Error head shake | `CARTOON` | Exaggerated denial | ❌ Not implemented |
| Return to neutral | `MIN_JERK` | Smooth return | βœ… Implemented |
| Idle breathing | - | Subtle sense of life | βœ… Implemented (BreathingAnimation) |

### Phase 17 - Antenna Sync Animation During Speech (Completed) βœ…

**Goal**: Antennas sway with audio rhythm during TTS playback, simulating "speaking" effect.

**Implemented Features**:
- βœ… JSON-driven animation system with antenna movements
- βœ… Different antenna patterns: "both" (sync), "wiggle" (opposite phase)
- βœ… State-specific antenna animations (listening/thinking/speaking)
- βœ… Smooth transitions between animation states

**Code Locations**:
- `animation_player.py` - AnimationPlayer with antenna offset calculation
- `animations/conversation_animations.json` - Antenna amplitude and pattern definitions
- `movement_manager.py` - Antenna offset composition in final pose

### Phase 18 - Visual Gaze Interaction (Not Implemented) ❌

**Goal**: Use camera to detect faces for eye contact.

**SDK Support**:
- `look_at_image(u, v)` - Look at point in image
- `look_at_world(x, y, z)` - Look at world coordinate point
- `media.get_frame()` - Get camera frame (βœ… Already implemented in `camera_server.py:146`)

**Not Implemented Features**:

| Feature | Description | Status |
|---------|-------------|--------|
| Face detection | Use OpenCV/MediaPipe to detect faces | ❌ Not implemented |
| Eye tracking | Look at speaker's face during conversation | ❌ Not implemented |
| Multi-person switching | When multiple people detected, look at current speaker | ❌ Not implemented |
| Idle scanning | Randomly look around when idle | ❌ Not implemented |

### Phase 19 - Gravity Compensation Interactive Mode (Partial) 🟑

**Goal**: Allow users to physically touch and guide robot head for "teaching" style interaction.

**SDK Support**: `enable_gravity_compensation()` - Motors enter gravity compensation mode, can be manually moved

**Implemented Features**:
- βœ… Gravity compensation mode switch (`motor_mode` Select entity, option "gravity_compensation")

- βœ… `reachy_controller.py:236-237` - Gravity compensation API call

**Not Implemented**:
- ❌ Teaching mode - Record motion trajectory
- ❌ Save/playback custom actions
- ❌ Voice command triggered teaching flow

**Application Scenarios**:
- ❌ User says "Let me teach you a move" β†’ Enter gravity compensation mode
- ❌ User manually moves head β†’ Record motion trajectory
- ❌ User says "Remember this" β†’ Save action
- ❌ User says "Do that action again" β†’ Playback recorded action

### Phase 20 - Environment Awareness Response (Partial) 🟑

**Goal**: Use IMU sensors to sense environment changes and respond.

**SDK Support**:
- βœ… `mini.imu["accelerometer"]` - Accelerometer (Phase 7 implemented as entity)
- βœ… `mini.imu["gyroscope"]` - Gyroscope (Phase 7 implemented as entity)

**Implemented Features**:

| Detection Event | Response Action | Status |
|-----------------|-----------------|--------|
| Continuous conversation | Controlled via Home Assistant switch | βœ… Implemented |

**Tap-to-wake REMOVED** (v0.5.16):
- Too many false triggers from robot movement and vibrations
- Continuous conversation mode now controlled via "Continuous Conversation" switch in Home Assistant
- Users can enable/disable continuous conversation from HA dashboard

**Technical Implementation**:
- `models.py` - `Preferences.continuous_conversation` field
- `entity_registry.py` - `continuous_conversation` Switch entity (Phase 21)
- `satellite.py` - `_handle_run_end()` checks `preferences.continuous_conversation`

**Not Implemented**:

| Detection Event | Response Action | Status |
|-----------------|-----------------|--------|
| Being shaken | Play dizzy action + voice "Don't shake me~" | ❌ Not implemented |
| Tilted/fallen | Play help action + voice "I fell, help me" | ❌ Not implemented |
| Long idle | Enter sleep animation | ❌ Not implemented |

### Phase 21 - Home Assistant Scene Integration (Not Implemented) ❌

**Goal**: Trigger robot actions based on Home Assistant scenes/automations.

**Implementation**: Via ESPHome service calls

**Not Implemented Scenes**:

| HA Scene | Robot Response | Status |
|----------|----------------|--------|
| Good morning scene | Play wake action + "Good morning!" | ❌ Not implemented |
| Good night scene | Play sleep action + "Good night~" | ❌ Not implemented |
| Someone home | Turn toward door + wave + "Welcome home!" | ❌ Not implemented |
| Doorbell rings | Turn toward door + alert action | ❌ Not implemented |
| Play music | Sway with music rhythm | ❌ Not implemented |


---

## πŸ“Š Feature Implementation Summary

### βœ… Completed Features

#### Core Voice Assistant (Phase 1-12)
- **45+ ESPHome entities** - All implemented
- **Basic voice interaction** - Wake word detection, STT/TTS integration
- **Motion feedback** - Nod, shake, gaze and other basic actions
- **Audio processing** - AGC, noise suppression, echo cancellation
- **Camera stream** - MJPEG live preview

#### Partially Implemented Features (Phase 14-21)
- **Phase 14** - Emotion action API infrastructure (manual trigger available)
- **Phase 19** - Gravity compensation mode switch (teaching flow not implemented)

### ❌ Not Implemented Features

#### High Priority
- ~~**Phase 13** - Sendspin audio playback support~~ βœ… **Completed**
- **Phase 14** - Auto emotion action feedback (needs voice assistant event association)
- **Phase 15** - Continuous sound source tracking (only turn toward at wakeup)

#### Medium Priority
- **Phase 16** - Cartoon style motion mode (needs dynamic interpolation switching)
- **Phase 17** - Antenna sync animation
- **Phase 18** - Face tracking and eye contact interaction

#### Low Priority
- **Phase 19** - Teaching mode record/playback functionality
- **Phase 20** - IMU environment awareness response
- **Phase 21** - Home Assistant scene integration

---

## Feature Priority Summary (Updated)

### High Priority (Completed βœ…)
- βœ… **Phase 1-12**: Basic ESPHome entities (45+)
- βœ… Core voice assistant functionality
- βœ… Basic motion feedback (nod, shake, gaze)

### High Priority (Partial 🟑)
- 🟑 **Phase 13**: Emotion action feedback system
  - βœ… Emotion Selector entity and API infrastructure
  - ❌ Auto-trigger emotion actions based on voice assistant response
  - ❌ Intent recognition and emotion matching
  - ❌ Dance action library integration

### High Priority (Not Implemented ❌)
- ❌ **Phase 14**: Smart sound source tracking enhancement
  - βœ… Turn toward sound source at wakeup
  - ❌ Continuous sound source tracking
  - ❌ Multi-person conversation switching
  - ❌ Sound source visualization

### Medium Priority (Completed βœ…)
- βœ… **Phase 15**: Cartoon style motion mode
  - βœ… 100Hz unified control loop architecture (restored after daemon update)
  - βœ… JSON-driven animation system (AnimationPlayer)
  - βœ… Conversation state animations (idle/listening/thinking/speaking)
  - βœ… Pose change detection + state query caching (reduces daemon load)
  - ❌ Dynamic interpolation technique switching (CARTOON etc.)
- βœ… **Phase 16**: Antenna sync during speech
  - βœ… JSON-driven antenna animations with different patterns (both/wiggle)
  - βœ… State-specific antenna movements

### Medium Priority (Not Implemented ❌)
- ❌ **Phase 17**: Visual gaze interaction - Eye contact

### Low Priority (Partial 🟑)
- 🟑 **Phase 18**: Gravity compensation interactive mode
  - βœ… Gravity compensation mode switch
  - ❌ Teaching style interaction (record/playback functionality)

### Low Priority (Not Implemented ❌)
- ❌ **Phase 19**: Environment awareness response - IMU triggered actions
- ❌ **Phase 20**: Home Assistant scene integration - Smart home integration

---

## πŸ“ˆ Completion Statistics

| Phase | Status | Completion | Notes |
|-------|--------|------------|-------|
| Phase 1-12 | βœ… Complete | 100% | 40 ESPHome entities implemented (Phase 11 LED disabled) |
| Phase 13 | 🟑 Partial | 30% | API infrastructure ready, missing auto-trigger |
| Phase 14 | ❌ Not done | 20% | Only turn toward at wakeup implemented |
| Phase 15 | 🟑 Partial | 80% | 100Hz control loop + JSON animation system + pose change detection + state cache implemented |
| Phase 16 | βœ… Complete | 100% | JSON-driven animation with antenna movements |
| Phase 17 | ❌ Not done | 10% | Camera implemented, missing face detection |
| Phase 18 | 🟑 Partial | 40% | Mode switch implemented, missing teaching flow |
| Phase 19 | ❌ Not done | 10% | IMU data exposed, missing trigger logic |
| Phase 20 | ❌ Not done | 0% | Not implemented |

**Overall Completion**: **Phase 1-12: 100%** | **Phase 13-20: ~35%**


---

## πŸ”§ Daemon Crash Fix (2025-01-05)

### Problem Description
During long-term operation, `reachy_mini daemon` would crash, causing robot to become unresponsive.

### Root Cause
1. **100Hz control loop too frequent** - Calling `robot.set_target()` every 10ms, even when pose hasn't changed
2. **Frequent state queries** - Every entity state read calls `get_status()`, `get_current_head_pose()` etc.
3. **Missing change detection** - Even when pose hasn't changed, continues sending same commands
4. **Zenoh message queue blocking** - Accumulated 150+ messages per second, daemon cannot process in time

### Fix Solution

#### 1. Reduce control loop frequency (movement_manager.py)

```python

# Reduced from 100Hz to 20Hz

CONTROL_LOOP_FREQUENCY_HZ = 20  # 80% reduction in messages
```



#### 2. Add pose change detection (movement_manager.py)

```python

# Only send commands on significant pose changes

if self._last_sent_pose is not None:

    max_diff = max(abs(pose[k] - self._last_sent_pose.get(k, 0.0)) for k in pose.keys())

    if max_diff < 0.001:  # Threshold: 0.001 rad or 0.001 m

        return  # Skip sending

```

#### 3. State query caching (reachy_controller.py)

```python

# Cache daemon status query results

self._cache_ttl = 0.1  # 100ms TTL

self._last_status_query = 0.0

def _get_cached_status(self):

    now = time.time()

    if now - self._last_status_query < self._cache_ttl:
        return self._state_cache.get('status')  # Use cache

    # ... query and update cache

```


#### 4. Head pose query caching (reachy_controller.py)

```python

# Cache get_current_head_pose() and get_current_joint_positions() results

def _get_cached_head_pose(self):

    # Reuse cached results within 100ms

```



### Fix Results



| Metric | Before Fix | After Fix | Improvement |

|--------|------------|-----------|-------------|

| Control message frequency | ~100 msg/s | ~20 msg/s | ↓ 80% |

| State query frequency | ~50 msg/s | ~5 msg/s | ↓ 90% |

| Total Zenoh messages | ~150 msg/s | ~25 msg/s | ↓ 83% |

| Daemon CPU load | Sustained high load | Normal load | Significantly reduced |

| Expected stability | Crash within hours | Stable for days | Major improvement |



### Related Files

- `DAEMON_CRASH_FIX_PLAN.md` - Detailed fix plan and test plan
- `movement_manager.py` - Control loop optimization
- `reachy_controller.py` - State query caching

### Future Optimization Suggestions
1. ⏳ Dynamic frequency adjustment - 50Hz during motion, 5Hz when idle
2. ⏳ Batch state queries - Get all states at once
3. ⏳ Performance monitoring and alerts - Real-time daemon health monitoring

---

## πŸ”§ Daemon Crash Deep Fix (2026-01-07)

### Problem Description
During long-term operation, `reachy_mini daemon` still crashes, previous fix not thorough enough.

### Root Cause Analysis

Through deep analysis of SDK source code:

1. **Each `set_target()` sends 3 Zenoh messages**

   - `set_target_head_pose()` - 1 message

   - `set_target_antenna_joint_positions()` - 1 message  

   - `set_target_body_yaw()` - 1 message



2. **Daemon control loop is 50Hz**

   - See `reachy_mini/daemon/backend/robot/backend.py`: `control_loop_frequency = 50.0`

   - If message send frequency exceeds 50Hz, daemon may not process in time



3. **Previous 20Hz control loop still too high**
   - 20Hz Γ— 3 messages = 60 messages/second
   - Already exceeds daemon's 50Hz processing capacity

4. **Pose change threshold too small (0.002)**
   - Breathing animation, speech sway, face tracking continuously produce tiny changes
   - Almost every loop triggers `set_target()`

### Fix Solution

#### 1. Further reduce control loop frequency (movement_manager.py)

```python

# Reduced from 20Hz to 10Hz

# 10Hz Γ— 3 messages = 30 messages/second, safely below daemon's 50Hz capacity

CONTROL_LOOP_FREQUENCY_HZ = 10
```



#### 2. Increase pose change threshold (movement_manager.py)

```python

# Increased from 0.002 to 0.005

# 0.005 rad β‰ˆ 0.29 degrees, still smooth enough

self._pose_change_threshold = 0.005

```

#### 3. Reduce camera/face tracking frequency (camera_server.py)

```python

# Reduced from 15fps to 10fps

fps: int = 10

```



#### 4. Reduce IMU polling frequency (tap_detector.py)
```python

# Reduced from 50Hz to 20Hz

TAP_DETECTION_RATE_HZ = 20

```

#### 5. Increase state cache TTL (reachy_controller.py)

```python

# Increased from 1 second to 2 seconds

self._cache_ttl = 2.0

```



### Fix Results



| Metric | Before (20Hz) | After (10Hz) | Improvement |

|--------|---------------|--------------|-------------|

| Control loop frequency | 20 Hz | 10 Hz | ↓ 50% |

| Max Zenoh messages | 60 msg/s | 30 msg/s | ↓ 50% |

| Actual messages (with change detection) | ~40 msg/s | ~15 msg/s | ↓ 62% |

| Face tracking frequency | 15 Hz | 10 Hz | ↓ 33% |

| IMU polling frequency | 50 Hz | 20 Hz | ↓ 60% |

| State cache TTL | 1 second | 2 seconds | ↑ 100% |

| Expected stability | Crash within hours | Stable operation | Major improvement |



### Key Finding



Reference `reachy_mini_conversation_app` uses 100Hz control loop, but it's an official app that may have special optimizations or runs on more powerful hardware. Our app needs more conservative settings.

### Related Files
- `movement_manager.py` - Control loop frequency and pose threshold
- `camera_server.py` - Face tracking frequency
- `tap_detector.py` - IMU polling frequency
- `reachy_controller.py` - State cache TTL


---

## πŸ”§ Tap-to-Wake and Microphone Sensitivity Fix (2026-01-07)

### Problem Description
1. **Tap-to-wake blocking** - Conversation not working properly after tap wake, blocking issues
2. **Low microphone sensitivity** - Need to be very close for voice recognition

### Root Cause
1. **Audio playback blocking** - `_tap_continue_feedback()` plays sound in continuous conversation mode, blocking audio stream processing
2. **AGC settings not optimized** - ReSpeaker XVF3800 default settings not suitable for distant voice recognition

### Fix Solution

#### 1. Remove audio playback in continuous conversation feedback (satellite.py)
```python

def _tap_continue_feedback(self) -> None:

    """Provide feedback when continuing conversation in tap mode.

    

    Triggers a nod to indicate ready for next input.

    Sound is NOT played here to avoid blocking audio streaming.

    """

    # NOTE: Do NOT play sound here - it blocks audio streaming

    if self.state.motion_enabled and self.state.motion:

        self.state.motion.on_continue_listening()

```

#### 2. Add exception handling to tap callback (voice_assistant.py)

```python

def _on_tap_detected(self) -> None:
    """Callback when tap is detected on the robot.

    

    NOTE: This is called from the tap_detector background thread.

    """

    try:

        self._state.satellite.wakeup_from_tap()

        # ... motion feedback

    except Exception as e:

        _LOGGER.error("Error in tap detection callback: %s", e)

```


#### 3. Comprehensive microphone optimization (voice_assistant.py) - Updated 2026-01-07

```python

def _optimize_microphone_settings(self) -> None:
    """Optimize ReSpeaker XVF3800 microphone settings for voice recognition."""

    

    # ========== 1. AGC (Automatic Gain Control) Settings ==========

    # Enable AGC for automatic volume normalization

    respeaker.write("PP_AGCONOFF", [1])

    

    # Increase AGC max gain for better distant speech pickup (default ~15dB -> 30dB)

    respeaker.write("PP_AGCMAXGAIN", [30.0])

    

    # Set AGC desired output level (default ~-25dB -> -18dB for stronger output)

    respeaker.write("PP_AGCDESIREDLEVEL", [-18.0])

    

    # Optimize AGC time constant for voice commands

    respeaker.write("PP_AGCTIME", [0.5])

    

    # ========== 2. Base Microphone Gain ==========

    # Increase base microphone gain (default 1.0 -> 2.0)

    respeaker.write("AUDIO_MGR_MIC_GAIN", [2.0])

    

    # ========== 3. Noise Suppression Settings ==========

    # Reduce noise suppression to preserve quiet speech (default ~0.5 -> 0.15)

    respeaker.write("PP_MIN_NS", [0.15])

    respeaker.write("PP_MIN_NN", [0.15])

    

    # ========== 4. Echo Cancellation & High-pass Filter ==========

    respeaker.write("PP_ECHOONOFF", [1])

    respeaker.write("AEC_HPFONOFF", [1])

```


### Fix Results

| Parameter | Before | After | Notes |
|-----------|--------|-------|-------|
| Tap continuous conversation | Blocking | Working | Removed blocking audio playback |
| Microphone sensitivity | ~30cm | ~2-3m | Comprehensive AGC and gain optimization |
| AGC switch | Off | On | Auto volume normalization |
| AGC max gain | ~15dB | 30dB | Better distant speech pickup |
| AGC target level | -25dB | -18dB | Stronger output signal |
| Microphone gain | 1.0x | 2.0x | Base gain doubled |
| Noise suppression | ~0.5 | 0.15 | Reduced speech mis-suppression |
| Echo cancellation | On | On | Maintain clarity during TTS playback |
| High-pass filter | Off | On | Remove low-frequency noise |

### XVF3800 Parameter Reference

| Parameter Name | Type | Range | Description |
|----------------|------|-------|-------------|
| `PP_AGCONOFF` | int32 | 0/1 | AGC switch |
| `PP_AGCMAXGAIN` | float | 0-40 dB | AGC max gain |
| `PP_AGCDESIREDLEVEL` | float | dB | AGC target output level |
| `PP_AGCTIME` | float | seconds | AGC time constant |
| `AUDIO_MGR_MIC_GAIN` | float | 0-4.0 | Microphone gain multiplier |
| `PP_MIN_NS` | float | 0-1.0 | Minimum noise suppression (lower = less suppression) |
| `PP_MIN_NN` | float | 0-1.0 | Minimum noise estimation |
| `PP_ECHOONOFF` | int32 | 0/1 | Echo cancellation switch |
| `AEC_HPFONOFF` | int32 | 0/1 | High-pass filter switch |

### Related Files
- `satellite.py` - Removed blocking audio playback
- `voice_assistant.py` - Comprehensive microphone optimization
- `reachy_controller.py` - AGC entity default value updates
- `entity_registry.py` - AGC max gain range update (0-40dB)
- `reachy_mini/src/reachy_mini/media/audio_control_utils.py` - SDK reference

---

## πŸ”§ v0.5.1 Bug Fixes (2026-01-08)

### Issue 1: Music Not Resuming After Voice Conversation

**Problem**: Music doesn't resume after voice conversation ends.

**Root Cause**: Sendspin was incorrectly connected to `tts_player` instead of `music_player`.

**Fix**:
- `voice_assistant.py`: Sendspin discovery now connects to `music_player`
- `satellite.py`: `duck()`/`unduck()` now call `music_player.pause_sendspin()`/`resume_sendspin()`

### Issue 2: tap_sensitivity Not Persisted



**Problem**: tap_sensitivity value set in ESPHome lost after restart.

**Fix**:
- `models.py`: Added `tap_sensitivity` field to `Preferences` dataclass
- `entity_registry.py`: Entity setter now saves to `preferences.json`
- Load saved value on startup

### Issue 3: Audio Conflict During Voice Assistant Wakeup

**Problem**: Audio streaming (Sendspin or ESPHome audio) conflicts when voice assistant wakes up.

**Fix**:
- `audio_player.py`: Added `pause_sendspin()` and `resume_sendspin()` methods
- `satellite.py`: `duck()` now pauses Sendspin, `unduck()` resumes it
- Improved `pause()` method to actually stop audio output

### Issue 4: AttributeError for _camera_server

**Problem**: `_set_conversation_mode()` referenced non-existent `_camera_server` attribute.

**Fix**: Changed `self._camera_server` to `self.camera_server` (removed underscore prefix)

### Issue 5: tap_sensitivity Default Value Wrong



**Problem**: tap_sensitivity default was still 2.0g instead of expected 0.5g.

**Fix**: Use `TAP_THRESHOLD_G_DEFAULT` constant as default value

### Issue 6: Sendspin Sample Rate Optimization

**Problem**: ReSpeaker hardware I/O is 16kHz (hardware limitation), but Sendspin might try higher sample rates.

**Fix**: Prioritize 16kHz in Sendspin supported formats list to avoid unnecessary resampling

---

## πŸ”§ v0.5.15 Updates (2026-01-11)

### Feature 1: Audio Settings Persistence

**Problem**: AGC Enabled, AGC Max Gain, Noise Suppression settings lost after restart.

**Solution**: 
- `models.py`: Added `agc_enabled`, `agc_max_gain`, `noise_suppression` fields to `Preferences` dataclass (Optional, None = use default)
- `entity_registry.py`: Entity setters now save to `preferences.json`
- `voice_assistant.py`: `_optimize_microphone_settings()` now restores saved values from preferences on startup

**Behavior**:
- First startup: Use optimized defaults (AGC=ON, MaxGain=30dB, NoiseSuppression=15%)
- After user changes via Home Assistant: Values persisted and restored on restart

### Feature 2: Sendspin Discovery Refactoring

**Problem**: Sendspin mDNS discovery code was in `audio_player.py`, mixing concerns.

**Solution**:
- `zeroconf.py`: Added `SendspinDiscovery` class for mDNS service discovery
- `audio_player.py`: Simplified to use `SendspinDiscovery` via callback pattern
- Better separation of concerns: zeroconf.py handles all mDNS, audio_player.py handles audio



### Fix 1: Tap Detection During Emotion Playback



**Problem**: Tap detection was re-enabled after emotion playback completes, even during active conversation.



**Root Cause**: `_play_emotion()` and `_wait_for_move_completion()` always re-enabled tap detection without checking pipeline state.



**Fix**:

- `satellite.py`: Check `_pipeline_active` before re-enabling tap detection

- Only re-enable tap detection if conversation has ended (pipeline not active)



**Related Files**:

- `models.py` - Preferences fields

- `entity_registry.py` - Entity setters with persistence
- `voice_assistant.py` - Settings restoration on startup
- `zeroconf.py` - SendspinDiscovery class
- `audio_player.py` - Simplified Sendspin integration
- `satellite.py` - Tap detection fix


---

### SDK Data Structure Reference

```python

# Motor control mode

class MotorControlMode(str, Enum):

    Enabled = "enabled"              # Torque on, position control

    Disabled = "disabled"            # Torque off

    GravityCompensation = "gravity_compensation"  # Gravity compensation mode



# Daemon state

class DaemonState(Enum):

    NOT_INITIALIZED = "not_initialized"

    STARTING = "starting"

    RUNNING = "running"

    STOPPING = "stopping"

    STOPPED = "stopped"

    ERROR = "error"



# Full state

class FullState:

    control_mode: MotorControlMode

    head_pose: XYZRPYPose  # x, y, z (m), roll, pitch, yaw (rad)

    head_joints: list[float]  # 7 joint angles

    body_yaw: float

    antennas_position: list[float]  # [right, left]

    doa: DoAInfo  # angle (rad), speech_detected (bool)



# IMU data (wireless version only)

imu_data = {

    "accelerometer": [x, y, z],  # m/sΒ²

    "gyroscope": [x, y, z],      # rad/s

    "quaternion": [w, x, y, z],  # Attitude quaternion

    "temperature": float         # Β°C

}



# Safety limits

HEAD_PITCH_ROLL_LIMIT = [-40Β°, +40Β°]

HEAD_YAW_LIMIT = [-180Β°, +180Β°]

BODY_YAW_LIMIT = [-160Β°, +160Β°]

YAW_DELTA_MAX = 65Β°  # Max difference between head and body yaw

```

### ESPHome Protocol Implementation Notes

ESPHome protocol communicates with Home Assistant via protobuf messages. The following message types need to be implemented:

```python

from aioesphomeapi.api_pb2 import (

    # Number entity (volume/angle control)

    ListEntitiesNumberResponse,

    NumberStateResponse,

    NumberCommandRequest,



    # Select entity (motor mode)

    ListEntitiesSelectResponse,

    SelectStateResponse,

    SelectCommandRequest,



    # Button entity (wake/sleep)

    ListEntitiesButtonResponse,

    ButtonCommandRequest,



    # Switch entity (motor switch)

    ListEntitiesSwitchResponse,

    SwitchStateResponse,

    SwitchCommandRequest,



    # Sensor entity (numeric sensors)

    ListEntitiesSensorResponse,

    SensorStateResponse,



    # Binary Sensor entity (boolean sensors)

    ListEntitiesBinarySensorResponse,

    BinarySensorStateResponse,



    # Text Sensor entity (text sensors)

    ListEntitiesTextSensorResponse,

    TextSensorStateResponse,

)

```

## Reference Projects

- [OHF-Voice/linux-voice-assistant](https://github.com/OHF-Voice/linux-voice-assistant)
- [pollen-robotics/reachy_mini](https://github.com/pollen-robotics/reachy_mini)
- [reachy_mini_conversation_app](https://github.com/pollen-robotics/reachy_mini_conversation_app)
- [sendspin-cli](https://github.com/Sendspin/sendspin-cli)
- [home-assistant-voice](https://github.com/esphome/home-assistant-voice-pe/blob/dev/home-assistant-voice.yaml)