TTS using built in RPi3 analogue audio output with Hassio?

Thanks a lot, it also worked for me :grinning:

Thanks, this notation also worked for me to play mp3s, I looked at the docs for media_player.play_media and I see that the format is component dependent, so I’d really like to know where you found that.

I’m adding some tips because it took me long enough to stumble through and I’d like to save the next soul.

I did not have a NAT loopback issue, my config is still:

  http:           
    base_url: xxxxx.duckdns.org

I have HA using the default port internally (8123) but forwarded to port 443 in my router on it’s way to the outside world. I did not confirm (but it is my current hunch) that Mopidy doesn’t actually pick up server_port, and requires the port tacked on to the end of the base_url. This part gets rather confusing, because after going through the router the external and internal ports are not necessarily the same number.

Look for errors in Hassio>Mopidy>Logs (hit Refresh).
If your tts is not playing there will be some error here that might help narrow it down.
You can see what URI mopidy is trying to access, copy that and paste it into your browser for a quick test/troubleshooting.

Most critically: it appears that changes made to the file system (like your /share/mopidy/media) and Home Assistant variables (base_url, maybe server_port) do not take effect in Mopidy until you restart the add-on. This is why I cannot say for sure how it picks up the port number.

So as painfully slow as it seems, don’t rule out restarting HA and then restarting Mopidy to be sure any changes were actually grabbed.

Also, it seems this startion works as music and not playlist, which I thought was odd.

  {
    "entity_id": "media_player.mpd",
    "media_content_type": "music",
    "media_content_id": "http://www.primcast.com/asx/listen265935.m3u"
  }

Finally, thanks to everyone in this thread, wouldn’t have had tts working at all without ya!

1 Like

heya, i’ve followed the instructions, Mopidy is working fine, but my mediaplayer.MPD is unavailable.

if i open the Web Ui to the modify server and start streaming a radiostation it works fine over my RPI2 audio jack.

however, any media i try to play through mediaplayer.MPD fails (also tts) even tho the Mopedy logs don’t show up any errors.

any idea’s as to what’s wrong? i’ve tried the following hosts with the same results:

https://192.168.x.xxx:8123
https://xxx.duckdns.org
https://xxx.duckdns.org:8123

Have you tried looking at the HA logs? Some errors (like file not found) end up there instead of making it to the mopidy logs.

Also, I saw it mentioned that the https:// was not necessary in base_url, I’m not sure if that’s having an effect.

The linked github issue thread TTS.google_say not working with HTTPS is a pretty good place to look for some more answers.

in the Hass.io logs aren’t any errors either after calling the tts service.

i’ve tried the host options without https://, also without succes:

host: xxxxx.duckdns.org:8123
host: xxxxx.duckdns.org
host: 192.168.x.xxx:8123
host: 192.168.x.xxx

the weird thing is that through the Web UI of Mopify plays my radiostation stream just fine… i’ve tried calling the tts service both while playing the radio and without the radio… it all has no effect

Edit: i just received an error while trying tts:

Error doing job: Task exception was never retrieved
21:37 components/media_player/mpd.py (ERROR)

it’s the first time it produces an error though

Just to confirm, when you say host you mean you’re putting the URL in http: or media_player:?

# configuration.yaml
http:
  base_url: xxx.duckdns.org:ppp # for me ppp is omitted because my outside port is 443
                                # If you're using something other than 443 as your 
                                # outside world port then put it here
  server_port: xxxx # The internal port that Hass.io is available on
                    # (defaults to 8123, and likely ignored by Mopidy )

media_player:
  platform:mpd
  host: 192.168.x.xxx # This is where you are able to connect to the Web UI of Mopidy
                      # Test it by going to 192.168.x.xxx:6680 
                      # (unless you changed the web UI ports)

tts:
  - platform: google

I had to create ./mopidy/media in /share, I did this in ssh, maybe samba would have worked too?
mopidy Options:

{
  "local_scan": true,
  "options": [
    {
      "name": "local/media_dir",
      "value": "/share/mopidy/media" 
    }
  ]
}

Also something that might be useful, I noticed that the mpd card in the Home view has a simple way to test tts. (Click the three dots for more options on a card).

I’m surprised that none of the logs hold anything useful for you. I wasn’t always sure what they were trying to tell me, but there was usually something there.

1 Like
  • to confirm: it’s the host of the media_player i was referring to.

  • accessing the Web UI of Mopify works perfect

  • i created the /media and /share folder manually, Mopify doesn’t give me any errors, it says it’s working

as you see in the picture the media_player.MPD is greyed out and give status: unavailable, so whatever service i call on the media_player does nothing

Edit 1: this morning i rechecked my mopidy log and sew that my errors from yesterday are coming in, don’t know why it took so long, when i went to bed there was nothing in the log… anyhow, here it is:

