myntath / gtasks-ha

GTasks custom component for HA
MIT License
18 stars 2 forks source link

Gtasks-Ha a Google Tasks Custom Component for Home Assistant

Forked from original repo by @BlueBlueBlob

You will probably also want to install the lovelace card to make best use of this. lovelace-gtasks-card

Before installation

Create a create a credentials.json (type Desktop) from Google API

If you haven't done this before detailed instructions are below but you may be able to skip some of these steps if you have previously setup some Google API Authorisations

  1. Go to Google API
  2. Click '+ CREATE CREDENTIALS' (in blue near top of the screen) and select OAuth client ID
  3. If you haven't created a project you will be given an option to do so, click that.
    • Give the project any name.
    • Location can be left as is.
  4. If you haven't configured the consent screen before you will be asked to do that now.
    • Choose User Type External and then continue. (Internal may also be OK but is only available to Google Workspace users)
    • Enter any App Name you want.
    • Enter any User support email you want.
    • Enter any Developer email you want.
    • Leave other fields empty.
    • You do not need to enter any scopes. Just click SAVE AND CONTINUE
    • Add your google account as a test user then click SAVE AND CONTINUE.
    • After reaching the summary click 'back to dashboard'.
    • Click 'Publish App'.
    • Return to the credentials page and click '+ CREATE CREDENTIALS' again and select OAuth client ID.
  5. Choose 'Desktop app' for the Application type and choose any name and press CREATE
  6. In the popup click 'DOWNLOAD JSON' a file called 'client_secret_XXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com.json' will be saved. Rename this 'credentials.json' or another name.
  7. Click 'Enabled APIs & Services' in the left bar.
  8. Search for 'Google tasks API' and select this result and click 'Enable'

Installation

Using HACS (Recommended)

  1. Add this repo as a custom repository in HACS.
  2. Install through HACS.
  3. Restart HACS.
  4. Upload your credentials.json file to a directory that HA can read. i.e. ./custom_components/gtasks/credentials.json.
  5. Restart Home Assistant.
  6. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "GTasks".
  7. Enter the path to your credentials.json file and a writable path for the component to store information.
  8. Click the authorisation URL.
  9. Authenticate and once you reach a 404 page not found look at the url and copy and paste the code between 'code=' and '&scope='.

Manually

  1. Open the directory for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory there, you need to create it.
  3. In the custom_components directory create a new directory called gtasks.
  4. Download all the files from the custom_components/gtasks/ directory in this repository.
  5. Place the files you downloaded in the new directory you created.
  6. Upload your credentials.json file to a directory that HA can read. i.e. ./custom_components/gtasks/credentials.json.
  7. Restart Home Assistant.
  8. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "GTasks".
  9. Enter the path to your credentials.json file and a writable path for the component to store information.
  10. Click the authorisation URL.
  11. Authenticate and once you reach a 404 page not found look at the url and copy and paste the code between 'code=' and '&scope='.

Using your HA configuration directory as a starting point you should now also have this:

custom_components/gtasks/translations/en.json
custom_components/gtasks/__init__.py
custom_components/gtasks/binary_sensor.py
custom_components/gtasks/config_flow.py
custom_components/gtasks/const.py
custom_components/gtasks/manifest.json
custom_components/gtasks/sensor.py

Tips