Daanoz / ha-google-photos

Home Assistant Google Photos integration
MIT License
84 stars 5 forks source link

Feature/Improvement - Verify Google Photos Library API is enabled during the inital config #9

Closed stboch closed 1 year ago

stboch commented 1 year ago

Is your feature request related to a problem? Please describe. If a user hasn't enabled Photos Library API prior to use a non-descript error is presented when selecting albums. Add a verification of Google Photo API enabled while still in config flow for ease of use.

Describe the solution you'd like Verify Google Photo Library API is enabled if not pass the URL for enabling to user and wait for retest after user enables the API.

Describe alternatives you've considered At minimum raise the error in the UI during the Select Album config interface.

Additional context googleapiclient.errors.HttpError: <HttpError 403 when requesting https://photoslibrary.googleapis.com/v1/albums?pageSize=50&alt=json returned "Photos Library API has not been used in project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/photoslibrary.googleapis.com/overview?project= then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.". Details: "[{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Google developers console API activation', 'url': 'https://console.developers.google.com/apis/api/photoslibrary.googleapis.com/overview?project=421627846401'}]}, {'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'SERVICE_DISABLED', 'domain': 'googleapis.com', 'metadata': {'consumer': 'projects/421627846401', 'service': 'photoslibrary.googleapis.com'}}]">

Daanoz commented 1 year ago

Good suggestion! I've added some diagnostic error messaging during the setup phase.