Hassio and local audio

Yeah, that works. If I add that URL into the configuration, it gives me the exact same error (but localhost swapped with the duckdns URL, obviously).

Sounds like a network issue with the addon. Can you try the actual ip address instead of the duckdns url?

According to this thread it could be an issue with the DNS setup in your internal network.

Otherwise, I have no clue, Iā€™m sorry. Still pretty new to this as well.

Dingle, do all audio files need to be in mp3 format? Is there a specific bit-rate?

I just attempted to play one of the files by calling the service. Tell me if I did it right.

From the services under developer tools:

  • Called domain hassio
  • Service addon_stdin
  • Service Data (tell me if this is correct):

{ "addon" : "local_audio_player", "input" : https://mysite.duckdns.org:8123/local/audio/chime_1.aif" }

Iā€™m starting to get the hang of this JSON syntax. I think this is right as I did receive an error as defined in the run.sh portion of the add-on.

[Info] Read alias: https://smashcrashboing.duckdns.org:8123/local/sounds/chime_1.aif
play WARN alsa: can't encode 0-bit Unknown or not applicable
wget: error getting response: Connection reset by peer
play FAIL formats: can't open input file URL `https://smashcrashboing.duckdns.org:8123/local/sounds/chime_1.aif': AIFF header does not begin with magic word `FORM'
[Error] Playing failed -> 

now this looks exactly like the error that charstring posted, with one exception. The part that reads ā€œAIFF header etc.ā€

When I address the location of the media file via a web browser through https with a local IP or a DuckDNS address, Chrome immediately downloads the audio file to my downloads folder. It does not play itā€¦so at the very least, I know itā€™s accessible. But, the Pi3 isnā€™t playing it.

any ideas?

Iā€™m stuck.

Did you ever figure out how to make this work?

Richardā€¦what exactly is the mopidy add-onā€™s purpose?

My goal is to be able to trigger an audio file stored on the Pi3 with automation. I was doing it when I had HASS installed on my mac through a shell command, but I canā€™t figure it out, even with the add-on that dingle posted below.

The addon is using the SoX library. AIFF support seems to be there but with some limitations.

Switched to testing an MP3 file but no luck. Still isnā€™t playing. Iā€™ve gotten Mopidy up and running on my Pi3, but now I canā€™t get Hass.io to see it as a media player. Just shows unavailable.

So, the media_player platform configuration in configuration.yaml is set according to the MPD instructions, but the media player card on my dashboard shows that the MPD media player is unavailable. Iā€™ve tried every combination of URL from the https to http with duckdns to the internal IP address of the system. While I can access Mopidy and stream music from the media folder on my Pi3, I canā€™t get Hassio to recognize it. Ideas?

Hi all,

Iā€™m new on hass.io and I was wondering if someone find out how to use usb speaker with it.

(in particular I will use a jabra 410).

Please help.
I have tried a lot of options but canā€™t get my usb speaker on the raspberry pi to play a local mp3 file.
I installed the mopidy add-on for Hass.io
Mopidy options:
{
ā€œlocal_scanā€: true,
ā€œoptionsā€: [
{
ā€œnameā€: ā€œlocal/media_dirā€,
ā€œvalueā€: ā€œ/share/mopidy/media/ā€
},
{
ā€œnameā€: ā€œm3u/playlists_dirā€,
ā€œvalueā€: ā€œ/share/mopidy/playlists/ā€
}
]
}

My configuration:
media_player:

  • platform: mpd
    host: 192.168.1.101

My test automations:

Google TTS worked as follows
- service: tts.google_say
data:
message: ā€œGood Morningā€

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

or

      entity_id: media_player.mpd
      media_content_type: playlist
      media_content_id: testlist

The only option that played the mp3 on the speaker was:
In this test the mp3 for this test was in the www directory
media_content_id: https://my-domain.duckdns.org:8123/local/test.mp3

Does it mean I can only play a local mp3 if I have an internet connection? Or can you spot an error in the settings above?
Thanks in advance.

Did you ever figure out how to change the output back to the audio jack?

Did you manage to find out what the media_content_id should be for audio files stored in /share/mopidy/media?

1 Like

yes see https://community.home-assistant.io/t/tts-using-built-in-rpi3-analogue-audio-output-with-hassio/32475/20 Basically this work for me also
{
ā€œentity_idā€: ā€œmedia_player.mpdā€,
ā€œmedia_content_typeā€: ā€œmusicā€,
ā€œmedia_content_idā€: ā€œlocal:track:test.mp3ā€
}

1 Like

Thanks! It worked for me. I can call the service and play the local mp3 files.

However, when I tried to play the mp3 file in a automation.yaml, it doesnā€™t work.

  • action:
    • data:
      entity_id: media_player.mpd
      media_content_id: local:track:test.mp3,
      media_content_type: music
      service: media_player.play_media

I have an error that logged ā€œError doing job: Task exception was never retrievedā€. Any suggestions?

mine looks like this:

action:
..- service: media_player.play_media
....data:
......entity_id: media_player.mpd
......media_content_id: local:track:test.mp3  
......media_content_type: 'music'

Note I have just added the ā€¦ to get some spacing

Thanks!!! All good now. I just needed to restart the mopidy music service. Thanks again for the assistance. :slight_smile:

Hey @arretx did you solve the MPD unavailable issue? I am having the same problem

I have the same issue concerning the unavailable media_player. What i did learn from the logs though is that the mediaplayer is trying to acces the wrong url:

itā€™s trying to reach: https://xxxxx.duckdns.org:8123/api/tts_proxy/etcā€¦

the correct url is:
https://xxxxx.duckdns.org/api/tts_proxy/etcā€¦

I tried everything, but i canā€™t get mopidy to get the url request right, but this is probably the reason it returns ā€˜unavailableā€™.

I am using hass.io. I didnā€™t have a www directory inside config so I created it. However, when I dropped my files into that directory I was unable to retrieve them using a URL. Do I need to do anything special when using duckdns?

solved: I didnā€™t realize you have to restart ha after creating the folder.

Here is how I solved to play MP3/WAV files using mopidy on a HASS.IO system:

https://www.amalytix.com/en/home-assistant-with-conbee-ii-deconz-xiaomi-aqara-and-hass-io-from-scratch/#play-audio-1