Skip to content

sdaoudi/HomeAssistant-GDrive-Uploader

Repository files navigation

GDrive Uploader

HACS Validation hassfest Validation hacs_badge

GDrive Uploader is a Home Assistant integration that offers service to upload files to Google Drive.

Installation

Method 1. HACS custom repo:

HACS > Integrations > 3 dots (upper top corner) > Custom repositories > URL: sdaoudi/HomeAssistant-GDrive-Uploader, Category: Integration > Add > wait > GDrive Uploader > Install

Method 2. Manually copy gdrive_uploader folder from latest release to /config/custom_components folder.

Configuration

In your configuration.yaml, include:

gdrive_uploader:
  secret_file_path: "/config/secrets/credentials.json"

The credentials.json is the path to your credetnials.json file generated with your client_id and client_secret.

Usage

Upload file

New service gdrive_uploader.upload:

script:
  upload_video:
    alias: Upload video
    sequence:
      - service: gdrive_uploader.upload
        data:
          parent_id: 20YTAZESppoiZ4hvuI543diltpez53tSt # Google Drive folder ID
          upload_file_path: /config/home-assistant.log # Path of file to upload

You can specify a target_dir_name, which allows you to create a new directory within the parent directory, and it is this new directory where your file will be uploaded:

script:
  upload_video:
    alias: Upload video
    sequence:
      - service: gdrive_uploader.upload
        data:
          parent_id: 20YTAZESppoiZ4hvuI543diltpez53tSt
          target_dir_name: "my_videos"
          upload_file_path: /config/home-assistant.log

Delete file or directory

New service gdrive_uploader.delete:

script:
  upload_video:
    alias: Upload video
    sequence:
      - service: gdrive_uploader.upload
        data:
          parent_id: 20YTAZESppoiZ4hvuI543diltpez53tSt # Google Drive folder ID
          dir_name: my_dir_to_remove # The directory name in Google Drive