Ooof. This one kicked my ass for a really long time. The question is “How to connect the Home Assistant Media folder to an SMB share?” There’s a wizard, but what to enter for the Remote share entry is murky.
A part of this is pretty obvious, but the other part is not. Of course, I tried the wizard first, but I didn’t enter the Remote share entry correctly. I tried reading the documentation, but it wasn’t much more than “For the Remote share entry, put in the remote share.” Home Assistant would always fail to mount the share, and the error message was (essentially) “It didn’t work”. Sigh.
I had previously created an SMB share on my Synology NAS, and could map to it just fine from my main Linux desktop, from my Nextcloud instance, and from Windows machines I have here on my home network. I knew from my Nextcloud install (adding it to /etc/fstab) that the vers=3.0 option was important.
Doing a search found a Youtube video about editing the /config/configuration.yaml file and running a shell command. It mentioned that the vers=3.0 was important. Maybe this is what I need? This turned out to be a rabbit hole (but no rodent with a mean streak a mile wide at the end 1).
Since the system-launched shell command wasn’t working, I tried the next logical step: try it from an actual command line. It didn’t work. I think that is because of Docker and the impermanence of the terminal shell and sandbox for security.
I installed a terminal app in Home Assistant, but whenever I tried the same mount command that worked on Linux, it would fail on Home Assistant with “permission denied”. Not really helpful. In fact, it seems unhelpful, because if I read between the lines 2 I see “your password is wrong” – which it wasn’t. “Permission denied” is the error message you get when your password expires, and the credentials file has the old password. Of course, I knew my password was correct: but if I were someone brand new to this, I would have been mislead by my own thinking.
Here is the mount command that does work in Linux but not in Home Assistant:
mount -t cifs -o vers=3.0,credentials=/config/.smbcredentials //mysynology.domain.tld/sharename_smb/data /media/nasfiles
3 4
The problem that I was running into was that the Home Assistant documentation never tells you what it wants for “Remote share”. The dialog box says “This is the name of the share on your storage server” – but that doesn’t help, because it doesn’t specify what to put in. That’s why I’m writing this post: if you have a mount command that does work elsewhere, the pieces you need are here.
Over on the Synology, it told me the share name was smb://mysynology.domain.tld/sharename_smb/data
That does not work here in Home Assistant.
Here are the settings that do work:
So, from the mount command above, the Server entry is mysynology.domain.tld
and the Remote share entry is sharename_smb/data
Phew. This was a long time in figuring out, as I tried all sorts of stuff for the Remote share entry:
- /sharename_smb/data 5
- mysynology.domain.tld/sharename_smb/data
- //mysynology.domain.tld/sharename_smb/data
- mysynology/sharename_smb/data
- smb://mysynology.domain.tld/sharename_smb/data
- \\mysynology.domain.tld\sharename_smb\data
- \\sharename_smb\data
- \\\\sharename_smb\\data
- sharename_smb
- data ( with the Server being mysynology.domain.tld/sharename_smb )
Hopefully, if you found this post, it helps:
Server entry is mysynology.domain.tld
Remote share entry is sharename_smb/data
- Thank goodness it wasn’t the Rabbit of Caerbannog ↩︎
- which is a bad idea. ↩︎
- host name and share name changed to protect the innocent. Not that any of this is on the public Internet, but why tempt the random bored teenager? They can be pretty clever and persistent. ↩︎
- Yes, I had to create a directory named config off the root of my Linux box and copy the .smbcredentials file to it for the mount command to be an exact replica of what would have gone in the shell command in /config/configuration.yaml ↩︎
- so close. ↩︎