TTS to mpd media player

action: tts.speak
target:
  entity_id: tts.piper
data:
  cache: true
  media_player_entity_id: media_player.living_room_satellite
  message: this is a test

I have searched days for this and I’m pretty resourceful but can’t find anything helpful! I just can’t get text sent to my MPD integration media player. The service acts like it runs successfully but no audio is output and it always results with this error in the log:

Retrieving artwork through readpicture command failed: [5@0] {readpicture} CURL failed: Failed to connect to 172.18.0.2 port 8123 after 3080 ms: Couldn’t connect to server.

Hi Jennifer, AFAIK this should work. (unless it’s something related to MPD)
Can you test it with another mediaplayer, maybe from the Developer tools → actions?

EDIT: maybe try another TTS service as well

Have you tried something like:

        action: media_player.play_media
        target:
          entity_id:
            - media_player.living_room_satellite
        data:
          media_content_id: |
            media-source://tts/piper?message="this is a test"
          media_content_type: music

I’ll try this. Thank you! I’ve never seen in all of my research this “media-source://tts/piper?message=”. I wish I hadn’t screwed up everything today trying to “start over” again. Nothing works now. I will post here again after I try it.

I have tested other TTS service and I want to test with a different media_player that I can send TTS to but I don’t have one. MPD should work but for me it doesn’t. It seems like it’s trying to get album art but I don’t see any way to turn that off in mpd.conf.

I’m using LMS and SqueezeLite-X on my desktop (windows) which is also a mediaplayer in HA.
Don’t know if you can use/test that with MPD.

I use it all the time with Sonos speakers, but I can’t remember where it came from I’m afraid. (possibly this post, which is a discussion of how to increase volume in TTS messages).

A full working script (just tried it) would be:

sequence:
  - target:
      entity_id: media_player.living_room
    data:
      announce: true
      media_content_id: >
        media-source://tts/picotts?message="This is a test of
        pico tts................................"
      media_content_type: music
      extra:
        volume: 50
    action: media_player.play_media

You replace picotts with the name of your TTS engine. Mostly I use it with Amazon Polly, and Pico is a local fallback if the internet is down. (The line of dots is a workaround for an annoying pico bug that nobody seems to want to fix).

Thanks for the suggestions here!

So I noticed in the mpd logs that the tts>mp3 being sent over to mpd had been given a wrong address (the home assistant container ip). It was so hard for me to figure out why this happened. I hope someone can find this solution if I’m not the only one.

There is a file /config/.storage/core.config where I had to change this line:

"internal_url": null,

to:

"internal_url": "http://myhomeassistantip:8123",

Now it works. Ugh!!!

1 Like