Bonjour,
Depuis quelques temps j’essaye de faire fonctionner assit à partir d’un esp32. La pipeline fonctionne correctement depuis mon téléphone mais impossible de réveiller via un wake word ou de jouer une commande depuis mon esp32.
En essayer de jouer un son à partir de l’entité media_player, je me suis rendu compte que l’ip de home assistant reçu par mon esp pour lire le fichier n’était pas la bonne.
[15:49:06][D][media_player:059]: 'esp_speaker' - Setting
[15:49:06][D][media_player:066]: Media URL: http://172.16.12.149:8123/api/tts_proxy/3e416feacc5571ef96cc0c6fc7ab6cc3033482da_fr-fr_cfb8c65493_tts.piper.mp3
Je m’explique, Home Assistant est installé sur mon serveur TrueNAS via les graphiques Helm de TrueCharts. Il en va de même pour mon instance ESPHome.
Home Assistant est exposé via une adresse IP « externe » accessible depuis mon réseau local, mais aussi par un DNS et une adresse IP « locale » propre à la couche réseau gérée par Kubernetes, donc accessible uniquement depuis celle-ci.
Le problème est que l’adresse IP 172.16.12.149 envoyée par Home Assistant à l’ESP32 pour récupérer le fichier MP3 à lire n’est pas accessible depuis mon ESP32. Comment pourrais-je faire pour forcer cette adresse IP sur l’adresse IP de Home Assistant accessible depuis mon réseau local ?
Ma configuration
System Information
version |
core-2024.3.3 |
installation_type |
Unknown |
dev |
false |
hassio |
false |
docker |
false |
user |
root |
virtualenv |
false |
python_version |
3.12.2 |
os_name |
Linux |
os_version |
6.1.74-production+truenas |
arch |
x86_64 |
timezone |
Europe/Paris |
config_dir |
/config |
Home Assistant Community Store
GitHub API |
ok |
GitHub Content |
ok |
GitHub Web |
ok |
GitHub API Calls Remaining |
5000 |
Installed Version |
1.34.0 |
Stage |
running |
Available Repositories |
1399 |
Downloaded Repositories |
10 |
Home Assistant Cloud
logged_in |
true |
subscription_expiration |
1 janvier 2018 à 01:00 |
relayer_connected |
false |
relayer_region |
null |
remote_enabled |
false |
remote_connected |
false |
alexa_enabled |
false |
google_enabled |
false |
remote_server |
null |
certificate_status |
null |
instance_id |
2793dc40f8764300baee627dede03962 |
can_reach_cert_server |
ok |
can_reach_cloud_auth |
ok |
can_reach_cloud |
ok |
Dashboards
dashboards |
4 |
resources |
9 |
views |
14 |
mode |
storage |
Recorder
oldest_recorder_run |
29 février 2024 à 19:28 |
current_recorder_run |
26 mars 2024 à 23:20 |
estimated_db_size |
1255.25 MiB |
database_engine |
postgresql |
database_version |
15.6 |
___
J’ai trouvé. Sur home assistant dans paramètre > réseau, il faut renseigner l’url de connexion locale.
Cela a résolu mon problème de lecture de fichier en envoyant la bonne IP à l’esp.
Malheureusement, cela n’aura pas corrigé mon problème d’assistant vocal
.
Hello,
Pour ton pb Assist , as-tu vérifié le bon fonctionnement de ton pipeline avec wakeword ?
Tu peux tester depuis ton ordi la detection du Wakeword en allant dans la partie debug de ton pipeline et en cliquant sur le petit micro affiché en haut à droite. Tu auras alors accès à ce menu:
Si OK, tu peux alors tester sur ton ESP et regarder les logs remontés par ce dernier ainsi que les infos dans la partie debug de ton pipeline
Hello @Krull56 ,
Merci pour les infos.
Oui le wakeword est bien détecté sur mon pc comme sur mon téléphone via la partie debug.
Dans les logs mon pipeline il n’y a rien de particulier.
Je ne vois rien non plus dans les logs de mon esp :
INFO ESPHome 2024.3.1
INFO Reading configuration /config/test-2.yaml...
INFO Starting log output from 192.168.1.145 using esphome API
INFO Successfully connected to test-2 @ 192.168.1.145 in 0.008s
INFO Successful handshake with test-2 @ 192.168.1.145 in 0.116s
[13:22:38][I][app:102]: ESPHome version 2024.3.1 compiled on Mar 29 2024, 17:14:23
[13:22:38][C][wifi:580]: WiFi:
[13:22:38][C][wifi:408]: Local MAC: EC:64:C9:81:04:5C
[13:22:38][C][wifi:413]: SSID: [redacted]
[13:22:38][C][wifi:416]: IP Address: 192.168.1.145
[13:22:38][C][wifi:420]: BSSID: [redacted]
[13:22:38][C][wifi:421]: Hostname: 'test-2'
[13:22:38][C][wifi:423]: Signal strength: -46 dB ▂▄▆█
[13:22:38][C][wifi:427]: Channel: 11
[13:22:38][C][wifi:428]: Subnet: 255.255.255.0
[13:22:38][C][wifi:429]: Gateway: 192.168.1.1
[13:22:38][C][wifi:430]: DNS1: 0.0.0.0
[13:22:38][C][wifi:431]: DNS2: 0.0.0.0
[13:22:38][C][logger:166]: Logger:
[13:22:38][C][logger:167]: Level: DEBUG
[13:22:38][C][logger:169]: Log Baud Rate: 115200
[13:22:38][C][logger:170]: Hardware UART: UART0
[13:22:38][C][light:103]: Light 'Light'
[13:22:38][C][light:105]: Default Transition Length: 0.5s
[13:22:38][C][light:106]: Gamma Correct: 2.80
[13:22:38][C][template.switch:068]: Template Switch 'Use wake word'
[13:22:38][C][template.switch:091]: Restore Mode: restore defaults to ON
[13:22:38][C][template.switch:057]: Optimistic: YES
[13:22:38][C][status:034]: Status Binary Sensor 'API Connection'
[13:22:38][C][status:034]: Device Class: 'connectivity'
[13:22:38][C][captive_portal:088]: Captive Portal:
[13:22:38][C][mdns:115]: mDNS:
[13:22:38][C][mdns:116]: Hostname: test-2
[13:22:38][C][ota:096]: Over-The-Air Updates:
[13:22:38][C][ota:097]: Address: 192.168.1.145:3232
[13:22:38][C][ota:100]: Using Password.
[13:22:38][C][ota:103]: OTA version: 2.
[13:22:38][C][api:139]: API Server:
[13:22:38][C][api:140]: Address: 192.168.1.145:6053
[13:22:38][C][api:142]: Using noise encryption: YES
[13:22:38][C][audio:203]: Audio:
[13:22:38][C][audio:225]: External DAC channels: 1
[13:22:38][C][audio:226]: I2S DOUT Pin: 27
[13:22:39][D][binary_sensor:036]: 'API Connection': Sending state ON
[13:22:39][E][voice_assistant:462]: No API client connected
[13:22:39][D][voice_assistant:416]: State changed from IDLE to IDLE
[13:22:39][D][voice_assistant:422]: Desired state set to IDLE
[13:22:43][D][api:102]: Accepted 192.168.1.199
[13:22:43][D][api.connection:1159]: Home Assistant 2024.3.3 (192.168.1.199): Connected successfully
[13:22:44][D][voice_assistant:416]: State changed from IDLE to START_PIPELINE
[13:22:44][D][voice_assistant:422]: Desired state set to START_MICROPHONE
[13:22:44][D][voice_assistant:118]: microphone not running
[13:22:44][D][voice_assistant:202]: Requesting start...
[13:22:44][D][voice_assistant:416]: State changed from START_PIPELINE to STARTING_PIPELINE
[13:22:44][D][voice_assistant:118]: microphone not running
[13:22:44][D][voice_assistant:118]: microphone not running
[13:22:44][D][voice_assistant:118]: microphone not running
[13:22:44][D][voice_assistant:437]: Client started, streaming microphone
[13:22:44][D][voice_assistant:416]: State changed from STARTING_PIPELINE to START_MICROPHONE
[13:22:44][D][voice_assistant:422]: Desired state set to STREAMING_MICROPHONE
[13:22:44][D][voice_assistant:155]: Starting Microphone
[13:22:44][D][voice_assistant:416]: State changed from START_MICROPHONE to STARTING_MICROPHONE
[13:22:44][D][voice_assistant:523]: Event Type: 1
[13:22:44][D][voice_assistant:526]: Assist Pipeline running
[13:22:44][D][voice_assistant:416]: State changed from STARTING_MICROPHONE to STREAMING_MICROPHONE
[13:22:44][D][voice_assistant:523]: Event Type: 9
Et voici ceux de openwakeword :
2024-03-30 13:22:38.243418+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17151971570163
2024-03-30 13:22:44.218530+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17157946263179
2024-03-30 13:22:44.221683+01:00DEBUG:wyoming_openwakeword.handler:Receiving audio from client: 17157946263179
2024-03-30 13:22:48.241967+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17161970642708
2024-03-30 13:22:48.242159+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17161970642708
2024-03-30 13:22:48.242295+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17161971045295
2024-03-30 13:22:48.242345+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17161971045295
2024-03-30 13:22:58.242131+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17171970801862
2024-03-30 13:22:58.242203+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17171970871843
2024-03-30 13:22:58.242218+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17171970801862
2024-03-30 13:22:58.242242+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17171970871843
2024-03-30 13:23:08.242657+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17181971269457
2024-03-30 13:23:08.242747+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17181971444115
2024-03-30 13:23:08.242967+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17181971269457
2024-03-30 13:23:08.243014+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17181971444115
2024-03-30 13:23:18.242360+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17191971019149
2024-03-30 13:23:18.242410+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17191971085970
2024-03-30 13:23:18.242578+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17191971085970
2024-03-30 13:23:18.242611+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17191971019149
2024-03-30 13:23:28.242603+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17201971272722
2024-03-30 13:23:28.242651+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17201971272722
2024-03-30 13:23:28.242750+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17201971461949
2024-03-30 13:23:28.242800+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17201971461949
2024-03-30 13:23:38.242925+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17211971613947
2024-03-30 13:23:38.243114+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17211971613947
2024-03-30 13:23:38.243129+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17211971769141
2024-03-30 13:23:38.243137+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17211971769141
2024-03-30 13:23:48.244203+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17221972428548
2024-03-30 13:23:48.245311+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17221972428548
2024-03-30 13:23:48.245970+01:00DEBUG:wyoming_openwakeword.handler:Client connected: 17221974391938
2024-03-30 13:23:48.246365+01:00DEBUG:wyoming_openwakeword.handler:Client disconnected: 17221974391938
comme sur mon téléphone
Pas de wakeword sur smartphone 
Peux-tu détailler ton montage esp ?
- Type de carte
- Cablage du micro ( INMP441 ?) Notamment au niveau du L/R
- le code yaml de ton esp
As tu essayé avec Porcupine ou Snowboy pour le wakeword ?
Pas de wakeword sur smartphone 
Sur la version mobile, il y a les mêmes fonctionnalités que la version web.
Peux-tu détailler ton montage esp ?
J’ai testé différentes cartes mais mon dernier montage est avec un esp32-CH340C.
Voici quelques photos du dernier montage que j’ai testé :
D’un point de vue schématique le montage est comme ci dessous :
- Cablage du micro ( INMP441 ?) Notamment au niveau du L/R
En effet j’utilise bien un IMP441 qui pour info fonctionne lorsque je le couple avec un esp32-s3 et microwakeword (mais c’est la seule étape qui fonctionne).
le code yaml de ton esp
Je te joins le code de mon esp :
esphome:
name: test-2
friendly_name: test-2
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
encryption:
key: ""
ota:
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.1.145
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.1.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Test-2 Fallback Hotspot"
password: "q9JwgSja5m2G"
captive_portal:
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO26 #WS
i2s_bclk_pin: GPIO25 #SCK
microphone:
- platform: i2s_audio
adc_type: external
pdm: false
id: mic_i2s
channel: right
bits_per_sample: 32bit
i2s_audio_id: i2s_in
i2s_din_pin: GPIO33 #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: GPIO27 # DIN Pin of the MAX98357A Audio Amplifier
mode: mono
voice_assistant:
microphone: mic_i2s
id: va
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 4.0
use_wake_word: false
media_player: media_player_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);
light:
- platform: neopixelbus
id: led_light
type: grb
pin: GPIO32 # DIN pin of the LED Strip
num_leds: 9 # change the Number of LEDS according to your LED Strip.
name: "Light"
variant: sk6812
default_transition_length: 0.5s
effects:
- addressable_scan:
name: Scan Effect With Custom Values
move_interval: 50ms
scan_width: 2
As tu essayé avec Porcupine ou Snowboy pour le wakeword ?
Oui j’ai essayé avec Porcupine mais malheureusement le résultat est le même.
Hello
Retire la partie Channel left de ton microphone ou passe le à left pour que ça colle à ton cablage (L/R sur gnd)
Pour la partie STT de ton pipeline je te conseille d’utiliser Vosk à la place de faster whisper
Et quand je dis pas de wakeword sur les smartphones c’est que tu ne peux pas réveiller Assist sur ces derniers comme on peut le faire avec hey Siri ou ok Google
Hello,
J’ai testé en mettant le canal à left. Toujours aucun son n’est envoyé à Openwakeword ou Porcupine.
J’ai essayé Vosk mais il m’a semblé moins efficace dans la reconnaisse vocal que Whisper.
Ok pour les smartphones 
Je pense avoir tout essayé. Je vais rester sur mon Google Home qui à le mérite de fonctionner.
Merci tout de même pour ton aide.
Hello
Et ça fonctionne correctement sur ton esp32-s3 ?
J’ai réceptionné une de ces cartes aujourd’hui et avec un petit montage rapide sans sortie son ca fonctionne très bien.
Même le micro wakeword intégré dans le code ( okay Nabu) est très réactif.
Il me reste à tester l’audio out
Pour ton esp32 classique, ton code est correct et sensiblement identique à mes 4 autres satellites, je suppose un pb de câblage ou peut être le mauvais pipeline déclaré pour cette carte 
Non sur mon s3 seul le microwakeword fonctionne (ce qui valide le montage et le micro déjà).
Voici la configuration de mon pipeline.
Et j’ai la même chose pour mon pipeline avec porcupine et vosk.
Le seul truc qui me parait étrange est les mp3 en provenance de mes esp qui sont générés avec une taille de 44 octets lorsque j’ajoute le debug de voice_assistant dans mon fichier config.yml.
assist_pipeline:
debug_recording_dir: /config/stt/assist_pipeline
Je commence à me demander si ce n’est pas fait pour fonctionner uniquement avec Home Assistant OS et non Home Assistant Core.
Dans l’intégration ESPHOME quand tu cliques sur configurer en face de ton ESP tu as bien ça d’activé ?
Oui je comprends.
Le voice_assist via esphome manque cruellement d’infos pour debugger je trouve.