Getting the finished video out of the container and onto your phone
Part 11 built the video pipeline and Part 12 explained its 720 MB of tooling. The MP4 it produces is real, and your phone cannot reach it. This article connects /data/pi-agent/ to Google Drive with rclone, already inside the add-on. Authorize it once, and every finished video arrives on your phone by itself.
The file exists. It is just nowhere useful.
The finished MP4 sits under /data/pi-agent/, inside a container your phone cannot open. Without an upload step: finish the video, open a computer, connect over SSH, find the output path, fetch it with scp, send it on. With rclone: finish the video, get a Drive notification on your phone, share it.
rclone is a file synchronization tool, the command-line counterpart to the Drive app, and it is already in the container: no apt install rclone, no separate version to manage. Every command has one shape:
rclone copy local-path remote-name:remote-folderThree reasons it suits this job, of which only the simplest direction — local file to Google Drive — is covered here:
- Mature. More than ten years of development; token refresh, retries and multipart uploads for large files are handled.
- Not locked to Google. More than 40 services: OneDrive, Dropbox, Box, iCloud Drive, Amazon S3, Alibaba Cloud OSS, SFTP, WebDAV. Either end can be cloud storage, so it will copy Drive to Dropbox or back S3 up to OneDrive.
- Direct. Files go from your own Home Assistant host to the provider you chose; Pi Agent does not relay them through a WoowTech cloud service.
Every other combination uses the same remote-and-path model.
Why rclone never asks for your Google password
Google no longer lets software sign in with your email address and password: anything holding it could reach the whole account — mail, Drive, your YouTube channel, payment services — and even software you trust can be compromised. It is the same delegated-access model as a service asking to read your Google Calendar.
Your password is the master key to the building. rclone gets a key card for one room instead, issued at the front desk and logged in your name. Cancel it whenever you like; your own key still works.
flowchart TD A["rclone starts an authorization request
and prints a command to run
on a computer with a browser"] --> B["Google asks whether rclone
may access Drive, at the
scope you selected"] B --> C["Google issues rclone a token,
limited to that scope"] C --> D["rclone presents the token
for every later transfer"] D -.->|"you revoke it in
Google Account, Security,
third-party connections"| E["The stored token stops
authorizing rclone"]
Withdraw it any time from Google Account → Security → third-party connections. Type your Google password only on a genuine Google page whose address and account you have checked; close any other screen that asks for it.
This is the one chapter you type yourself
Most of this series happens by asking. Here you type: rclone config is interactive and runs inside the Pi Agent container.
- read, bash, edit, write is the whole list in the left column. bash is why the agent can help with terminal work — though the authorization below is still yours to do.
- read is selected, and the right-hand panel names its three parameters: path, required; offset and limit, optional. It reads a file you name, not whatever it likes.
-
Step 1
Install Advanced SSH & Web Terminal
Go to
Settings → Add-ons → Add-on Store, search for Advanced SSH & Web Terminal, install it, open Web UI. No SSH client needed on your laptop. -
Step 2
You are not in Pi Agent yet
The terminal opens in the SSH add-on's own environment: you may see system paths such as
/config/and/mnt/, andls /data/pi-agent/here may say “No such file or directory”. Correct, not a fault — that path is Pi Agent's persistent data. -
Step 3
Find your own container name
Pi Agent's container is
addon_<slug>, and a repository-installed slug usually starts with an eight-character repository hash, such asb9cf5676_woow_ha_pi_agent. The hash comes from the repository source, so different repository URLs give different names. CheckSettings → Add-ons → Woow HA Pi Agent → Infofor a Hostname or Slug; if yours shows none, do not infer it — discover it:docker ps --format '{{.Names}}' | grep pi_agent -
Step 4
Enter the container you just verified
Substitute your own slug into
docker exec -it addon_<your-slug> bash— for exampledocker exec -it addon_b9cf5676_woow_ha_pi_agent bash. Do not type the example unchanged unless it matches your installation exactly. A prompt likeroot@container-id:/#means you are inside;ls /data/pi-agent/should now list sessions, models and rclone. -
Step 5
Stay there for everything that follows
rclone config,rclone lsdandrclone config reconnectall need this container: the rclone executable and the persistent configuration live here. If you seerclone: command not found, stop and check the prompt and container name first.
addon_local_woow_ha_pi_agent or addon_woowtech_ha_pi_agent, and never copy one from someone else's system. If docker ps is unavailable or refuses permission, do not substitute random ha or Podman commands: read the terminal add-on's Protection mode and host-access documentation. Container management needs privileged host access, which can modify or delete any add-on's data — change that setting only if you understand what it means, and put it back when you leave the shell.Most prompts want the default. Two do not.
Run rclone config. Wording varies between releases; read each prompt before pressing Enter.
| Prompt | What to enter, and why |
|---|---|
e/n/d/r/c/s/q> | n for a new remote. On a first run the list above it is empty. |
name> | gdrive. A local label, not your Google account, and the gdrive: prefix in every command below. Later remotes might be dropbox or onedrive. |
| Storage type | The number beside drive (Google Drive) among the 40-plus numbered backends, or drive if your prompt accepts names. |
Google Application Client Id> | Your own OAuth client is the durable choice. If your release still permits its shared client, Enter accepts that default, and the same at client_secret. Read the 2026 notice below first. |
| Scope one of the two | 1, “Full access all files, excluding Application Data Folder,” if the pipeline must upload into arbitrary folders and inspect existing files. 3 limits rclone to files it creates or opens through the app; those still appear in the Drive app, but rclone cannot browse or manage your other files. Choose the narrowest scope that works. |
service_account_file, then Edit advanced config? | Blank, then n. A personal Google account has no service-account JSON file, and the defaults for chunk size, proxy behavior and SSL suit 99% of home installations. |
Use web browser to automatically authenticate rclone with remote? the other one | n, and this is the easiest prompt to get wrong. y is meant for a computer where rclone can launch Firefox or Chrome; on your browser-less Home Assistant host it can leave the terminal at waiting for code... forever. |
| The authorization step | Current releases print an rclone authorize command for a trusted computer with a browser and a compatible rclone version; older ones print a long URL beginning https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=...&scope=...&response_type=code. Copy the entire line, every :, _ and &. Get rclone for that computer only from its official distribution channel, and never hand the command or URL to an online “authorization helper”. |
| Google's sign-in and consent page | Check four things: you started this from your own rclone authorize command; the page is genuinely hosted by Google; the account shown is the one you meant; the requested Drive scope matches what you chose. “Google hasn't verified this app” appears for an unverified or testing client — normal for one you made yourself, but not proof this prompt is safe. Only when all four hold, open Advanced and choose Continue to rclone. Anything unfamiliar: cancel. |
| The token prompt | The trusted computer prints an authorization result; copy the whole thing in. Older bundled versions instead ask Enter verification code> and answer Got code. Either way rclone writes the token to rclone.conf. Current flows return the result to that computer rather than showing the out-of-band code older tutorials describe. |
Configure this as a Shared Drive (Team Drive)? | n for a normal personal My Drive. Team Drive is its former name; choose it only if your organization gave you access and you want the remote rooted there. |
Keep this "gdrive" remote? | Read the summary, including type = drive and the scope you picked. y only if the values are right, then q to quit. |
client_id and client_secret in Google Cloud Console and enter them at the Client Id prompt, following rclone.org/drive/#making-your-own-client-id and Google's consent-screen and test-user requirements.A finished wizard is not a working upload
Still inside the container, run rclone lsd gdrive:. It prints the directories at the root of your My Drive or Shared Drive:
-1 2024-03-15 08:22:14 -1 Albums-1 2025-06-20 14:11:03 -1 Work Backups-1 2026-01-08 22:45:56 -1 Home VideosA listing confirms read access. No output and no error is legitimate too, if that root holds no directories; create a folder and repeat for a clear answer. Three errors turn up often:
| What it says | What to do |
|---|---|
Failed to lsd: couldn't list directory: Get "https://...": oauth2: token expired | The token is no longer accepted. Run rclone config reconnect gdrive: and complete OAuth again. |
Failed to lsd: didn't find section in config file | The remote name matches no section in the active config. Run rclone config and check the exact name — it is case-sensitive, and Gdrive: is not gdrive:. |
rclone: command not found | You are not in the Pi Agent container, or the bundled executable is unavailable. Return to the docker exec step and check the target. |
Now prove you can write. If your Drive root already holds a test.txt, use a unique name in both lines so the test cannot overwrite it:
echo "hello from pi agent" > /tmp/test.txtrclone copy /tmp/test.txt gdrive:Check Recent in the Drive app and read the contents of test.txt; only then delete it from Drive. Copying leaves the local file alone.
-v for verbose transfer information, -vv for detailed diagnostics. rclone lsd gdrive: -vv reports backend initialization, API activity, retries and timing. Those logs can carry file paths and account metadata: read and redact before pasting one into a forum. rclone normally obscures secrets, but treat the whole log as sensitive.Point the pipeline at a folder
The pitch_video Skill needs a destination such as gdrive:PiAgent/Videos/, but which setting holds it varies by version: read the installed version's SKILL.md, README and configuration example, and never assume a field from another version exists. Three shapes are common, all taking the same value:
| Where the setting lives | Example value, and what to watch |
|---|---|
upload_to: in YAML frontmatter | upload_to: gdrive:PiAgent/Videos/ — only if the installed Skill documents this field. |
A separate config.yaml or .env | RCLONE_DEST=gdrive:PiAgent/Videos/ — the Skill reads this when it starts. |
A push_drive.sh style script | Change rclone copy "$OUTPUT" gdrive: to rclone copy "$OUTPUT" gdrive:PiAgent/Videos/ — direct, but harder to maintain. Keep the quoting and check the exit status. |
- Process details · 2 messages · 2 tool calls is collapsed by default. Open it when you want evidence of what ran rather than a summary.
- notes.md shows up twice: as a chip under the reply, and as a new entry in the EXPLORER list on the left. You are not taking the answer on trust.
- 187 in · 57 out · 1,152 cache R · $0.0032 is what it cost. Reading a SKILL.md is this size of job.
Create that Drive folder yourself rather than letting the copy make it, so you can check its location and sharing permissions first. Keep the trailing / in all three forms; with rclone copy, gdrive:PiAgent/Videos is a directory path too, and renaming a file on the way up needs copyto.
copy is a photocopier: it adds to the destination and leaves the rest alone. sync is a mirror: it makes the destination match the source, deleting anything at the far end that is not at the near end. Never swap one for the other just to upload a file.
Now run the full pipeline from Part 11. Its last stage should log something close to this:
[push_drive] Uploading final.mp4 (42MB) to gdrive:PiAgent/Videos/[push_drive] Transferred: 42.1 MiB / 42.1 MiB, 100%, 3.2 MiB/s[push_drive] Uploaded final.mp4 successfully in 13sThen check the file in Drive — name, size, whether it plays. A success-looking log line is not verification. Do not delete the local output until the upload returned success and you have seen the remote file.
rclone ls gdrive:My videos will not survive being pasted unquoted. Plain alphanumeric paths like PiAgent/Videos/ or Home/Recordings/ are safer to type.One file you should treat as a key
rclone writes the remote and its token to /data/pi-agent/rclone/rclone.conf:
[gdrive]type = drivescope = drivetoken = {"access_token":"ya29.a0Af...","token_type":"Bearer","refresh_token":"1//0e...","expiry":"2026-08-14T15:30:00.000000Z"}team_drive =The refresh_token fetches fresh short-lived access tokens without asking you again, which is what makes it long-lived. Anyone with a usable copy of this file may reach data inside the granted scope until you revoke the authorization.
/data/pi-agent/ is persistent add-on data, with two consequences. An upgrade replaces the add-on's packaged filesystem but leaves /data/ alone, so restarting or upgrading Pi Agent does not normally send you back through OAuth — see Part 15 first. And a Home Assistant backup can package that same /data/, rclone.conf included, when Pi Agent is selected and the backup succeeds. After restoring, run rclone lsd gdrive: and one harmless upload rather than assuming it worked.
| Situation | Repeat OAuth? |
|---|---|
| Pi Agent upgrade or add-on restart | Normally no — but verify the remote afterwards. |
| Restore from a verified backup, same or new machine | Normally no, if the add-on data and a valid token came back. |
You removed rclone's access in Google Account → Security | Yes. That token is revoked. |
| You deleted rclone.conf with no safe backup | Yes. |
| Google revoked it after unusual activity or another security event (rare) | Yes, after reviewing the account's recent security activity. |
Dropbox, OneDrive, S3 — or the NAS in your cupboard
Another destination is another run of rclone config: n for a new remote, a clear name such as dropbox, onedrive or s3, then the matching backend. Only the questions after the Storage step differ:
| Backend | What its wizard asks for |
|---|---|
dropbox | An OAuth flow resembling Drive's. On a headless Home Assistant host, answer n at browser auto-configuration and finish the printed authorization on a trusted computer. |
onedrive | The account and drive type your wizard offers; a personal onedrive.com account and an organizational Microsoft 365 account present different choices. |
s3 | Usually an access_key_id and secret_access_key rather than OAuth, plus the provider, such as AWS or Cloudflare R2. For AWS, create least-privilege credentials through IAM — never account-root credentials. |
sftp, smb, webdav | Whatever your Synology, QNAP or TrueNAS is configured to expose. Local transfer is usually faster and spends no cloud quota, but still needs authentication and access controls, and a NAS holding your only copy needs its own backup. |
Test the exact remote before relying on it: rclone lsd dropbox:, then a harmless upload, as you did for Drive. Only then change the Skill's destination from gdrive: to dropbox:, onedrive: or s3:mybucket/.
You can keep several remotes at once: a Skill script can run rclone copy final.mp4 gdrive:PiAgent/Videos/ and rclone copy final.mp4 dropbox:PiAgent/Videos/. Each transfer spends its own provider's quota and can fail on its own, so check both exit statuses and both remote files before calling the run a success or deleting the local source. Two copies is redundancy, not a backup strategy — that needs retention rules and a tested recovery too.
The things that actually catch people out
| Symptom | What to do about it |
|---|---|
| The authorization line is truncated, or the browser searches for it | An older URL runs 200–400 characters and an rclone authorize command can be longer; one missing character breaks the flow. Triple-click the whole line in the Advanced SSH Web UI and press Ctrl+C. Paste into the address bar, not a search field; on mobile, Paste and go. |
| “Google hasn't verified this app” | Expected for an unverified or testing OAuth client, and no proof the prompt is safe: work the four checks in the wizard's sign-in row, then Advanced → Continue to rclone. Anything unfamiliar, cancel. Your own client_id does not remove the warning by itself: the consent screen and test users must be configured too, and wider public use may need Google's verification. |
| The upload fails with quota exceeded | A standard Google account commonly gets 15 GB shared across Drive, Gmail and Photos; check your own allowance. Then clear unneeded files, large Gmail attachments included; or move to Dropbox or OneDrive; or buy storage after checking current prices for your country — examples available when this guide was written were roughly TWD 700 a year for 100 GB, TWD 900 for 200 GB, and a few cents per GB on S3 or R2, but prices change. If the Skill supports cleanup, let it delete local output only after a successful exit status and your own check of the remote file. |
| A 401 after months of not using it | Refresh tokens are long-lived, not eternal: revocation, an OAuth-client change, long inactivity under some policies or an account-security action can stop them, giving oauth2: token expired or 401 Unauthorized. Review your Google Account security activity, then run rclone config reconnect gdrive: in the Pi Agent container and complete the headless flow. It updates the token in rclone.conf. |
rclone lsd is slow or seems to hang |
rclone lsd gdrive: -vv tells network retries apart from a large listing: a root with tens of thousands of entries can take dozens of seconds. ping accounts.google.com reveals gross connectivity problems but proves nothing about the API, since many services deprioritize ping. Restarting a faulty router may help; switching DNS to 8.8.8.8 is no universal fix and should fit your privacy and network policies. If the folder exists, rclone lsd gdrive:PiAgent/ narrows the listing. |
docker exec does not change the prompt, or rclone is still missing |
The command may have failed, hit the wrong container, or been blocked by the SSH add-on's permissions. Run docker ps --format '{{.Names}}' | grep pi_agent and confirm the exact name, such as addon_b9cf5676_woow_ha_pi_agent. Where the Home Assistant CLI exists, ha addons info <your-slug> gives add-on metadata but does not enter the container. Do not guess at Podman or Docker commands; if management commands stay unavailable, use an add-on's own web terminal, but only if its Info page offers one. |
| The video finishes but push_drive never runs | Three candidates: your configuration does not match that exact Skill version's documentation; the Skill does not recognize upload_to and predates automatic uploads, so read its CHANGELOG and follow its documented upgrade path rather than pulling files from GitHub; or push_drive.sh skipped the stage after an rclone preflight failure. Read the whole execution log before changing any setting. |
| OneDrive rejects a filename Drive accepted | OneDrive is stricter about characters such as : ? * < > |. rclone usually encodes what a backend cannot store, but the result depends on the backend and its encoding settings. --onedrive-server-side-across-configs governs server-side operations between OneDrive configurations; it does not repair invalid filenames, so do not add it for this. “Living room: turn on the lights first?” travels far worse than living_room_lights_20260814.mp4. |
Questions people ask at this point
Someone got my token. What now?
Google Account → Security → Your connections to third-party apps and services, select rclone, remove its access: that revokes the leaked authorization. Then run rclone config reconnect gdrive: in the Pi Agent container for a new token. Review recent security activity for unfamiliar devices, locations or IP addresses, and if a backup holding rclone.conf was exposed, rotate every other credential in it.Do I have to use Google Drive?
Will this eat my home Internet connection?
--bwlimit 5M to the rclone command in the Skill's documented configuration to cap it at about 5 MiB/s; schedule uploads overnight; put the host on Ethernet if Wi-Fi is unreliable. Upload traffic counts toward any ISP data cap. The file occupies Drive storage once; Google does not charge the transfer against your quota a second time.Can two Home Assistant systems share one rclone configuration?
/data/pi-agent/rclone/rclone.conf from system A to the same path on system B, with scp or a suitable Home Assistant file-management tool, and protect the copy as the credential it is; both then use the same refresh token and account. Prevent collisions: if both hosts upload final.mp4 into one folder, the second can replace the first. Put each host's name in the Skill's filename rule — final_hostA.mp4, final_hostB.mp4 — or use separate destinations such as gdrive:PiAgent/HouseA/ and gdrive:PiAgent/HouseB/.Can I just edit rclone.conf by hand?
scope are editable — but changing drive to drive.file does not narrow a token already issued; reconnect the remote and authorize the new scope. team_drive and root_folder_id are editable too, and root_folder_id roots a remote at one Drive folder. Do not edit the token by hand: sensitive JSON, easy to corrupt, and an invalid one means reconnecting anyway. Run cp rclone.conf rclone.conf.bak first, and do not leave that credential copy anywhere publicly reachable.Does it re-upload everything every time?
rclone copy skips unchanged files, normally comparing size and modification time; add --checksum when both ends support hashes. rclone sync is the mirroring one described above, so always preview a first sync with --dry-run. Pi Agent's push_drive.sh normally uses copy, not sync, to avoid deleting anything.Can I move the token to a fresh Pi Agent on another machine?
/data/pi-agent/ exists, then securely copy the old system's /data/pi-agent/rclone/rclone.conf into place and test the remote. Or make a partial backup on the old system with only the Pi Agent add-on selected and restore it on the new one: same mechanism as a full backup, fewer items. Either way the material may also contain API keys and Session history, so encrypt and protect it.Where to go from here
You just created a credential. Part 14 is about not losing it.
Your API keys, your session history and the token you just made either survive a dead SD card or do not. Part 14 covers what a Home Assistant backup includes, and what to verify after a restore.
Open the full guidePart 13 of the Pi Agent Onboarding Guide series, published by WoowTech.
Based on the Woow HA Pi Agent Onboarding Guide, produced by WoowTech and released under CC BY 4.0.
The Smart Space Solution · 智慧空間解決方案 · © 2026 WOOW Technology Co., Ltd.