Upload
Use this action to upload photos or videos from the machine running Home Assistant to your Google Photos library. You can upload a single file or several at once, and place them in an album you choose. This is handy for automatically backing up camera snapshots or sharing media to a Google Photos album.
Prerequisites
Before using this action, make sure the file paths you upload are added to allowlist_external_dirs. Without this, Home Assistant cannot read the files and the action returns an error.
Each file must be an image or a video, and there is a maximum file size. If a file is too large, is not an image or video, or does not exist, the action returns an error.
Using this action from the user interface
If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.
To upload media from an automation or a script:
- Go to Settings > Automations & scenes.
- Open an existing automation or script, or select Create automation > Create new automation.
- If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
- In the Then do section, select Add action.
- From the search box, search for and select Google Photos: Upload.
- Select the Google Photos entry to upload to. This is the Google Photos account you set up in Home Assistant. If you added more than one account, pick the one you want.
- Enter the Filename of the file to upload, and the Album to upload it to.
- In the Response variable field, enter a name to store the data in, such as
upload. - Select Save.```
This action does not support targets. In the UI, you are not prompted to choose an area, device, entity, or label.
Options in the UI
The Google Photos account to upload to. This is the account you set up in Home Assistant. If you added more than one account, pick the one you want.
The full path to the file to upload. The path must be allowed in allowlist_external_dirs. You can provide a single path or a list of paths to upload several files at once.
Using this action in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this action as google_photos.upload. A basic example looks like this:
action: google_photos.upload
data:
config_entry_id: a1bee602deade2b09bc522749bbce48e
filename: /config/www/images/snapshot.jpg
album: Home Assistant
response_variable: upload
This uploads a single image to the Home Assistant album.
Options in YAML
The ID of the Google Photos config entry to upload to. This is the account you set up in Home Assistant.
The full path to the file to upload. The path must be allowed in allowlist_external_dirs. You can provide a single path or a list of paths to upload several files at once.
Response data
This action can return a response with the uploaded media. To use it, store the result in a response variable.
The response contains the following fields:
-
media_items: A list of the uploaded items, each with amedia_item_idthat identifies it in Google Photos. -
album_id: The ID of the album the files were uploaded to.
A shortened example of the response looks like this:
media_items:
- media_item_id: AGj1epU-abc123
- media_item_id: AGj1epU-def456
album_id: AHfP9hco-xyz789
Try it yourself
Ready to test this? Open Developer tools > Actions, search for this action, fill in the fields, and select Perform action. You see what happens on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] without writing a line of YAML.
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.