Setting TTS on RPI 4b in jack out

Gents,
Im struglling with playing TTS over the jack out of the RPI 4. First I started by installing VLC+VLC telnet. It worked somehow.... When I tried execute script sometimes worked, sometimes partly played, sometimes not at all. In the way that I had to run script 10 times to have one notification played. Thats not what I was looking for. Then I moved and installed MPD player. The player works, Im able to run radio stream without issue. But I could`n find entity “media_player.mpd” so I couldnt use it for TTS. In the logs I can find error:

Logger: homeassistant.components.media_player
Source: helpers/entity_platform.py:239
integration: Media player (documentation, issues)
First occurred: 5:00:02 PM (1 occurrences)
Last logged: 5:00:02 PM
The mpd platform for the media_player integration does not support platform setup. Please remove it from your config.

in my configuration.yaml :
media_player:
platform: mpd
host: 192.168.1.48 # the IP for the raspberry pi running HA and from which I am trying to output sound on the 3.5mm audio port
scan_interval: 1

Could anyone knows how I can acomplish TTS via jackOut of the RPI4?

My system:
Home Assistant

  • Core2025.2.5
  • Supervisor2025.03.2
  • Operating System14.2
  • Frontend20250221.0
1 Like

So maybe another question. Is there anyone who is able to use RPI 4 and similar system version to use TTS over RPI`s 4 speaker?

I`ve installed Wyoming, as I understand with Piper. But still I can only choose entity vlc , when I run it it shows ok but no sound from the speaker.

I`dont understand why I cannot add RPI to media_player entity, why it just not showing in “Media player entity” box?

Hey, (sorry to disappoint you) similar problem here…I have RPi5 with USB sound card and ‘local microphone’ addon installed. Assist through sound card somehow works (waiting for ground isolator). For me as linux veteran whole HASS voice model seems complex and hard to troubleshoot (so many diff. parts >:/ ) One command in bash and it takes ages to resolve on HASS OS RPi install. Thinking about going Raspian way with HASS on top of that. That way i would have much more control on platform and i could say anything from speaker in matter of one liner executed from HASS

Thanks for sharing, at least I know that other people have this problem as well. Wondering still if some of us were able to sort it out…

I`ve found in the logs error:“Can’t update PulseAudio data: Failed to connect to pulseaudio server”

Is this could be related to my issue?

Still looking for an audio and TTS solution for the jack 3.5 of Pi4 ?

I can explain the solution i’m using with none of the above problems you talking about ! And yes i know VLC is just bul@#&t

You will have to install:
CHIME TTS (HACS): GitHub - nimroddolev/chime_tts: A custom Home Assistant integration to play combined audio files before and/or after text-to-speech (TTS) messages
Google TTS or another one (must be set in CHIME TTS).
And NOTIFIER ADD-ON by GUIDO: GitHub - guido-syseng/Hassio-Addons
All audio files have to be in /config/www/audio/ wich is equal to /local/
the “Audio Out” setting in Notifier : “Built-in audio stereo” because “default” can sometime causes problem: no audio send to jack 3.5 !

Explanation:
chime_tts.say_url creates an mp3 based on the text message you’ll pass to it.
This mp3 file will be saved in /local/audio/ (/config/www/audio/)
The filename of this mp3 is retrieved by extracting the filename part of the url that the chime_tts.say_url service return as a service response !
Notifier Add-on is then used to read the mp3 file to rpi 4 built-in audio jack.
All these scripts are “queued” so no message can be lost.

script_audio:
  sequence:
    - delay:
        milliseconds: 100
    #----------------------------------------
    - service: hassio.addon_stdin
      continue_on_error: true
      data_template:
        addon: 3ebf62bd_notifier
        input:
          volume: 100
          # wav et mp3 files in \config\www\audio
          music: audio/"{{ audiofile }}"
    #----------------------------------------
  mode: queued

Example of call for playing a sound:

    #
    - service: script.turn_on
      target:
        entity_id: script.script_audio
      data:
        variables:
          audiofile: your_file.wav
    #

Allways call the same script (script_audio) for any audio so you’ll avoid playback conflict thanks to the queued mode !

The TTS section below that also use the above script for the playback on pi4 jack 3.5

chime_tts_say_url_and_play:
  variables:
    temp: ""
  sequence:
  - action: chime_tts.say_url
    data:
      # chime_path: /config/www/audio/bell.wav
      message: "{{ message }}"
      tts_platform: google_translate
      language: "fr-fr"
    response_variable: chime_tts_say_url_response
  #----------------------------------------
  - if: "{{ chime_tts_say_url_response['success'] == true }}"
    then:
      - service: input_text.set_value
        target:
          entity_id: input_text.chime_tts_say_url_mp3_filename
        data:
          value: >
            {% set temp = chime_tts_say_url_response['url'] %}
            {{ (temp.split("audio/")[1]) }}
      - service: script.turn_on
        target:
          entity_id: script.script_audio
        data:
          variables:
            audiofile: "{{ states('input_text.chime_tts_say_url_mp3_filename') }}"
    else:
      # Warn if above return a error (success=false)
      #----------------------------------------
      - service: script.turn_on
        target:
          entity_id: script.script_audio
        data:
          variables:
            audiofile: your_error_warning_sound_file.wav
  #
  mode: queued

Don’t forget to define in your input_text definitions:
input_text.chime_tts_say_url_mp3_filename

Example of calling the TTS script above:

    - service: script.turn_on
      target:
        entity_id: script.chime_tts_say_url_and_play
      data:
        variables:
          message: This is an example - ceci est un exemple !

Do not forget to change language: “fr-fr” to what your langage is :wink:
You can easely customize the annoucement, read the CHIME TTS documentation.