@scrypted/google-device-access
v0.0.99
Published
The Google Device Access Plugin allows you to import and control your Nest and Google devices from Scrypted.
Downloads
409
Readme
Google Device Access Plugin for Scrypted
The Google Device Access Plugin allows you to import and control your Nest and Google devices from Scrypted.
Setup
Scrypted Cloud
Scrypted Cloud must be installed so Google can push device status changes to the plugin.
- Install the Scrypted Cloud plugin (@scrypted/cloud).
- Log in to Scrypted Cloud.
Google Account Creation
Follow steps at the link below to create your personal Google Device Access developer account Google Cloud developer account:
- Google Device Access Project aka GDA ($5)
- Google Cloud Project aka GCP (might be within the free tier) https://developers.google.com/nest/device-access/get-started
Google Cloud Setup
- Create a API & Services -> Credentials -> Create Credentials -> OAuth -> WebApplication with the following redirect URIs:
https://home.scrypted.app/web/oauth/callback
https://www.google.com
- Open the API Dashboard and enable the following APIs:
- Smart Device Management API
- Cloud Pub/Sub: You will come back to this again below.
Google Device Access Setup
- Create the project.
- Add the GCP client id.
- Note the pub/sub topic.
Scrypted Plugin Setup
- Enter the GDA project id, GCP client id, and GCP secret.
- Login.
- Note the pubsub url.
Google Cloud PubSub Setup
Create a pubsub push subscription and configure it using the previously noted GDA topic and Scrypted pubsub url.
Step by Step Guide Of The Above
- Browse to https://console.developers.google.com/apis/credentials
- In the top left bar, click the drop down
- Select 'New Project'
- Enter a project name eg NestScrypted
- Click 'Create'
- You will be taken back to the 'APIs and services' page
- In the top left bar, click the drop down and choose your newly created project
- You need to configure OAuth consent screen - click 'CONFIGURE CONSENT SCREEN' to the right of the page
- Select 'External' and click 'Create'
- Complete all mandatory fields
- Click 'Save and continue' for the next 3 screens
- Click 'BACK TO DASHBOARD'
- In the left column, select 'Credentials'
- At the top of the screen, click '+ CREATE CREDENTIALS'
- Choose 'OAuth client ID'
- From the drop down, choose 'Web application' as the application type
- Enter a name eg Scrypted OAuth
- Under 'Authorised redirect URIs' click '+ ADD URI' and enter https://home.scrypted.app/web/oauth/callback
- Click '+ ADD URI' and add https://www.google.com
- Make a note of the OAuth 'Your Client ID' and 'Your Client Secret' - these are to be entered into Scrypted plugin Google Device Access settings
- Click 'Create'
- On the left column, select 'OAuth consent screen'
- Scroll down to '+ ADD TEST USERS'
- Add your gmail email addresss as a test user
- In the left column click 'Enable APIs and services'
- At the top of the page, click '+ ENABLE APIS AND SERVICES'
- Search for 'Smart Device Management API'
- Click the result and select 'ENABLE'
- In the left column click 'Enable APIs and services'
- At the top of the page, click '+ ENABLE APIS AND SERVICES'
- Search for 'Cloud pub/sub api'
- Select 'Cloud pub/sub api'
- Click 'ENABLE'
- Browse to https://console.nest.google.com/device-access/project-list
- Create a project
- Enter a name for the project
- Click 'Next'
- Enter the OAuth Client ID from step 20 (the same details you recorded on the Scrypted plugin Google D9vice Access settings page)
- Select 'Enable' and click 'Create Project'
- Make a note of the Project ID - this is to be entered into Scrypted plugin Google Device Access settings page for Project ID
- Make a note of the 'Pub/Sub Topic'
- Go back to the Scrypte plugin and choose 'Login'
- Select your email address
- Select all the relevant devices you wish to access in Scrypted, wait for 10 seconds to allow any other options to become active to select
- Select 'Next'
- Choose your email account again
- Click 'Continue' when prompted even though the app has not been verified
- Click 'Continue' on the page stating 'scrypted.app wants to access your Google Account'
- Your new devices will be added to Scrypted.
- Now we need to setup the Google Cloud Pub/Sub - browse to https://console.cloud.google.com/cloudpubsub/subscription/list
- Click on ‘Create Subscription’
- In ‘Subscription ID’ field enter any value, eg ‘Scrypted’
- Click the drop down title ‘Select a Cloud Pub/Sub topic’
- Click on ‘ENTER TOPIC MANUALLY’
- Enter the noted pub/sub topic from step 42 and click 'Save'
- Change 'Delivery type' to Push
- Enter the URL from Scrypted Google Device Access Settings page (bottom box - 'Pub/Sub Address') in the 'Endpoint URL'
- Change ‘Message Retention’ to 1 hour rather than 7 days otherwise the system can get overloaded
- Click ‘Create’