core: Media player does not go back to "idle" after playing TTS announcement
The problem
On HA 2025.4.x, playing a TTS announcement via tts.cloud_say on a speaker running ESPHome (Raspiaudio Muse Luxe and HA Voice PE) causes the media_player entity to remain stuck in status “playing” instead of going back to “idle” after audio playback is over. It worked well until HA 2025.3.4.
Unless stopped manually, the same TTS announcement is played again on the speaker every 2 minutes, in a loop. In other words, the media_player stays in “playing” status forever and plays the same announcement repeatedly every 2 minutes, with silence in between and an audio glitch after each repetition (glitch that also wasn’t there until HA 2025.3.4).
What version of Home Assistant Core has the issue?
2025.4.0b12
What was the last working version of Home Assistant Core?
2025.3.4
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Media Player
Link to integration documentation on our website
https://www.home-assistant.io/integrations/media_player/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 11
- Comments: 168 (22 by maintainers)
I set up a development system and I was able to use port-forwarding to reach one of the media players. Using git bisect I was able to find the first commit where the problem is seen:
I have no idea how to fix the problem, but hopefully someone (maybe @balloob) will see a solution. It can easily be reproduced using TTS on the media page of the UI.
I’ve had some time to try to determine exactly what is failing and I’m getting the impression its the tts component.
Audio files play as they should, sending an mp3 plays as they should. Sending a mp3 file to a media player after a tts call clears the issue.
After a tts.speak call the media player stays in a ‘playing’ state. It will repeat the announcement after ~67 seconds. This is repeatable.
Below is a fragment of my script that I play all tts messages with. The script will play the tts message and then after 15 seconds play the wav file. Since its hitting the timeout of one wait template this shows that the media player is not going to an idle until the wav file is played. I get the same results if sending to a group of media players or a single media player.
If I look at the raw logs this is the only thing that appears strange.
2025-04-18 14:33:36.660 WARNING (MainThread) [homeassistant.helpers.service] Referenced devices media_player.livingroom are missing or not currently availableThis is the media player I’m sending the test messages to and its working (but still not going to idle).
I may be focusing too much on the audio, but I think I hear a fzzzz… sound a the tts audio speak that I did not hear before. But I did not pay attention that closely before this debugging session. This issue is surely related to the upgrade, because after I posted my first post in this thread I rolled by my ha install to 2025.3.4 and everything was working 100%, this morning I upgraded to 2025.4.2 and the issue came back. I also upgraded and recompiled several of my esphome speakers to the 2025.4 release. They all exhibited this ~67 second repeat message.
I am using piper for my tts generation, but I’m running piper on a jetson nano and not as part of ha. So any updates to piper that came with the 2025.4.2 upgrade would not have caused piper on the nano to act strange.
Looking at the change log for 2025.4.0 there seems to be:
At least there are fingerprints on someone changing TTS code. I’m not smart enough to know what bits changed or what might be causing the problem.
I really don’t think the issue is within esphome, the media players (esphome or home assistant PE), I don’t think its with piper tts (I can’t say if the cloud version of tts does this same repeat or not Edit: there was a link to another thread that said that google.tts had the repeating issue too ). Its surely related to upgrading to 2025.4.x because I can down grade and the repeating will stop. I can reboot HA and the repeating will stop. The media players stay in a playing state and the light stays on the esphone players indicating the comms channel is still open.
The debug truth table (in my head) points to something with the tts call not closing the audio channel.
unfortunately this still does not work in HA version 2025.4.4
The problem is still present in HA 2025.4.2.
I found that, unless stopped manually, the same TTS announcement is played again on the speaker every 2 minutes, in a loop. So, the media_player is “playing” the same announcement repeatedly every 2 minutes, with silence in between… which I assume is why it never gets back to “idle” state. @synesthesiam Thanks for taking a look and happy to test or provide more information as needed.
I had this problem right after updating NA to 2025.4
I have absolutely identical situation. Has anyone found a solution?
Hi,
The fix is in esphome (not HA core). The next esphome should be version 2025.6 and normally it is released mid-month.
Cheers
I happened to be repourposing one of my esp32 media players so I thought I would give this a short based on @adhdtjuh post. While I had to tweak it a bit I was able to compile @p-jean 's patch into the build process without needing to setup a separate esphome install just for compiling an aurdrio based media player with the fix.
for disclosure this is how I had to adjust my esphome section based on @adhdtjuh 's post.
This compiled correctly on esphome v 2025.5.2 with HA v2025.5.3 (ATM, I’m not interested in loading 2025.6.0 since I have everything working)
@synesthesiam it appears that @p-jean has a fix (for the repeating announcement issue) here. https://github.com/esphome/ESP32-audioI2S/issues/18 I can confirm that the patch of the Audio.* files does work for the Arduino IDE platform ESP32 DIY media players.
I don’t know why the firmware keeps reverting and why the reverting only happens with speech images and not the other ESPHome devices, but I’ve found a workaround that doesn’t involve using external timers to stop the repeating.
I simply installed the ESPHome YAML code for my speaker twice - one install after another, without a reboot in between. This makes the “old” image and the new image the same. Now when it reverts, it just runs the same image. I haven’t done any testing to see if future image changes still revert. For now I’m happy this workaround works.
I made an “experimental” fix to the media-player that works for me. I have the following versions: 1 raspi, 2 atom, 2 ESP32 D1.
Why call it experimental?
I wrote instructions on how to build and install the fix here: https://github.com/esphome/ESP32-audioI2S/issues/18
I guess you need above average computer skills to do it. I can’t promise success. If you get stuck you should be able to revert via the esphome builder in HA. If it works for you then you are done. Just keep building from the command line until a fix is official.
Please let me know if you try it, and if you see any problems that are new.
After ESPHome 2025.4.1 update everything is the same.
In case it helps, I captured the mp3 get traffic in the working case and in the not-working case:
NOT WORKING:
WORKING
I used SNIP to replace some of the binary content.
I don’t know github from an issue management point, but why under Milestone does it say closed? Is it because this issue is related to 2025.4.0 and new versions were released? I’m just a bit surprised that with this documented issue that many people seem to have that no one is looking into it. Even to say we are working on the issue. I was looking for a vote up button or something to raise it up in the queue.
There has now been 3 releases since this issue was first reported. I just have to think that there is something systematic that has caused the visibility of this issue to not be there.
Yes. My experience is that it was caused by the HA upgrade from 2025.3 to 2025.4 Hope someone can fix this.
As a workaround, as suggested by @Maksys4101, I now play a very short mp3 at the end of my messages and then there is no repetition.
action: media_player.play_media
The problem is still present in HA 2025.4.1.
I face the same issue after updating to 2025.4
Going to close this issue as it has been solved in ESPHome.
I had ESP Muse Luxe and Atom Echo with this issue. The beta for ESPHome is out
2025.6.0b1and resolved this issue for me. No more static crackling sounds and the audio correctly stops playing for both devices.It’s not yet included but it’s been fixed upstream
Issue is in audio-i2c but HAs esphome still using 2.0.7
Hopefully next round
I opened https://github.com/esphome/issues/issues/7077 to investigate audio distortion separately.
Can confirm this behavior on a Muse Proto. I will forward this to the ESPHome team and see what they think.
Please open a new issue for the distorted sound. It may it may not be related to this thread, so should be reported separately.
@p-jean you may feel its experimental but you should open a PR anyway as it will bring attention to a possible solution and get some eyes on the code. just say in the PR that you are not sure if your “doing it right” and help/input is welcome.
I made simpler crutch:
These are all useless crutches. I think it would be better to fix what was working fine.
Switching from arduino to esp-idf works until first restart of the esp speaker. After first restart, the malfunction resumes.
@MartinHjelmare @synesthesiam @jlpouffier Hello everybody, are all the comments above and the many other tickets I linked to this one enough information to acknowledge and fix the bug? Otherwise, how can we help further?
Both the “needs-more-information” label and the “2025.4.0” milestone tag seem out of place at this point (bug still unresolved in 2025.4.3).
Thanks a lot!
The problem is still present in HA core 2025.4.3.
@MartinHjelmare @synesthesiam Hoping you had a chance to take a look, could you acknowledge the issue and confirm it will be resolved in an upcoming HA update? Happy to support in any testing/troubleshooting. Thanks!
I found a temporary solution with the info from the past few days here. But I use my device only for TTS announcements, so it might not work for all.
I have created an automation triggered by the start of playing of my tts speaker with a duration of 10 seconds and then stop the tts speaker.
I can confirm this is also affecting single player/streamer. I did many individual tests (Developer tools -> Action -> TTS with a single ESPHome Player as a target) and issue was happening. Interestingly, playing a Radio does not generate any issue (probably because you have to STOP the stream instead of being stopped when it reaches the end of a length-defined audio stream such as a Chime MP3 or an audio block generated from TTS.
I have a feeling this could be an EOF or End-of-Stream issue, that would explain the glitch at the end, and potentially the reason why the backend deems necessary to re-stream if the end-device does not acknowledges integrity at the end of the audio stream reception.
I have/had the same issue when I upgraded from 2025.3.4 to 2025.4.1.
I have about 8 esphome players around the house. When there was a house wide announcement all of the active lights on my players would stay lit. At random a single player would repeat the last house wide announcement until the next house wide announcement was played. All of the players are esp32 arduino framework players. Restarting ha would then close the channel and the players would go back to idle until the next house wide announcement (I don’t have individual player announcements at the moment so I don’t know if the issue carries over to a single player). The house wide announcements are sent to a media player helper group and not the individual media players.
Restarting the esphome service did not correct the issue. They continued to announce at random. Rebooting the players would also stop the announcement on that rebooted player.
Since this my wife approval factor was dropping quickly I rolled back HA core back to 2025.3.4 and everything became right again. I have an issue with recorder and several tasks that depend on it aren’t running but at least the house isn’t chattering all night. The only thing that was changed is me upgrading to 2025.4.1 and then rolling back the change several hours later to 2025.3.4. This kind of makes me think that something in at least 2025.4.1 has an issue because I can unissue it by putting it back to 2025.3.4
yep same here - this error makes this version of HA pretty unusable for my household.
I am experiencing the same issue since 2025.4.0. When using TTS (With google or piper), the end of the sentence always have the same glitch, then the “Media Player” status stays in “Play” mode, and the sentence repeats after a handful of seconds, to infinite. “Media Player” never goes into “Idle” mode. Cache enabled or not doesn’t change anything. Issue is NOT affecting the Tablet (fullykiosk), only the ESP32 based players (I2S Audio) in my case.
@MacrosorcH I do not use it for music. I primarily use it for TTS audio announcements. Before upgrading to
2025.6.0b1and flashing the speaker it would make a popping sound when audio started and a sort of like fart sound when the audio stopped (like static) and would continually replay the audio every minute or so. Since the upgrade none of that happens anymore.I just played a song on the speaker and it sounded fine and there was no noticeable audio issues.
Sure, here you go: https://gist.github.com/skylord123/ae63ff7cdfa3d7897232478b9e8c7ce4
Thank you, dear friend. I had very high hopes for Home Assistant Core 2025.6 to solve my problem, but as always, after the update the problem remained. Your advice helped, thank you very much again George1422
For everbody that has this issue, i have been struggeling with this for 3 days, but this was the fix for me in Esphome: build_flags: - -I/data/cache/platformio/packages/framework-arduinoespressif32/libraries/WiFi/src - -I/data/cache/platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src lib_deps: - https://github.com/p-jean/ESP32-audioI2S.git#dev i am a bit new to all this ,but hope it helps
I updated to ESPHome 2025.5.2 yesterday, but the issue persists. Currently, the only solution to the problem is rolling back to core version 2025.3.4
This PR should fix it and it was merged a few days ago, but I don’t know what future version of ESPHome will include it.
My experience with the Home Assistant Voice Preview Edition in 2025.5.n, in contrast to 2025.4 in which the device would invariably become unresponsive after successfully issuing a TTS command (just once without repetition) and requiring a power-cycle to resume operation, is that it now behaves unpredictably: sometimes it ignores the TTS command, sometimes it plays a truncated (yet undistorted) version of it, sometimes the device just becomes unresponsive and requires a power-cycle to resume operation. In no cases, however, will it function normally as expected and as it did with 2025.3 or earlier.
I have two another different players, It all make this distortions sinse 2025.5.0
Unfortunately I have to confirm that both ESPHome 2025.5.0 and 2025.5.1 cause distorted sound on my Muse Luxe too: MP3 playback is stuttering all the time, both with arduino and esp-idf (even worse on the latter). I had to rollback to ESPHome 2025.4.2 that doesn’t have this issue. It looks like support for some devices like Muse Luxe is pretty much falling apart these days. 😦
Hi, please see here: https://github.com/esphome/ESP32-audioI2S/issues/18
@heyitsyang I have basically the same thing as Richard and I can compile and execute it without image reversion. TBH I never repowered the esp32 to see if it reverted.
Looking at the atom example Richard pointed to I see this section that was not in my yaml file.
Which tells the compiler to use a different version than “current”. When I did that I stopped getting compile warnings at the beginning of the compile process. When you set those, create a clean build by selecting the 3 dots in the esphome main panel for all of your esphome devices, for this specific speaker.
Also in my yaml I have
Now I connected my esp32 to the HA server and then compiled and transferred the image to the ESP32. If the install and boot goes cleanly you should be able to see in the logs the version of esphome also if the boot fails you will see the boot loop. Initially I had something set in the neopixel that caused my test image to boot loop. But the point is if your image isn’t taking and your esp32 is boot looping you should be able to see why its boot looping with the serial connection to your esphome system.
@RichardA1
use either
tts.speakorassist_satellite.announceboth work absolutely fine with the AE using the latest ready made VA firmwareWhile we can all appreciate the innovative workarounds to reboot, or send a blank audiofile at the end of a TTS, this is more of a band-aid than an actual fix. Has anyone actually figured WHERE is the issue stemming from? It is quite surprising that an issue of that scale with this much awareness is still not solved. According to a few comments it may be tied to the framework some of us are using. I can confirm esp-idf would not work for some of my devices too. Would that mean if there is a merge, we will need to push an ESPHome OTA update to all our devices? Or would this restore original functionality?
The solution for the “TTS repeating” issue on arduino-based media-players is in this PR: https://github.com/esphome/ESP32-audioI2S/pull/19 - hoping somebody will merge it in time for ESPHome 2025.5.0.
As reported by many, switching to the esp-idf framework is simply not an option for some devices like Raspiaudio Muse Luxe, because it rolls back to previous firmware at first reboot.
Espressif updated esphome builder to 2025.4.2. The problem is still present. If I update my player to 2025.4.2, it works fine till first restart. After this first restart player automatically rolls back to 2025.4.0 and our problem comes back too. So this is another issue as I see
@p-jean Many thanks for the patch!
I tried it following your instructions (here: https://github.com/esphome/ESP32-audioI2S/issues/18#issuecomment-2849691184) and can confirm that it seems to work perfectly on my Raspiaudio Muse Luxe.
No more TTS repeating, the media player goes back to idle as expected immediately after TTS playback, and the rest of audio sources seem to work just fine too (web radio, WAV, MP3, Music Assistant… no issues).
Looking forward to having the patch included in an upcoming ESPHome release, hopefully very soon!
As a workaround, is it possible to pull the MP3 TTS response length so that I can us that to stop the player after the audio was played.
Alternately is there a specific way that we are supposed to be pushing TTS to an ESP32?
It doesn’t look we will get any joy on this issue from 2025.5.0 release either.
Master change log: https://rc.home-assistant.io/changelogs/core-2025.5
Beta change log: https://github.com/home-assistant/core/releases
Unless one of these PRs solve the issue (the PRs are not very descriptive on why the change is necessary).
I think this is a mockery
@MacrosorcH i see, for me it started in 2025.4.2 but maybe I didn’t notice before.
Without any intention of being polemical (I love HA), I dare to say that the Open Home Foundation’s Sustainability principle is at stake here. HA 2025.4.x clearly introduced a regression that rendered a good number of DIY speakers unusable. I trust the Core Team is working on resolving it.
Seems this was exactly what I was describing: https://github.com/home-assistant/core/issues/142022#issuecomment-2823042759
First I thought I forgot to reboot. Then i reflashed and it worked. But today it didn’t work any more. Now I confirm that Muse Luxe is back to my previous 2024.8.0 firmware.
You are right 😦
@MacrosorcH for the assist thing try changing the microphone channel left/right I found on some devices I needed to change when changing framework for some reason.
To be honest, asking end users to switch framework from arduino to esp-idf cannot be a solution, unless arduino is deprecated/unsupported - but is it?
As a workaround, I tried the switch to esp-idf on my Raspiaudio Muse Luxe - it fixes TTS repeating but it breaks tons of other things.
For example, I cannot play music from Music Assistant anymore (
[speaker_media_player.pipeline:112] | Media reader encountered an error: ESP_FAIL), and the assist pipeline does not work (it does not recognize the wake word, as if it’s not streaming audio to HA at all, despite CPU % saying otherwise).The focus on VoicePE is welcome (I have a VoicePE too), but it shouldn’t be to the detriment of other devices.
Issue: ESPHome speaker tts repeating
I was able to stop the repeating on my esphome speaker by changing to esp-idf from arduino framework along with the additional changes to speaker and media_player sections as suggested. Thank you to MichaelMKKelly
My new working esphome yaml…
I am also getting this issue, and have been since 2025.4 just like everyone else above. The issue is only on the media_player component, when used in conjunction with the voice assistant (I don’t have any problems with ESP32 devices, which are only a media_player, or Google nest speakers). I have tried arduino, esp-idf, media_player and the fairly new speaker audio media player (combinations of all of these), and all give the freezing of the media player state, and the repetitive TTS.
Dear @jlpouffier - JLo, many thanks for reaching out.
I am currently using and ESP32 based speaker which worked fine but started repeating the mesage from version 2025.4.0 on.
When I use this test script…
…I see in the logging
My observations: From then on, the speaker keeps repeating the sentence every approx 2 minutes. I use piper which was “speaking” qualitatively good, but now there is some “cracking” in the voice.
Workaround: When you send a chime after the voice, then there is no repetition of the sentence.
In this case, when I use this test script…
…I see in the logging
But al least, it stopts repeating the same message.
Core in my ESPHOME code is straight forward:
I attached the whole code
esp32 speaker 1.txt
VPE seems to use use esp-idf framework (https://github.com/esphome/home-assistant-voice-pe/blob/95c83c74f777ddcd573ff21d4137d25f9b621b02/home-assistant-voice.yaml#L53)
In my case, and also confirmed by others, the problem is only reproducible when building a device with arduino framework (and resolved when rebuilding the device to use esp-idf framework). So that may be why you cannot repro with VPE.
Hi Martin, I can’t do a video but the screenshot shows that what you wanted.
Firing the TTS action causes the Player to go in a “playing” state and stay there until next reboot of the device:
In the logs of the raspiaudio device I see this. With every yellow entry, the last sentence gets repeated
Hope that helps.
Is it clear, where the problem is coming from? HA Core? Google TTS? ESPHome? Mediaplayer?
@Maksys4101 Your observation tracks with what I saw/heard. All of my TTS are played via a script that plays an announcement tone (mp3) before the tts is spoken. Thinking back I did not hear the announcement tone (mp3) as part of the repeat, it was only the spoken voice. I could turn off the light (payer would go to idle) if I sent the announcement tone via Developer tools.
Some issue. ESPHome MediaPlayer with simplest configuration. looped announcement after use TTS.
CC @synesthesiam