INFO     New MPD connection from [::ffff:192.168.1.11]:36670
WARNING  Download of u'https://xxxxxxxxxx.duckdns.org:8123/api/tts_proxy/977453de759b12dca458f52e72b7bee1df7dbd29_en_-_google.mp3' failed due to connection timeout after 4.995s
INFO     Unwrapping stream from URI (https://xxxxxxxxxx.duckdns.org:8123/api/tts_proxy/977453de759b12dca458f52e72b7bee1df7dbd29_en_-_google.mp3) failed: error downloading URI https://xxxxxxxxxx.duckdns.org:8123/api/tts_proxy/977453de759b12dca458f52e72b7bee1df7dbd29_en_-_google.mp3
WARNING  Problem looking up https://xxxxxxxxxx.duckdns.org:8123/api/tts_proxy/977453de759b12dca458f52e72b7bee1df7dbd29_en_-_google.mp3
INFO     New MPD connection from [::ffff:192.168.1.11]:36712

Edit 2: i tested this url in my chrome browser and it gives an error404. If i take the portnumber out of the url: https://xxxx.duckdns.org/api/tts_proxy/etc. , then it loads in my chrome browser.
What i don’t understand is that i never ask to redirect to that port… here’s my setup:

http:
  base_url: https://xxx.duckdns.org

media_player:
  platform: pmd
  host: xxx.duckdns.org

Strange that the logging took so long.
If that’s the URL it’s generating I’d give restarting mopidy another shot. You should see logs related to the startup:

INFO     Starting Mopidy 2.1.0
INFO     Loading config from builtin defaults
INFO     Loading config from /var/lib/mopidy/.config/mopidy/mopidy.conf
INFO     Loading config from command line options
INFO     Creating dir /root/.config/mopidy
INFO     Enabled extensions: mpd, http, file, stream, m3u, softwaremixer, moped, local, local-sqlite
INFO     Disabled extensions: spotify, gmusic
WARNING  Found gmusic configuration errors, the extension has been automatically disabled:
...
...
etc

This is the complete log, i see nothing out of the ordinary

INFO Starting Mopidy 2.1.0
INFO Loading config from builtin defaults
INFO Loading config from /var/lib/mopidy/.config/mopidy/mopidy.conf
INFO Loading config from command line options
INFO Creating dir /root/.config/mopidy
INFO Enabled extensions: mpd, http, file, stream, m3u, softwaremixer, moped, local, local-sqlite
INFO Disabled extensions: spotify, gmusic
WARNING Found gmusic configuration errors, the extension has been automatically disabled:
WARNING gmusic/username must be set.
WARNING gmusic/password must be set.
WARNING Found spotify configuration errors, the extension has been automatically disabled:
WARNING spotify/username must be set.
WARNING spotify/client_secret must be set.
WARNING spotify/password must be set.
WARNING spotify/client_id must be set.
WARNING Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO Found 1 files in media_dir.
INFO Checking 0 tracks from library.
INFO Removing 0 missing tracks.
INFO Found 1 tracks which need to be updated.
INFO Scanning…
WARNING Failed local:track:test.mp3: Timeout after 1000ms
INFO Scanned 1 of 1 files in 1s.
INFO Done scanning.
INFO Starting Mopidy 2.1.0
INFO Loading config from builtin defaults
INFO Loading config from /var/lib/mopidy/.config/mopidy/mopidy.conf
INFO Loading config from command line options
INFO Enabled extensions: mpd, http, file, stream, m3u, softwaremixer, moped, local, local-sqlite
INFO Disabled extensions: spotify, gmusic
WARNING Found gmusic configuration errors, the extension has been automatically disabled:
WARNING gmusic/username must be set.
WARNING gmusic/password must be set.
WARNING Found spotify configuration errors, the extension has been automatically disabled:
WARNING spotify/username must be set.
WARNING spotify/client_secret must be set.
WARNING spotify/password must be set.
WARNING spotify/client_id must be set.
WARNING Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO Starting Mopidy mixer: SoftwareMixer
INFO Starting Mopidy audio
INFO Starting Mopidy backends: StreamBackend, M3UBackend, FileBackend, LocalBackend
INFO Audio output set to “autoaudiosink”
INFO Loaded 0 local tracks using sqlite
INFO Starting Mopidy core
INFO Starting Mopidy frontends: MpdFrontend, HttpFrontend
INFO MPD server running at [::ffff:0.0.0.0]:6600
INFO HTTP server running at [::ffff:0.0.0.0]:6680
INFO Starting GLib mainloop

Anyone have any luck with the volume in hassio? with the volume down on the physical speaker it is to quiet and with the speaker turned up there is to much white noise.

1 Like

i got it to work, but the quality is really poor. i hope that this will offer a solution eventually:

1 Like

Hi Lentron, I have the same issue that you (MPD status: unavailable), how you fix it?

In my configuration yaml I have:

media_player:
- platform: mpd
host: 192.168.0.105

Hi Lentron

How id you get it to work … i have the same issue as u had. Mopidy tells me that the download has timed out!

kind regards
c_bb

Is there any chance anybody could help me use either TTS or mopidy notifications for example a light or switch is turned on? ie; Your Tv is On, or your light is off.

im running Hassio im very new to all of this and have been trying this for days.

i was successful getting AH to call the service and announce what i placed in

{
“entity_id”:“media_player.mpd”,
“message”:“Hello Brian, how are you today?”
}

in the post near the top of this thread. So i know it works but how do i get it to automatically speak upon actions?

im starting to feel like ill never get this down :frowning:

Did someone already found a solution for the problem with the noise?

I tried the media_player.volume_mute thing, but it doesn’t solve the white noise problem.

if MPD states unavailable is Hassio… In configuration.yaml change port to 6600.
It uses the server port of modipy and not the http port. :slight_smile:

that solved it for me

1 Like

mpd using usb or Bluetooth … searched everywhere does not seem a solution exits apart from audio jack with a lot of white noise since the volume cannot be controlled.

So it is posible to use mpd in Hassio with jack 3.5 mm speaker or with a bluethoot speaker?

Did you find a solution for the white noise?

1 Like

I can´t even install the addon…I hit “install” but nothing happens, not an error, nor a log.
I´m on HassIO 0.77.2…any ideas?