Hi All - Just wanted to share;
After several unsuccessful tries over the years, got the media folders mapped from my NAS library and it works.
In order to do this please ensure your NFS (nas) server:
- has a static IP
- has the required shares exposed
- all shares have the appropriate permissions
Prepare The HA:
- Open Terminal session to your HA host
- Most of you are running on docker so you will need to access your homeassistant docker instance
docker exec -it $(docker ps -f name=homeassistant -q) bash
- Create a folder(s) within /media/ folder of your choice in my case I have 2
mkdir /media/MOVIES
mkdir /media/MUSIC
- Next test if you are able to mount manually from the command line. This would be used later to create a shell command service.
eg.
mount -t nfs4 192.168.1.5:/MOVIES /media/MOVIES
- See if the mapped content is visible in HA in the media folder in your lovelance interface
- If successful we will now need to create an automation so each time you reboot the docker or the host, mapping will happen again
Start by editing your configuration.yaml to add the shell commands which will become callable by automations.
Add the following lines, ensure they are the same command as used for testing in step 4.
# Custom Shell
shell_command:
map_nas_video_folder: mount -t nfs4 192.168.1.5:/MOVIES/ /media/MOVIES
map_nas_music_folder: mount -t nfs4 192.168.1.5:/MUSIC/ /media/MUSIC
Next restart your HA instance as the new command needs to be added by the configuration you’ve added above.
Once restarted you can check your media folders again, and you’ll see that your MOVIES, MUSIC folders are empty
- Create automation with each start of HA, to execute shell commands we’ve defined above.
- id: '1611345337440487'
alias: 'Mount NFS Folders'
description: ''
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: shell_command.map_nas_video_folder
data: {}
- service: shell_command.map_nas_music_folder
data: {}
mode: single
- Restart HA, you should now see the folders in your media and content mapped from your NAS.
Enjoy casting or playing back your favorite files through the HA interface.