[PROJECT] Google Photos integration for dashboard image slide-show

This is addressed in app v0.3.1

1 Like

Great job once again. It works.

What does that "preferred image resolution" setting do? Does it scale album images to that resolution or crop photos? It's optional setting but there was default settings 2048 x 1024. Should field be empty if it's optional..

These values scale the displayed image (preserving original aspect ratio) so that it does not exceed the specified size. The code will run without these values (thus optional) -- the defaults displayed represent the values applied internally if not present. This scale is applied by Google when the image is requested.

The goal is to allow a size specification based on the intended display -- yes, the browser will auto-scale the image to fit within the frame of the dashboard tile -- to reduce network overhead incurred if downloading an image larger than required.

1 Like

Thanks!!

Not sure what happened today but 9 hours ago integration did not work anymore. Device got last photo from album 9 hours ago and there was no photos to see, only list of broken photo icons.
Log said:
"Login refresh failed -- status code: 400, reason phrase: Bad Request: [error:invalid_grant, error_description:Token has been expired or revoked.]"

So I need to click "auth link" button once again then allow using photos from google photos, then refresh album list and choose album, and load photos. That's it.

Is there some kind of expiring time that we need to revoke time to time?

Sounds like you've fallen victim to the 7-day auth timeout when a GCP project is in Testing mode -- check here: https://console.cloud.google.com/apis/credentials/consent -- and move to Production if it is not already. There is no need for project verification since your own account is the only user of the project. Once in Production mode, the auth should only be revoked if you explicitly revoke it.

Okay, just to be sure:

This means that I'm publishing it to myself because I have not added other users? So it will not be available to any user with google account unless I add new users with google account?

In Production, it can theoretically be used by any Google user - but they need the OAuth2 credentials in order to use your project. Even in that case, they would be using API quotas against your project, to access data from their Google account. So you're pretty well protected even in this case.

1 Like

Hey @dkilgore90. I have a question for you. Could it be possible to make different refresh interval based on mediatype (photo or video)?

1 Like

I've logged an issue to look into this -- will require some rework in how the refresh is run -- currently it is a static schedule that is set up when the preference is changed.

1 Like

Okay so this happened once again. Noticed that photo was not changing and debug log says:

app:6252021-08-10 13:14:53.802 warnPhoto-get response code: 401, body:
app:6252021-08-10 13:14:53.567 errorLogin refresh failed -- status code: 400, reason phrase: Bad Request: [error:invalid_grant, error_description:Token has been expired or revoked.]
app:6252021-08-10 13:14:53.325 infoRefreshing access_token from Google
app:6252021-08-10 13:14:53.286 warnAuthorization token expired, will refresh and retry.

Went and authorized again and it fixed it. I changed project to public last time but this seems to still occure once a week. Any ideas?

Here's what my console says:

Followed everything but when setting up get this message.

Error 403: access_denied
The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google. If you think you should have access, contact the developer

Think google may have changed its oauth security.

Ran into this, but went to the project settings in google.
Goto OAuth Consent screen. Publishing status will show as testing. While under testing only explicitly named test users are authorized. I just added the user (google gmail ) I was connecting photos as a test user (versus publishing the app to be completely public)

I wouldn't called it completely public. You still need the OAuth Id and a Gmail account to access.

Ive went trough all steps without issues but Ive got stucked on the last step adding image device to dashboard (retrieving image attribute value). Thanks for hint.

Found it. Forget my question.

I tried to setup this App from the GitHub instruction and authorize but I got the below error when trying to hit the "Auth Link". Can anyone help me to fix and get proper authorization? Thanks!

Error 403: access_denied

The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google. If you think you should have access, contact the developer

The content in this section has been provided by the app developer. This content has not been reviewed or verified by Google.

If you’re the app developer, make sure that these request details comply with Google policies.

Disregard the prior response (deleted), I confused myself between this App and the Google SDM API...

In the Google Cloud Console, under APIs and Services, OAuth Consent Screen, the expected state is Production. If in Testing, there are limitations - your email must specifically be added as an authorized user, and tokens expire after 7 days (meaning you would have to re-auth from Hubitat).

Does that mean I have to renew token every 7 days?

Only if your project is in Testing Mode. If you put it in Production Mode, then it will auto-renew indefinitely under the hood.