I’ve got the basics of a smart speaker set up on a ESP32-C3-Zero, which was OK before updating to 2024.5.0
It plays a few different .mp3s that are in my home assistants www folder.
The audio and media player are set like:
i2s_audio: # I2s audio pins
- id: i2s_in
i2s_lrclk_pin: $i2s_lrclk_in_pin # Mic WS
i2s_bclk_pin: $i2s_bclk_in_pin # Mic CK
- id: i2s_out
i2s_lrclk_pin: $i2s_lrclk_out_pin # Spk LRC
i2s_bclk_pin: $i2s_bclk_out_pin # Spk BCLK
adf_pipeline: # ADF pieline pins
- platform: i2s_audio
type: audio_out
id: adf_i2s_out
i2s_audio_id: i2s_out
i2s_dout_pin: GPIO6 # Spk DIN
- platform: i2s_audio
type: audio_in
id: adf_i2s_in
i2s_audio_id: i2s_in
i2s_din_pin: $i2s_din_pin # Mic SD/DA
channel: left
sample_rate: 16000
bits_per_sample: 16bit
pdm: false
media_player: # Media player
- platform: adf_pipeline
id: jarvis_media_player
name: Media Player
internal: false
icon: mdi:speaker-wireless
pipeline:
- self
- adf_i2s_out
microphone: # ADF Mic
- platform: adf_pipeline
id: mic
pipeline:
- adf_i2s_in
- self
I’ve got a button set to do:
button:
- platform: template
name: Test sound
id: test_sound
icon: "mdi:speaker-play"
disabled_by_default: true # Shows entity in HA, but disabled by default
on_press:
- media_player.play_media: "http://192.168.5.5:8123/local/Voice_assistant/im_listening.mp3"
This worked reliably before updating, and doesn’t since. I’ve had it work and play the .mp3 just once, over multiple restarts of everything involved.
I see this in the ESPs logs:
[23:01:32][D][button:010]: 'Test sound' Pressed.
[23:01:32][D][media_player:061]: 'Media Player' - Setting
[23:01:32][D][media_player:068]: Media URL: http://192.168.5.5:8123/local/Voice_assistant/im_listening.mp3
[23:01:32][D][adf_media_player:030]: Got control call in state 1
[23:01:32][D][esp_adf_pipeline:050]: Starting request, current state UNINITIALIZED
[23:01:32][D][esp-idf:000]: I (132522) MP3_DECODER: MP3 init
[23:01:32][D][esp-idf:000]: I (132528) I2S: DMA Malloc info, datalen=blocksize=512, dma_buf_count=4
[23:01:32][D][i2s_audio:072]: Installing driver : yes
[23:01:32][D][esp_adf_pipeline:358]: pipeline tag 0, http
[23:01:32][D][esp_adf_pipeline:358]: pipeline tag 1, decoder
[23:01:32][D][esp_adf_pipeline:358]: pipeline tag 2, i2s_out
[23:01:32][D][esp-idf:000]: I (132540) AUDIO_PIPELINE: link el->rb, el:0x3de20d8c, tag:http, rb:0x3de21290
[23:01:32][D][esp-idf:000]: I (132543) AUDIO_PIPELINE: link el->rb, el:0x3de20f4c, tag:decoder, rb:0x3de222d0
[23:01:32][D][esp_adf_pipeline:370]: Setting up event listener.
[23:01:32][D][esp_adf_pipeline:302]: State changed from UNINITIALIZED to PREPARING
[23:01:32][I][adf_media_player:135]: got new pipeline state: 1
[23:01:32][D][adf_i2s_out:127]: Set final i2s settings: 22050
[23:01:32][D][esp-idf:000]: I (132575) AUDIO_THREAD: The http task allocate stack on external memory
[23:01:32][D][esp-idf:000]: I (132577) AUDIO_ELEMENT: [http-0x3de20d8c] Element task created
[23:01:32][D][esp-idf:000]: I (132580) AUDIO_THREAD: The decoder task allocate stack on external memory
[23:01:32][D][esp-idf:000]: I (132582) AUDIO_ELEMENT: [decoder-0x3de20f4c] Element task created
[23:01:32][D][esp-idf:000][http]: I (132585) AUDIO_ELEMENT: [http] AEL_MSG_CMD_RESUME,state:1
[23:01:32][D][esp-idf:000][decoder]: I (132588) AUDIO_ELEMENT: [decoder] AEL_MSG_CMD_RESUME,state:1
[23:01:32][D][esp_audio_sources:097]: Streamer status: 2
[23:01:32][D][esp_audio_sources:098]: decoder status: 2
[23:01:32][D][esp-idf:000][http]: I (132618) HTTP_CLIENT: Body received in fetch header state, 0x3fcc3819, 1703
[23:01:32][D][esp-idf:000][http]: I (132624) HTTP_STREAM: total_bytes=9541
[23:01:32][I][HTTPStreamReader:129]: [ * ] Receive music info from mp3 decoder, sample_rates=22050, bits=16, ch=1
[23:01:32][D][adf_i2s_out:127]: Set final i2s settings: 22050
[23:01:32][D][esp-idf:000][decoder]: W (132706) AUDIO_ELEMENT: OUT-[decoder] AEL_IO_ABORT
[23:01:32][D][esp-idf:000][decoder]: W (132711) MP3_DECODER: output aborted -3
[23:01:32][D][esp-idf:000][decoder]: I (132717) MP3_DECODER: Closed
[23:01:32][D][esp_adf_pipeline:302]: State changed from PREPARING to STARTING
[23:01:32][I][adf_media_player:135]: got new pipeline state: 2
[23:01:32][D][adf_i2s_out:127]: Set final i2s settings: 22050
[23:01:32][D][esp-idf:000]: I (132743) AUDIO_ELEMENT: [i2s_out-0x3de21118] Element task created
[23:01:32][D][esp-idf:000]: I (132745) AUDIO_PIPELINE: Func:audio_pipeline_run, Line:359, MEM Total:2103415 Bytes, Inter:163960 Bytes, Dram:163960 Bytes
[23:01:32][D][esp-idf:000][http]: I (132747) AUDIO_ELEMENT: [http] AEL_MSG_CMD_RESUME,state:1
[23:01:32][D][esp-idf:000][decoder]: I (132751) AUDIO_ELEMENT: [decoder] AEL_MSG_CMD_RESUME,state:1
[23:01:32][D][esp-idf:000][i2s_out]: I (132754) AUDIO_ELEMENT: [i2s_out] AEL_MSG_CMD_RESUME,state:1
[23:01:32][D][esp-idf:000]: I (132757) AUDIO_PIPELINE: Pipeline started
[23:01:32][I][esp_adf_pipeline:214]: [ decoder ] status: 14
[23:01:32][D][esp-idf:000][http]: I (132833) HTTP_CLIENT: Body received in fetch header state, 0x3fcbf4c1, 1703
[23:01:32][D][esp-idf:000][http]: I (132840) HTTP_STREAM: total_bytes=9541
[23:01:32][I][esp_adf_pipeline:214]: [ http ] status: 14
[23:01:32][I][esp_adf_pipeline:214]: [ i2s_out ] status: 12
[23:01:32][D][esp_adf_pipeline:131]: Check element [http] status, 3
[23:01:32][D][esp_adf_pipeline:131]: Check element [decoder] status, 3
[23:01:32][D][esp_adf_pipeline:131]: Check element [i2s_out] status, 3
[23:01:32][D][esp_adf_pipeline:302]: State changed from STARTING to RUNNING
[23:01:32][I][adf_media_player:135]: got new pipeline state: 3
[23:01:32][D][adf_i2s_out:127]: Set final i2s settings: 22050
[23:01:32][I][esp_adf_pipeline:214]: [ http ] status: 12
[23:01:32][D][esp-idf:000][http]: W (132976) HTTP_STREAM: No more data,errno:0, total_bytes:9541, rlen = 0
[23:01:32][D][esp-idf:000][http]: I (132981) AUDIO_ELEMENT: IN-[http] AEL_IO_DONE,0
[23:01:32][I][esp_adf_pipeline:214]: [ decoder ] status: 12
[23:01:32][I][HTTPStreamReader:129]: [ * ] Receive music info from mp3 decoder, sample_rates=22050, bits=16, ch=1
[23:01:32][D][adf_i2s_out:127]: Set final i2s settings: 22050
[23:01:32][I][esp_adf_pipeline:214]: [ http ] status: 15
[23:01:32][D][esp_adf_pipeline:302]: State changed from RUNNING to STOPPING
[23:01:32][I][adf_media_player:135]: got new pipeline state: 4
[23:01:33][D][esp-idf:000][decoder]: I (133371) AUDIO_ELEMENT: IN-[decoder] AEL_IO_DONE,-2
[23:01:33][D][esp-idf:000][decoder]: I (133761) MP3_DECODER: Closed
[23:01:33][D][esp-idf:000][i2s_out]: I (133876) AUDIO_ELEMENT: IN-[i2s_out] AEL_IO_DONE,-2
[23:01:33][D][esp_adf_pipeline:400]: Called deinit_all
[23:01:33][D][esp-idf:000]: I (134074) AUDIO_PIPELINE: audio_pipeline_unlinked
[23:01:33][D][esp-idf:000]: W (134077) AUDIO_ELEMENT: [http] Element has not create when AUDIO_ELEMENT_TERMINATE
[23:01:33][D][esp-idf:000]: W (134079) AUDIO_ELEMENT: [decoder] Element has not create when AUDIO_ELEMENT_TERMINATE
[23:01:33][D][esp-idf:000]: W (134081) AUDIO_ELEMENT: [i2s_out] Element has not create when AUDIO_ELEMENT_TERMINATE
[23:01:34][D][esp-idf:000]: I (134085) I2S: DMA queue destroyed
[23:01:34][D][esp_adf_pipeline:302]: State changed from STOPPING to UNINITIALIZED
[23:01:34][I][adf_media_player:135]: got new pipeline state: 0
Nothing plays whether I click the button in home assistant, or the button in the web server from the ESP. The best I’ve managed since updating is a very short mp3 playing once and not playing a second time. Sometimes the ESP restarts when I try, sometimes it doesn’t.
Trying to play alerts to the esp media player using TTS has stopped working too.
If I roll back to the last version of esphome within HA, it works reliably again.
I’m not sure how to find what’s going wrong.
Has anyone got any ideas that could help figure out what’s wrong and get this going again please?