Write files from Hassio to a (Synology) NAS (SMB Share)

Hello!

2 months ago I made the choice to migrate to HA because of the great customizable interface and flexibility with components. Currently I am still running Domoticz.

Most automation I have migrated and tested on HA. But there is one automation that I cannot fully port to HA.

On Domoticz I have a bash script running that is activated when someone presses my doorbell (433mhz)

  1. Grab camera snapshot
  2. Send it to a Telegram group
  3. Rename the file to snapshot-date/time.jpg
  4. copy this file to a (locally mounted) folder on my Synology NAS.
  5. Delete the file from the SD card.

Taking a snapshot and sending it to Telegram is not the issue, but saving it to my NAS is.
Is there any way to achieve point 4 mentioned above in HASSIO?

Hope you can help me :slight_smile: thank you in advance!

Considering the amount of replies, I’m assuming there is no good solution for this.

I’ve managed to create a workaround:

  • I’ve mapped the SMB share of the HA addon in my synology.
  • the Camera script writes the snapshots in a temp folder
  • every night the Synology runs a bash script to move the files from HA to Synology.

I would love to see mapping of SMB shares coming to Hassio.

I have finally found a decent solution. In node red there is a SMB node available. This does exactly what I want. https://flows.nodered.org/node/node-red-contrib-smb

2 Likes

Hello.
I am very interested in your work but I cannot configure the ‘node-red-contrib-smb’.
My Home assistant is installed on a VMM in my Synology DS916 + NAS.
I want to copy the daily ‘Snapshot’ to a ‘Backup’ directory on my NAS.
Can you give me the details of your ‘Flow’ please.
Best regards
Bruno

Hi Bruno,
I am not sure how this will work with snapshots. I am using the upload to dropbox addon for snapshots.

However, what I do, is get the photo via the IP camera snapshot URL with a HTTP request node. Then I use a function node to format the filename: snapshot_[date-time].jpg and finally I use a SMB create file node to upload it to the correct folder.

Possibly you can do the same thing via the SMB addon.

Could you please specify what’s your exact problem? What is it that you can’t configure in the SMB node?

Cheers

Hello Hammer,

I have exactely the same need as you and i can’t figure out how to use the SMB node to move the file from the Pi to the NAS.

Up to now, I only manage to create an empty file (1oct) on the NAS with the well formated file name (thanks to msg.filename). But how to pass the .jpg payload? all the example found on internet explain how to pass text payload (.csv JSON etc) but nothing about other file type.

And if I try to use the “move file” function instead of “create file” function, I can’t figure out neither how to do it; it seem that the node do not accept Unix path format as an input. Or maybe it is due to the container limitation (docker)?

Well if you could explain how you manage to do it, I would be very gratefull!

SMB NAS

How did you manage to authenticate to a remote SMB host from the NodeRED SMB config?

I keep getting authentication errors on any remote systems that aren’t the HA host system.

Hi JMG,

I have totally missed your reply to this topic…

I have no experience with moving files… In my flow I write the foto directly to the file in the share using the create file function. I guess what’s going wrong is that I think that both “Path” variables are pointing to your NAS. So a local path will not work.

Cheers!

Hi Arretx,

I just filled in the authentication parameters, please see screenshot.
Please note that this node supports SMBv2