I’m trying to figure out how to get text to speech to use the built in 1/8" audio output of the raspberry pi 3 using HASSIO. Ultimately, I want to send sensor alerts, and alarm notifications through this analogue audio output.
I’ve consolidated these instructions based on my needs, to get generated tts audio out of the local raspberry pi 3 audio output using hass.io. Many thanks to this thread, and specifically @richardgewy.
Instructions
Install the “modipy” addon using the /hassio/store Add-On Repositories section, this might take a bit, be patient
Start the service
Add the configuration below to your configuration.yaml file and SAVE
# Mopidy addon for hass.io
media_player:
platform: mpd
host: YOUR.HOST.IP
Thiis worked exactly as you say. I note however that after the first audio that is played, the speakers emit a white noise (as though the volume is turned up 100%). Do you now how to adjust the volume for the RPi3 and reset it to default once audio has been played?
I install mopidy as described and it’s working. I can open web-client and play mp3 stored in share/mopidy map. But I have a problem with google tts. When i call service with message i get error in mopidy log and no sound from speaker:
WARNING Download of u'https://xxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3' failed: HTTPSConnectionPool(host='xxxx.duckdns.org', port=8123): Max retries exceeded with url: /api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x74a25ff0>: Failed to establish a new connection: [Errno 111] Connection refused',))
INFO Unwrapping stream from URI (https://xxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3) failed: error downloading URI https://xxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3
WARNING Problem looking up https://xxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3
WARNING Download of 'https://xxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3' failed: HTTPSConnectionPool(host='nightbodom.duckdns.org', port=8123): Max retries exceeded with url: /api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x71292ad0>: Failed to establish a new connection: [Errno 111] Connection refused',))
INFO Unwrapping stream from URI (https://xxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3) failed: error downloading URI https://xxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3
WARNING Track is not playable: https://xxxxx.duckdns.org:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-uk_-_google.mp3
I read about problems TTS have with let’s encript and duckdns… I try with different base_URL options, but no success…
I have the opposite problem. Done the Modipy installation as described above. The TTS is working on my local USB speakers but I battle with playing a local mp3 file.
I load an mp3 file in the directory /share/mopidy/media/
And a playlist file with one of the mp3’s in /share/mopidy/playlists/
Tried a couple of options but no sound on the usb speaker
entity_id: media_player.mpd
media_content_type: music
media_content_id: /share/mopidy/media/test.mp3
I disable let’s encript, duckdns, etc. but still the same problem… mopidy is working through web-client but tts just don’t work.
I try to play mp3 with service in HA but it generate error:
Error doing job: Task exception was never retrieved
20:57 components/media_player/mpd.py (ERROR)
Ok I finaly found solution. It was problem with base_url and NAT loopback. My router doesn’t support NAT loopback so it was problem when mopidy try to play tts from xxxx.duckdns.org:8123…
I don’t know how to deal with NAT loopback problem (any sugestions?) so I try somethig else:
I change base_url to hassio_IP:8123 and mopidy has no problem playing tts.
Well… a don’t know if changing base_URL to hassio_IP:8123 instead of xxx.duckdns.org:8123 will affect any other devices in HA but for now it looks good?!?
Another thing is playing mp3 in services…
This also didn’t work for me… produce some errors because it couldn’t find file
This works for me:
{
“entity_id”: “media_player.mpd”,
“media_content_type”: “music”,
“media_content_id”: “local:track:test.mp3”
}