esphome / esphome/feature-requests

on_tts_stream_end for the Media Player Component

Open
#3,148 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**
When using TTS with a the ESPHome Media Player and Voice Assistant components, there is no way to use on_tts_stream_end unless you link the Media Player through the Speaker component and that results in other issues. If on_tts_stream_end did not require Speaker, that could fix the current issue with TTS looping with Media Player after the 2025.5 update.

**Please describe your use case for this integration and alternatives you've tried:**
I use the TTS to push instructions like medication reminders through an ESP32 smart speaker like the M5 Atom Echo. This has worked for that past year without issue by letting me create an automation to push TTS to the ESPHome Media Player. The Announcement would play and then the Media Player would return to idle when finished. After the 2025.5 update, the media player just keeps playing on an endless loop.
https://github.com/home-assistant/core/issues/142022
https://github.com/esphome/issues/issues/6911

If the on_tts_stream_end, and on_tts_stream_start options were available with media_player and not just speaker, we could simply add something like:

```python
i2s_audio:
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO26

microphone:
- platform: i2s_audio
id: mic
i2s_din_pin: GPIO4 #SD
adc_type: external
pdm: false

media_player:
- platform: i2s_audio
i2s_dout_pin: GPIO27
name: "Smart Speaker"
id: media_out
dac_type: external
disabled_by_default: false

voice_assistant:
microphone: mic
media_player: media_out
noise_suppression_level: 1
auto_gain: 10dBFS
volume_multiplier: 2.0
on_tts_end:
- media_player.play_media: !lambda return x;
on_tts_stream_end:
- media_player.stop
```
**Additional context**
If this feature is added, it will allow people use _assist_satellite.announce_ as well as _tts.speak_ without having the message in a loop.

Alternately allowing TTS to be pushed to an ESPHome Speaker just like it can be pushed to a Media Player, could solve this issue, but I still think that the on_tts_stream_end, and on_tts_stream_start options for Media Player work help with more use cases.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.