Homeassistant SMB or Local Folder to GoogleDrive
I stumbled across your post years ago. But I had a slightly different goal. Now I’ve started working on the topic because I wanted to replace my old Raspbarry Pi running FHEM and rClone.
My goal:
I have a scanner that can scan via SMB (Samba).
I want to transfer the scanned file on the Samba server to Google Drive.
Previously, I realised this via SMB Share and rClone on the Pi.
I can now also realise this in HomeAssistant:
Step 1: Configure the AddOn: Samba share in HA so that you can access HA via SMB share.
I used the ‘Share’ folder for testing. And put a PNG file in here.
Step 2:
You need to create a client_id and a client_secret in your Google account. I already had these from my FHEM PI.
But the instructions should work:
Step 3:
Now you need the add-on ‘Rclone Backup’ which you have to add as an additional add-on repository.
Step 4
Create the file in your HA Config folder: ‘rclone.conf’
In other words, where the configuration.yaml is located.
Example Configure:
[google]
type = drive
scope = drive
token = {"access_token":"ya2...178","token_type":"Bearer","refresh_token":"1//0...KU","expiry":"2024-...+01:00"}
; immediately delete backups instead of sending them to the trash
use_trash = false
client_id = 549...79eim.apps.googleusercontent.com
client_secret = GOCS...D0
Step 5
My configuration currently looks like this in the AddOn under Configuration. It is currently being synchronised. rClone can also move.
I am currently syncing everything from the HA Sync folder to the Google Drive Sync folder every minute. * * * * * * is a chron job time.
- name: Sync every minute
schedule: "* * * * *"
command: sync
sources:
- /share
destination: google:/share
include: []
exclude: []
flags: {}
Don’t forget the ‘dry_run’ switch. switch off. Otherwise you will get the following message in the log. skipped copy as --dry-run is set
But you can leave it on for now. Then you can see what Clone would do.
Step 6
Start rClone AddOn and see what is output in the log. It actually tells you everything. Whether it is connected and which files it is copying. In my case, the job starts every full minute.
Tip. If you are connected to Google Drive, you can see the folder structure in the Rclone Backup user interface.
SMB Share with File
Sync via Rclone Backup
Google Drive File Explorer in Rclone Backup
File in Google Drive