oh, really? I didn’t know that. Thank you so much
mopidy is playing fine through my RPI audio jack, but I can’t figure out how to change the output devices. I can see my USB stick:
➜ / hassio host hardware
"audio": {
"0": {
"name": "bcm2835 - bcm2835 ALSA",
"type": "ALSA",
"devices": {
"0": "digital audio playback",
"1": "digital audio playback"
}
},
"1": {
"name": "USB-Audio - USB PnP Sound Device",
"type": "Device",
"devices": {
"0": "digital audio capture"
}
}
}
}
And looking at the mpd.conf.example it seems like I should be able to set it in the options using (in the options panel in hass):
"options": [
{
"name": "audio_output/type",
"value": "alsa"
},
{
"name": "audio_output/device",
"value": "hw:0,1"
}
]
Tried several things for the value of device and can’t get it to work.
Hey there, thanks so much for this! Been meaning to figure out how to play a locally hosted audio file for awhile, and specifically how to do it over local audio output. This is perfect … EXCEPT I can’t get it to work.
I’ve installed the addon in an “audio_player” folder under /addons/. I’ve installed the local addon and that all seems to be working. When I run your test under services, I get the following error in the log for the addon:
[Info] Read alias: http://localhost:8123/local/chime.mp3
play WARN alsa: can't encode 0-bit Unknown or not applicable
wget: error getting response: Invalid argument
play FAIL formats: can't open input file URL `http://localhost:8123/local/chime.mp3':
[Error] Playing failed ->
The chime file is in the www folder inside config. I’m using duckdns and LetsEncrypt, so not sure if there’s some formatting I need for that. Any ideas?
Are you able to access that chime file through your browser? (replace localhost with the ip address of course)
And does it work when you refer to that ip address from the configuration?
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.
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?
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”
}
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
- data:
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.