Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion source/_integrations/google_drive.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ related:
title: Google Developer Console
---

This {% term integration %} allows you to connect your [Google Drive](https://drive.google.com) with Home Assistant Backups. When you set up this integration, your Google Drive will have a new folder called Home Assistant where all the backups will be stored. You can rename this folder to whatever you like in Google Drive at any point in time. If you delete the folder, it will automatically be re-created as long as you have the {% term integration %} enabled.
This {% term integration %} allows you to connect your [Google Drive](https://drive.google.com) with Home Assistant Backups. When you set up this integration, your Google Drive will have a new folder called `Home Assistant` where all the backups will be stored. You can rename this folder to whatever you like in Google Drive at any point in time. If you delete the folder, it will automatically be re-created as long as you have the {% term integration %} enabled.

For a video walkthrough of the setup instructions, see this video from 13:50 to 19:20
<lite-youtube videoid="pZlYu9bN72U" videoStartAt="830" videotitle="Automate Your Home Assistant Backups Like A Pro!" posterquality="maxresdefault"></lite-youtube>
Expand All @@ -40,6 +40,48 @@ These are not the same as *Device Auth* credentials previously recommended for [

{% include integrations/google_oauth.md %}

## Sensors
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this to match submitted code

The integration provides the following sensors, which are updated every 6 hours:

- **Total available storage**: The storage limit, if applicable. This will be unknown if the user has unlimited storage.
Comment thread
mik-laj marked this conversation as resolved.
- **Used storage**: The total storage usage across all Google services.
- **Used storage in Drive**: The usage by all files in Google Drive. This entity is disabled by default.
- **Used storage in Drive Trash**: The usage by trashed files in Google Drive. This entity is disabled by default.
- **Total size of backups**: The sum of the size of all backups for the current Home Assistant's installation.

For users that are part of an organization with pooled storage, information about the available storage and used storage across all services is for the organization, rather than the individual user.

## Examples

Get started with these automation examples.

### Send alert when drive is near storage limit

Send an alert when the drive usage is close to the storage limit and needs clean up.

{% details "Example YAML configuration" %}

{% raw %}

```yaml
alias: Alert when Google Account is close to storage limit
description: Send notification to phone when drive needs clean up.
triggers:
- trigger: numeric_state
entity_id: sensor.example_gmail_com_used_storage
Comment thread
mik-laj marked this conversation as resolved.
above: "{{ states('sensor.example_gmail_com_total_available_storage') | float * 0.9 }}"
actions:
- action: notify.mobile_app_iphone
data:
title: Google Account is almost full!
message: >
Google Account has used up {{ states('sensor.example_gmail_com_used_storage') }}GB of {{
states('sensor.example_gmail_com_total_available_storage') | float }}GB.
```

{% endraw %}
{% enddetails %}

## Removing the integration

{% include integrations/remove_device_service.md %}
Expand All @@ -53,3 +95,4 @@ These are not the same as *Device Auth* credentials previously recommended for [
## Troubleshooting

If you have an error with your credentials, you can delete them in the [Application Credentials](/integrations/application_credentials/) user interface.