Welcome to our Knowledge Base

Setup Synology NAS mounted media folders in Homeassistant

You are here:
< Back

Summary Steps

  1. Enable NSF4 file service on NAS
  2. Set mounted folder permissions on NAS
  3. Setup Shell Command Services in Homeassistant
  4. Create homeassistant automation
  5. Check to see that folders have been created
  6. Create home assistant media directors

Detail Steps

Enable NSF4 file service on NAS

  • Control Panel>SMB/AFP/NSF
  • Check Enable NFS
  • Check ENable NFSv4.1 support

Set mounted folder permissions on NAS

  • Control Panel>Shared Folders>NFS Permissions
  • Create an NFS rule

Setup Shell Command Services in Homeassistant

Edit homeassistant configuration.yaml to include

shell_command:
  mount_nas_surveillance_folder: 'mkdir -p /mnt/surveillance;mount -t nfs4 192.168.1.10:/volume1/surveillance /mnt/surveillance'
  mount_nas_movies_folder: 'mkdir -p /mnt/movies;mount -t nfs4 192.168.1.10:/volume1/movies /mnt/movies'
  mount_nas_music_folder: 'mkdir -p /mnt/music;mount -t nfs4 "192.168.1.10:/volume1/music/itunes/iTunes Media" /mnt/music'
  mount_nas_videos_folder: 'mkdir -p /mnt/video;mount -t nfs4 192.168.1.10:/volume1/video /mnt/video'
  mount_nas_photos_folder: 'mkdir -p /mnt/photo;mount -t nfs4 192.168.1.10:/volume1/photo /mnt/photo'

Create homeassistant automation

Create homeassistant automation to create and mount folders each time homeassistant starts

- id: '1608850334773'
  alias: Mount NAS Media Folders
  description: ''
  trigger:
  - platform: homeassistant
    event: start
  condition: []
  action:
  - service: shell_command.mount_nas_movies_folder
    data: {}
  - service: shell_command.mount_nas_music_folder
    data: {}
  - service: shell_command.mount_nas_photos_folder
    data: {}
  - service: shell_command.mount_nas_surveillance_folder
    data: {}
  - service: shell_command.mount_nas_videos_folder
    data: {}
  mode: single

Check to see that folders have been created

  • Open homeassistant terminal via your preferred method
    • SSH and Terminal Addon
docker exec -it homeassistant bash
cd /mnt
ls
  • Portainer –> Containers –>Console
cd /mnt
ls

Create home assistant media directories

  • Note: Configuration error if the folder does not already exist.
    media: /media
    surveillance: /mnt/surveillance
    video: /mnt/video
    movies: /mnt/movies
    music: /mnt/music
    photo: /mnt/photo

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Table of Contents