Skip to content

on_tts_stream_end for the Media Player Component #3148

Description

@RichardA1

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.
home-assistant/core#142022
esphome/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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions