Point media_dirs: at NAS share?

Hey @bjornb the first time I mounted it, I had a similar experience, what was critical was to mount it as /media that is the default location for the media integration to look for files. On my system /media is empty by default

Also see this post for an example:

Been reading through with great interest as this is exactly what I’m trying to do.
Am I right in thinking this method means we don’t have to do anything with portainers and it can be done straight into config.yaml?
I’m running HA Blue so don’t want to complicate things if I can at all avoid it.
So far I’ve got;
`shell_command:
mount_media: mount -v -t cifs -o vers=1.0,noserverino,username=guest,pass=,domain=WORKGROUP,sec=ntlm //192.168.9.110/mnt/1116dbf2-b23e-4289-b727-0ce84a2dd1da/Music /media

homeassistant:
media_dirs:
media: /media`
But aren’t seeing anything in the media folder after several attempts & restarts.

In answer to your first question then yes, assuming all dependencies are installed it should just work.

Can you ssh/putty into your HA blue box to get into a command prompt?
https://www.putty.org/
You should be able to test and see if it works, run the mount command and then use the ‘ls’ command to view the folder.

Alternatively, assuming HA Blue has portainer installed, you can use the exec console and test the commands by attaching to the home assistant container
image

Thanks Markss, not tried ssh but I can access no problem with the samba client on my phone.
I’ve installed the samba add on obviously but nothing else, which other dependencies are you referring to, do I need ssh?
Edit, just remembered ssh is pre-installed on HA Blue but is not on my media server. I’ll install later & see how I go on.

Not sure if it can be called a step forward but I installed SSH server & can access the directory where my music is stored from another device on my Lan but still no result with HA being able to do so. I do however now get this error log.
Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/init.py:113
Integration: Shell Command (documentation, issues)
First occurred: 9:29:52 (3 occurrences)
Last logged: 10:46:25

Error running command: mount -v -t cifs -o vers=1.0,noserverino,username=xxxxx,pass=xxxxx,domain=WORKGROUP,sec=ntlm //192.168.9.110/mnt/1116dbf2-b23e-4289-b727-0ce84a2dd1da/Music /media, return code: 111
NoneType: None

Just in case somebody missed it:

1 Like

John, did you ever figure out a solution using HA Blue?

Hey Dax, no didn’t get any further with it.
Seems like it should work and I’m sure it’s just my inexperience & lack of knowledge.

Thanks to all the posts in this thread I’ve been able to mount my NAS from within HA (instead of Ubuntu host) using the SSH & Web Terminal add-on to run:

mount -v -t cifs -o vers=1.0,noserverino,username="user",pass="pass",domain=WORKGROUP,iocharset=utf8,dir_mode=0777,file_mode=0666,sec=ntlm //192.168.1.x/share/media /media/nas

Although the mounted drive files can be see from the command line and even show up in the Media Browser, the /media/nas folder is empty within Plex. Same if I mount it to /share/nas which is a location that works if I mount via the host system (Ubuntu) /etc/fstab.

Has anyone got this working with Plex too?

I have been trying on and off with HassOS but I get the same as you or that it does not exist in the Fstab.

The problem is that i can easily mount something using the SSH webterminal but home assistant itself runs in a container of some sort and so the mount will work on a linux level but not in home assistant itself. You will have to mount a drive in the home assistant container itself to get it to work. But i havent been succesfull so far on doing that.

I tried a shellcommand but keep getting different errors. I guess in the home assistant container i dont have the rights to mount something.

I keep getting “return code: 127” when using sudo in front and 255 without sudo. It just doesnt work.

Please vote for my feature request in this functionality for the media browser:

1 Like

Bigger FR here

2 Likes

100% agree. “HA is by nerds for nerds” , where it should be “HA is by nerds for NOOBS”

Hello @insajd

i have install portainer and create /mnt/nvrubuntu in homeassistant container
if i mount like this in portainer :

mount -t cifs -o username=xxxxxxx,password=xxxxxxxxxxxxxxxxxx,domain=WORKGROUP //192.168.1.33/nvrubuntu /mnt/nvrubuntu

i can see my data under /mnt/nvrubuntu

and my config in HA is :

  media_dirs:
    recording: /mnt/nvrubuntu

so i have create a folder “recording” in media under windows with samba share on HA and expect to see my data, but nothing.

I can see under portainer homeassisant but not under folder “recording” in my samba share.

What i am doing wrong please?

with homeassisant portainer If i delete / create a folder under /media i can see it in samba share of HA under windows. if i mount under portainer in this media folder, i cant see anything in samba share too, but data is good under /media folder in portainer. Sure im missing something…thanks

I simply do not understand how to add a remote share as a medir_dir…
Failed to find a COMPLETE instruction how to do it.
There are just small pieces of info & mainly for “nerds”)).

Using HA in container.
There are lots of shares like “smb://192.168.0.2/Music/”.
This code

homeassistant:
  media_dirs:
    music: "smb://192.168.0.2/Music/"

or

    music: "smb://USERNAME:[email protected]/Music/"

gives an error
ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Invalid data for call_service at pos 1: Not a directory for dictionary value @ data[‘media_dirs’][‘music’]

Probably I need to make available this share for a HA container - by no idea how to do it(((.
Assume I have a LOCAL folder “/home/media” - then I may “add” this folder to a container by

-v /home/media:/media

but do not know how to add a REMOTE folder.

I saw smth about using a “mount” command in this thread.
Probably I need to:
– mount the remote share as a local folder,
– then add this mounted folder into the container,
but I do not understand how to mount a remote share…

HA added official support for this. I haven’t tested it out maybe have a look there:

I do not have these features in my setup )))))
These “add storage” things just absent here.
Also, it was clearly said there - “This long and highly requested feature is now available when running the Home Assistant Operating System”. And not many people use HAOS…

Sorry I couldn’t help you then. But just to be clear, HAOS is the main installation method others are using, which is why I suggested a solution for it:

Meanwhile it turned out that my guess was correct:
if you need to add a remote share as “media_dir” to HA in Docker, you need to:

1.Mount a remote share to OS.
Found a great detailed manual.
Result - I have a “/mnt/music_on_nas” folder.

2.Mount this folder into the HA container - use this option in “docker run” command:

-v /mnt/music_on_nas:/music_on_nas

Result - the “music_on_nas” folder is visible for HA.

3.Add the folder as a “media_dir”:

homeassistant:
  media_dirs:
   music_on_nas: /music_on_nas

May be this is not the best way, I am not a Docker or *nix expert.
For me, that manual I mentioned is a very clear & detailed info.