#infinite loop with tts.speak on esphome ?

1 messages ยท Page 1 of 1 (latest)

wet scroll
#

Hi, since yesterday ( after upgrade to 2025.4 and/or esphome... ) every minute, my media player is repeating the latest tts.speak.
here is a small script :

sequence:
  - action: tts.speak
    target:
      entity_id: tts.piper
    data:
      cache: false
      media_player_entity_id: media_player.esp32_s3_media_player
      message: Hello, This is a text!
      language: en_US
      options:
        voice: en_US-bryce-medium
alias: test locat TTS using piper EN
description: ""

What i have found:

  • my media player remains in the state playing
  • one minute later, somehow HA is reprocessing => and the media player is "repeating" the text
  • I can "break the infinite" loop by playing a regular mp3 => at the end the media player is in state idle)

If i try to reproduce this using my Nvidia shiled, everything is fine. So maybe it is more related to esphome. I can't tell as i don't have any other "media_player"....
I havn't found anything in the log ATM
Regards

wet scroll
#

I activated the log of piper, and my text is only processed 1 time.

wet scroll
#

I also disconnected the network cable of HA to see,... but esp device stopped to play as expected.
I havn't found anything special in the logs....
My Esp device was "Idle" after reconnection...
=> My ESP is not playing every minute on it's owm. it's coming from HA.

#

enabling/disbling the cache of tts.speek don't change anything

bronze shadow
wet scroll
#

It's and ESP32 S3

#

with media-player enabled in the yaml

#

I think home assistant is expecting the device to go to "Idle" and actually it is in "pause"

bronze shadow
#

so its custom?

wet scroll
#

by custom , yes, it is flashed using esphome builder ๐Ÿ˜‰

bronze shadow
wet scroll
#

It's a plain "nake#" esp32 that i flashed to have temperature and be able to send audio notifications

bronze shadow
#

can you share your esphome yaml?

wet scroll
#

I was just adding some extra logs . ( not tested yet)

bronze shadow
#

is it just a single speaker your outputting to?

wet scroll
#

yes

bronze shadow
#

try replacing your i2s_audio and media_player sections with this:

  - id: i2s_audio_bus
    i2s_lrclk_pin: GPIO11
    i2s_bclk_pin: GPIO12
    
speaker:
  - platform: i2s_audio
    id: output_speaker
    i2s_dout_pin: GPIO13
    dac_type: external
    bits_per_sample: 32bit
    channel: right
    buffer_duration: 60ms
    
media_player:
  - platform: speaker
    name: None
    id: output_media_player
    announcement_pipeline:
      speaker: output_speaker
      format: WAV
    codec_support_enabled: false
    buffer_size: 6000
    on_pause:
      - logger.log: "Playback paused!"
    on_idle:
      - logger.log: "Playback finished!"```
#

can see if that builds and works

wet scroll
#

nearly ๐Ÿ™‚

media_player.speaker: [source /config/esphome/esp32-s3.yaml:214]
  
  This feature is only available with frameworks ['esp-idf'].
  platform: speaker
#

i changed the platform and no errors anymore

bronze shadow
#

yeah, if your other stuff builds on esp-idf then switch to that ๐Ÿ™‚

wet scroll
#

i have "cleaned", and started the "compile"

#

compiled and flashed. ๐Ÿ™‚
I have to adapt my test case i think ๐Ÿ˜‰

#

IT WORKS !!!!!

#

state is correct and it's not "repeating" every minute

bronze shadow
#

and we have a winner ๐Ÿ™‚

wet scroll
#

YOU are the winner ๐Ÿ˜‰

#

I will just do some cleaning/renaming .... and try to move everything to "esp-idf" ....

bronze shadow
#

yeah can adapt it to your liking but you have a working speaker/media_player configuration now in any case

#

good luck to finishing your build ๐Ÿ™‚

wet scroll
#

Again, thank-you! U saved me.
I was getting crazy, and no way to restore as the DB layout had changed with the new version. ๐Ÿ˜‰