#How to play media from a network storage (NAS) using NFS

1 messages · Page 1 of 1 (latest)

mystic tusk
#

I've been breaking my head over this for a few weeks now. Reading https://www.home-assistant.io/integrations/media_source/ does not really help as it does not properly explain what the interaction of these mapped paths with HAOS' network storage settings are.

Basically, I want to play a media file that is stored on a NFS share served by a NAS in my network.

action: media_player.play_media
data:
  media_content_id: media_source://media_source/media/music/ambients/recorded-rain.mp3
  media_content_type: music
target:
  entity_id: media_player.home_assistant_voice_0971ee_media_player

The file is a regular MP3, nothing special. However I cannot for the life of me figure out how to access the path that the file lives on.

The file itself is visible in HA in the /media path:

➜  ~ ls /media/music/ambients 
ocean.mp3            recorded-rain.mp3

So I would think that I would have to refer to that path when trying to play my media, but while I can use the above YAML in the actions tab of Developer Tools and run it, there's nothing happening on the actual media player device. HA also doesn't seem to register that something should be playing there.

Lifting this from the documentation page:

To play media from a media source via an action, use the uri scheme media-source://media_source/<media_dir>/<path>. Default media_dir is local.

I do not know how to interpret this. I have added a new key under homeassistant.media_dirs with a new value for /media which seems a bit redundant, but I was hoping that explicitly defining it would work: it doesn't.

Do I need the homeassistant.media_dirs key at all to get this to work? And how do I figure out the mapping between where the file lives on my network and how to get HA to play that on some media player?

Home Assistant

Instructions on how to access your media with Home Assistant.

mystic tartan
#
action: media_player.play_media
data:
  media_content_id: media_source://media_source/local/music/ambients/recorded-rain.mp3
  media_content_type: music
target:
  entity_id: media_player.home_assistant_voice_0971ee_media_player
#

Try that instead

#

The "media" folder is referred to as "local" under default settings

mystic tusk
#

I did try that already and that didn't work either. I removed the media_dirs entry in yaml but even after a reload this code does not work to play a sound out of the media device

fervent cave
#

What works for me is creating a folder in the www directory - in my case called casper-sound and place mp3's in that folder. Then using the code shown above, but instead of the media_content_id line shown, I use media_content_id: '/local/casper-sound/soundfile.mp3'

mystic tusk
#

yes, I could use the already exposed www folder, but this is not the only sound I want to play, and we're talking several hundred gigabytes of music and sounds. I don't want to store all that locally on the HAOS VM when I have a perfectly good NAS it can sit on

mystic tusk
#

Is there a way to debug this?

fleet briar
#

Maybe with the terminal. There you can see if you can reach the file.

frozen storm
#

if you're familiar enough with linux, you can do as I do, just mount the NAS folder under the HA media folder.

mystic tusk
#

I can easily reach the file in the terminal, so that's not an issue. I can also play the file on the Voice PE through the media browser, so it can read and access the file