Advertisement
bafplus2

HA mount

Jun 26th, 2022 (edited)
1,297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.95 KB | None | 0 0
  1. #Put this in your configuration.yaml (mine is just below the recorder block):
  2.  
  3. # Mount media nas folder
  4. shell_command:
  5.   mount_data: !secret mount_data
  6.  
  7.  
  8. #Put this in secrets.yaml:
  9.  
  10. #mount
  11. mount_data: mkdir -p /media/data;mount -t cifs -o rw,vers=3.0,user=USERNAME,password=PASSWORD,sec=ntlmv2 //192.168.1.214/mnt /media/data
  12.  
  13.  
  14. #What does the above do?
  15. #First it creates a folder to mount to, in this case /media/data
  16. #Second it wil mount the drive, in this case //192.168.1.214/mnt,  to that (new) folder
  17.  
  18. #Last step is to let HA mount the above stuff on startup. Just use this simple automation. Should explain itself:
  19.  
  20. alias: mount media
  21. description: ''
  22. trigger:
  23.   - platform: homeassistant
  24.     event: start
  25. condition: []
  26. action:
  27.   - service: shell_command.mount_data
  28.     data: {}
  29. mode: single
  30.  
  31. # Do this for every (seperate) external drive you want to mount. Just make sure you name each command (mount_data in this example) different.
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement