- Login to the Google API Console
- In the top menu bar, click the
Select a Project
drop-down. Select an existing Project that you want to use, or clickNew Project
in the top-right.- If creating a new project, enter a name and optionally edit the project-id -- then click
Create
- If creating a new project, enter a name and optionally edit the project-id -- then click
- On the Google Dashboard that loads, click
+ ENABLE APIS and SERVICES
at the top - Enter
Photos
in the search bar, then select thePhotos Library API
- Click
ENABLE
on the next screen - Select
Credentials
in the left-side pane, then click+ CREATE CREDENTIALS
at the top, and selectOAuth client ID
- You may be prompted to
CONFIGURE CONSENT SCREEN
. If not, continue to step 8.- Select
External
users (this is the only option allowed unless you are part of a Google Workspace) - Enter App information, e.g.:
- App name: Hubitat Photos App
- User support email: your_email@gmail.com
- Developer contact information: your_email@gmail.com
- Click
Save & Continue
on each page - Once complete, go back and repeat step 6.
- Select
- Select
Application type
==Web application
- Enter a name for the client, e.g.
Hubitat
- Under
Authorized redirect URIs
, click+ ADD URI
and enter:https://cloud.hubitat.com/oauth/stateredirect
- Click
CREATE
- You will see the new entry under
OAuth 2.0 Client IDs
-- on the far-right, click the download icon to download the credentials as a JSON file. This file will be referred to ascredentials.json
in all subsequent documentation.
- On the Apps Code page, press the New App button
- Paste the code for
photos-app.groovy
and press the Save button (or type Ctrl-S) - Press the OAuth button, then press Enable OAuth in App, then press the Update button.
- On the Drivers Code page, press the New Driver button
- Paste the code for
photos-device.groovy
and press the Save button (or type Ctrl-S) - On the Apps page press the Add User App button then click on Google Photos in the list of available apps.
- Copy and paste the contents of your Oauth2
credentials.json
file downloaded from GCP into the Google credentials.json input field
NOTE: Don't forget to press the Done button to make sure the app sticks around!
- On the Apps page, click the link to Google Photos
- Now that the previous steps are complete, you should now see a section: Auth Link - Click this link to authorize with your Google Photos library.
- Click on this link, and walk through the steps to authorize with Google. When complete, you will be redirected back to a basic page provided by this HE app.
- Click the specified link to return to the App configuration page.
- Click the Refresh Albums List button to populate the
Album to use
drop-down (this may take a few seconds) - Select the album you want to use for the slideshow in the
Album to use
drop-down (you may need to open the drop-down twice after step 5, to see updated data) - Enter your preferred image resolution (optional)
- Click the Load Photos from Album button -- this retrieves the current set of IDs from google to use for the slideshow
- A
Google Photos Device
entry was created in your HE Devices -- you can use theimage
attribute of this device in your dashboards to display photos from your selected Google Photos album. It will update once a minute.