daanoz / ha-google-photos Goto Github PK
View Code? Open in Web Editor NEWHome Assistant Google Photos integration
License: MIT License
Home Assistant Google Photos integration
License: MIT License
Hello,
after I set up Google Photos again, everything works for about 1 day and the pictures are displayed. After approx. 1 day. no more pictures are displayed. No error message or similar appears. I have already set up google photos several times and even created new login details.
Unfortunately I have not found any other case for this problem. Can anyone here help me?
v0.6.2
I have the update interval set at 10 seconds and crop mode set as Combine, and this uses up all the request quota of the Photos API in around 15 hours (Photos API allows 10,000 requests per day). Is there any way to reduce the number of API calls that are happening without increasing the update interval, so I can keep it running 24/7 please? Any more caching that could be implemented?
The error handling around this also isn't great. It starts spamming the logs with the below error even after I set the update interval to Never.
2024-04-14 00:38:33.201 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 88, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 823, in get
return await self.handle(request, camera)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 841, in handle
image = await _async_get_image(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 192, in _async_get_image
else await camera.async_camera_image(width=width, height=height)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/google_photos/camera.py", line 145, in async_camera_image
return await self.coordinator.get_media_data(width, height)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/google_photos/coordinator.py", line 262, in get_media_data
result = await self._get_combined_media_data(width, height)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/google_photos/coordinator.py", line 309, in _get_combined_media_data
await self._get_media_by_id(secondary_media.get("id")),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/google_photos/coordinator.py", line 349, in _get_media_by_id
return await self.hass.async_add_executor_job(_get_media_item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/google_photos/coordinator.py", line 347, in _get_media_item
return service.mediaItems().get(mediaItemId=media_id).execute()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/googleapiclient/http.py", line 938, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 429 when requesting https://photoslibrary.googleapis.com/v1/mediaItems/AGd-TmPZTJYyIJTBT6e70Ohn1n1qXRf2H_SQstaTN7rxtNfKOrN_-ojM8cF-2W9OXYVW40PpCNbf5GxDPw_mY1NE_9vwY77bnQ?alt=json returned "Quota exceeded for quota metric 'All requests' and limit 'All requests per day' of service 'photoslibrary.googleapis.com' for consumer 'project_number:608688248141'.". Details: "[{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'RATE_LIMIT_EXCEEDED', 'domain': 'googleapis.com', 'metadata': {'quota_metric': 'photoslibrary.googleapis.com/all_requests', 'quota_limit_value': '10000', 'quota_location': 'global', 'consumer': 'projects/608688248141', 'service': 'photoslibrary.googleapis.com', 'quota_limit': 'ApiCallsPerProjectPerDay'}}, {'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Request a higher quota limit.', 'url': 'https://cloud.google.com/docs/quota#requesting_higher_quota'}]}]">
Is your feature request related to a problem? Please describe.
I've successfully set up this google photos album integration to pull a random image and show it as a dashboard background using wallpanel. It works perfectly when viewing in a web browser, but when I cast it to a google nest hub using HA's built in casting functionality, the background image does not display on a nest hub. It appears that the google nest hub does not allow for the same type of link that the google photo album entity integration provides.
Describe the solution you'd like
Extend support for a rotating google photo to be used as a dashboard background image when casting to google nest hub
Describe alternatives you've considered
I've attempted to set a rotating google image as a background image in a dashboard view vs setting it as a wallpanel image. Neither solution works when casting to a google nest hub.
Here's the dashboard definition that works on a web browser but does not show a background image when cast to a nest hub.
`
wallpanel:
enabled: true
hide_toolbar: true
hide_sidebar: true
fullscreen: false
fade_in_time: 2
crossfade_time: 2
image_url: media-entity://camera.google_photos_foo_media
image_order: random
display_time: 300
show_images: true
image_background: image
image_animation_ken_burns: true
image_fit: contain
cards:
- type: custom:digital-clock
- initial_view: listWeek
type: calendar
entities:
- calendar.family
card_interaction: true
views:
`
Is your feature request related to a problem? Please describe.
Home-Assistant 2023.7 added support for Image Entity...
https://www.home-assistant.io/blog/2023/07/05/release-20237/#image-entities
Describe the solution you'd like
Migrate from Camera entity to image entitty. Hopefully this will reduce complexity and allow for new cooler features going forward.
Hello,
I try to install the ha google photo plugin,
I followed the github procedure, I created a client with id and secret code, activated api, ...
all was fine until the oauth screen : when I click on my google account and accept the conditions, I receive this screen :
[https://www.googleapis.com/auth/userinfo.email&authuser=0&prompt=consent]
**
You are receiving this error either because your input OAuth2 scope name is invalid or it refers to a newer scope that is outside the domain of this legacy API.
This API was built at a time when the scope name format was not yet standardized. This is no longer the case and all valid scope names (both old and new) are catalogued at https://developers.google.com/identity/protocols/oauth2/scopes. Use that webpage to lookup (manually) the scope name associated with the API you are trying to call and use it to craft your OAuth2 request.
**
latest
Can someone tell me what I did wrong?
Thanks in advance,
-->Michaël
Cannot load in the newest version (beta)
Get the following log:
Logger: homeassistant.setup
Source: setup.py:209
First occurred: 17.47.01 (1 occurrences)
Last logged: 17.47.01
Setup failed for custom integration google_photos: Requirements for google_photos not found: ['pillow>=9.1.1,<10.0.0'].
I have zero idea how possible it is, but it'd be cool to have the ability to use your albums as a background and/or screensaver.
Also, (I may have missed this), but, maybe the possibility to combine albums into one "slideshow". I know you can have multiple cards/multiple albums, but a combine line would be nice; use_album: album1, album 2. I dunno. Anyways, great work. Cheers.
When choosing "Select Album" from the configuration menu I'm prompted with an "Error" dialogue, no additional information is provided. I'm other able to successfully authenticate ha-google-photos and see my favorite photos.
Release version v0.4.0
Logger: aiohttp.server
Source: custom_components/google_photos/config_flow.py:148
Integration: Google Photos (documentation, issues)
First occurred: 1:15:40 PM (2 occurrences)
Last logged: 1:15:48 PM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 67, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 241, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 267, in async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/google_photos/config_flow.py", line 176, in async_step_albumselect
data_schema = await self._get_albumselect_schema()
File "/config/custom_components/google_photos/config_flow.py", line 148, in _get_albumselect_schema
album_selection[album["id"]] = album["title"]
KeyError: 'title'
0.4.4
After CONFIGURE, and SELECT ALBUM, it spins for a second and then says "Error".
P.S. Thanks for the integration - it's great, and much cleaner than the brutal hack I was doing before.
Apr 01 17:01:23 archlinux hass[626391]: 2023-04-01 17:01:23.357 ERROR (MainThread) [aiohttp.server] Error handling request
Apr 01 17:01:23 archlinux hass[626391]: Traceback (most recent call last):
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
Apr 01 17:01:23 archlinux hass[626391]: resp = await request_handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
Apr 01 17:01:23 archlinux hass[626391]: resp = await handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
Apr 01 17:01:23 archlinux hass[626391]: return await handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/security_filter.py", line 67, in security_filter_middleware
Apr 01 17:01:23 archlinux hass[626391]: return await handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
Apr 01 17:01:23 archlinux hass[626391]: return await handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
Apr 01 17:01:23 archlinux hass[626391]: return await handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/ban.py", line 80, in ban_middleware
Apr 01 17:01:23 archlinux hass[626391]: return await handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/auth.py", line 234, in auth_middleware
Apr 01 17:01:23 archlinux hass[626391]: return await handler(request)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/view.py", line 146, in handle
Apr 01 17:01:23 archlinux hass[626391]: result = await result
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/config/config_entries.py", line 241, in post
Apr 01 17:01:23 archlinux hass[626391]: return await super().post(request, flow_id)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/data_validator.py", line 72, in wrapper
Apr 01 17:01:23 archlinux hass[626391]: result = await method(view, request, data, *args, **kwargs)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/helpers/data_entry_flow.py", line 110, in post
Apr 01 17:01:23 archlinux hass[626391]: result = await self._flow_mgr.async_configure(flow_id, data)
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/data_entry_flow.py", line 267, in async_configure
Apr 01 17:01:23 archlinux hass[626391]: result = await self._async_handle_step(
Apr 01 17:01:23 archlinux hass[626391]: File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
Apr 01 17:01:23 archlinux hass[626391]: result: FlowResult = await getattr(flow, method)(user_input)
Apr 01 17:01:23 archlinux hass[626391]: File "/home/hassio/.homeassistant/custom_components/google_photos/config_flow.py", line 192, in async_step_albumselect
Apr 01 17:01:23 archlinux hass[626391]: data_schema = await self._get_albumselect_schema()
Apr 01 17:01:23 archlinux hass[626391]: File "/home/hassio/.homeassistant/custom_components/google_photos/config_flow.py", line 163, in _get_albumselect_schema
Apr 01 17:01:23 archlinux hass[626391]: album["title"], album["mediaItemsCount"]
Apr 01 17:01:23 archlinux hass[626391]: KeyError: 'mediaItemsCount'
Hello!
I am using your (amazing) integration for my lovelace wallpanel screensaver on a Pixel Tablet.
I tried to troubleshoot why my pictures were blurry, and after some tests I believe it is because the integration is downloading pictures with a resolution based on the CSS resolution (1280x800) instead of the device pixel resolution (2560x1600)
I confirmed this by enabling the debug log and looking at the picture downloaded.
Is that something you can fix on your end? I'm not sure if it is an issue with camera entity in HA or with your camera code, as I do not know how the width/height of the screen is retrieved.
Either way, I'm open to suggestions if a fix is not possible in the integration.
Thanks!
Is your feature request related to a problem? Please describe.
no
Describe the solution you'd like
With recent versions HA Core does provide an Image entity.
It would be great, if this integration would also support this new entity type, rather than a camera image
Describe alternatives you've considered
none
Additional context
support propper "image entity" for images - camera entity should be used for cameras, where the image does change based on a camera stream
After installing the integration from HACS and attempting to add the integration, I get to the final step when I link it to my home assistant url I select the link and then I get a popup that says "Error". Any help would be greatly appreciated as I am really excited to get this integration working!
Here is the only log I am finding;
This error originated from a custom integration.
Logger: aiohttp.server
Source: custom_components/google_photos/config_flow.py:87
Integration: Google Photos (documentation, issues)
First occurred: 1:00:08 PM (2 occurrences)
Last logged: 1:04:42 PM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 67, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 234, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 171, in get
return await super().get(request, flow_id)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 96, in get
result = await self._flow_mgr.async_configure(flow_id)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 271, in async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 332, in async_step_creation
return await self.async_oauth_create_entry(
File "/config/custom_components/google_photos/config_flow.py", line 99, in async_oauth_create_entry
(await self.hass.async_add_executor_job(_check_photoslibrary_access))
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/google_photos/config_flow.py", line 87, in _check_photoslibrary_access
lib = build(
File "/usr/local/lib/python3.10/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
TypeError: build() got an unexpected keyword argument 'static_discovery'
I will be great to have location info in attribiutes. Can you add this?
hi my google photos says that it is unavailable.
i have tried to restart home assistant without any luck.
it worked yesterday but today it dosent.
Support for shared albums and a bit better error handling (account with no albums)
def get_albums() -> List[Album]:
album_list = []
service: PhotosLibraryService = get_photoslibrary()
albums = service.albums() # pylint: disable=no-member
fields = "albums(id,title,mediaItemsCount),nextPageToken"
request = albums.list(pageSize=50, fields=fields)
while request is not None:
result = request.execute()
album_list = album_list + result.get("albums", [])
request = albums.list_next(request, result)
sharedAlbums = service.sharedAlbums() # pylint: disable=no-member
fields = "sharedAlbums(id,title,mediaItemsCount),nextPageToken"
request = sharedAlbums.list(pageSize=50, fields=fields)
while request is not None:
result = request.execute()
album_list = album_list + result.get("sharedAlbums", [])
request = sharedAlbums.list_next(request, result)
return list(filter(lambda a: ("id" in a and "title" in a), album_list))
albums = await self.hass.async_add_executor_job(get_albums)
album_selection = dict({CONF_ALBUM_ID_FAVORITES: "Favorites"})
for album in albums:
album_selection[album.get("id")] = "{0} ({1} items)".format(
album.get("title"), album.get("mediaItemsCount", "?")
)
Is your feature request related to a problem? Please describe.
As for now, we have to create one set of entities for each album if we want access different albums. And so, we've got lots of different lovelace card that we can show or hide but it's not very convinient. It should include also the shared albums.
Describe the solution you'd like
A unique set of entities for all the selected (at integratoin level) albums with different options for the next media :
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
I don't use favorite. I prefer to create album for every occasions.
Hello,
I was setting this up last night and in my tired state of mind, I accidently tried to link it to the wrong Google OAuth Credentials. Now when I try to redo the setup process it automatically links to the wrong creds and gives me the "Access blocked: This app’s request is invalid".
I have uninstalled the integration manually and via HA UI. I even tried to reset the OAuth credentials in the Google Cloud page, and nothing is allowing me to redo the OAuth Credential setup.
Any Ideas?
Version: v0.5.0
0.4.3
Add your logs here.
Adding the Integrations work fine, i can see the two test images i have in favorites. Changing to the desired album (name fotoram 210130 till 230325) submits as okey, but then all sensors become unavailble.
Logger: homeassistant.components.select
Source: custom_components/google_photos/coordinator.py:67
Integration: Select (documentation, issues)
First occurred: 10:35:20 (1 occurrences)
Last logged: 10:35:20
Error while setting up google_photos platform for select
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/google_photos/coordinator.py", line 452, in _async_update_data
await self.update_data()
File "/home/homeassistant/.homeassistant/custom_components/google_photos/coordinator.py", line 366, in update_data
await self._refresh_album_list()
File "/home/homeassistant/.homeassistant/custom_components/google_photos/coordinator.py", line 435, in _refresh_album_list
await self._get_album_list()
File "/home/homeassistant/.homeassistant/custom_components/google_photos/coordinator.py", line 424, in _get_album_list
self.album_list = await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/google_photos/coordinator.py", line 442, in _async_update_data
async with async_timeout.timeout(30):
File "/srv/homeassistant/venv_3.11.0/lib/python3.11/site-packages/async_timeout/__init__.py", line 129, in __aexit__
self._do_exit(exc_type)
File "/srv/homeassistant/venv_3.11.0/lib/python3.11/site-packages/async_timeout/__init__.py", line 212, in _do_exit
raise asyncio.TimeoutError
TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/srv/homeassistant/venv_3.11.0/lib/python3.11/site-packages/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/homeassistant/.homeassistant/custom_components/google_photos/coordinator.py", line 454, in _async_update_data
raise UpdateFailed(f"Error communicating with API: {err}") from err
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/srv/homeassistant/venv_3.11.0/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
await asyncio.shield(task)
File "/home/homeassistant/.homeassistant/custom_components/google_photos/select.py", line 34, in async_setup_entry
coordinator = await coordinator_manager.get_coordinator(album_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/homeassistant/.homeassistant/custom_components/google_photos/coordinator.py", line 67, in get_coordinator
await self.coordinator_first_refresh.get(album_id)
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API:
Can you show me how to add info from atribute to wallpanel?
I submitted by error different google API credentials, it means, another client ID & Client Secret.
If you desinstall and re install the integration, in somewhere was saved the credentials and it's not possible to update to the correct ones.
Now when I search the NEW integration and select google photos, this is the first page:
and, of course, since the project is incorrect (this project has been deleted), google returns an error:
what I want to do is to have the original first page when credentials are requested and insert now the correct Client ID & Client Secret.
Is your feature request related to a problem? Please describe.
N/A
Describe the solution you'd like
Nice integration! I'd like to be able to display where a photo was taken on my dashboard. I see the metadata options and see the camera information. I've checked in Google Photos and the location information is available on the photos in question.
Describe alternatives you've considered
Doesn't seem to be any.
Additional context
N/A
Hello all,
Running into an issue with this integration now, unfortunately.
It was working fine for the longest time, but then it ended up getting "Stuck" on a single photo. I decided to reload the integration and that's when it stopped working entirely.
I rebooted - no luck.
I then deleted the integration (including creds) and tried to re-add it. Now I'm getting a weird API related error.
The setup was done as per the documents, and as mentioned, was working fine previously.
The OAuth creds are correct, I just re-added them for the new setup of the integration.
I tried to create new OAuth Credentials, but still getting the same error...
v0.4.1
There's no configuration to post. Installed via HACS, error occurs while trying to add the integration in settings.
I'm running Home Assistant v2023.1.7 as a Docker container.
After installing the component via HACS, I tried to add a new integration via Settings / Devices & Services / + Add Integration
, I see the error below in the logs regarding a conflict with pillow
. The Google Photos integration specifies an exact version for pillow (9.4.0), while the Docker image for homeassistant has pillow 9.3.0 installed. The requirements_all.txt
for homeassistant v2023.1.7 has pillow==9.3.0
specified, so that's the source of the conflicting requirement.
2023-03-06 13:55:32.418 INFO (SyncWorker_58) [homeassistant.util.package] Attempting install of pillow==9.4.0
2023-03-06 13:55:32.402 ERROR (SyncWorker_58) [homeassistant.util.package] Unable to install package pillow==9.4.0: ERROR: Cannot install pillow==9.4.0 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
[notice] A new release of pip available: 22.3 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
v0.6.2
Error thrown when calling next_media.
2024-05-01 23:54:52.984 WARNING (SyncWorker_0) [homeassistant.helpers.frame] Detected that custom integration 'google_photos' calls async_create_task from a thread at custom_components/google_photos/camera.py, line 135: self.hass.async_add_job(self.coordinator.select_next(mode)), please report it to the author of the 'google_photos' custom integration
2024-05-01 23:54:52.986 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Detected that custom integration 'google_photos' calls async_create_task from a thread at custom_components/google_photos/camera.py, line 135: self.hass.async_add_job(self.coordinator.select_next(mode)). Please report it to the author of the 'google_photos' custom integration.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/google_photos/camera.py", line 135, in next_media
self.hass.async_add_job(self.coordinator.select_next(mode))
File "/usr/src/homeassistant/homeassistant/core.py", line 645, in async_add_job
return self.async_create_task(target, eager_start=eager_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 816, in async_create_task
self.verify_event_loop_thread("async_create_task")
File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
frame.report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
_report_integration(what, integration_frame, level, error_if_integration)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
raise RuntimeError(
RuntimeError: Detected that custom integration 'google_photos' calls async_create_task from a thread at custom_components/google_photos/camera.py, line 135: self.hass.async_add_job(self.coordinator.select_next(mode)). Please report it to the author of the 'google_photos' custom integration.
2024-05-01 23:54:52.989 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281472507413696]
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 793, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1731, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 503, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 533, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/google_photos/camera.py", line 135, in next_media
self.hass.async_add_job(self.coordinator.select_next(mode))
File "/usr/src/homeassistant/homeassistant/core.py", line 645, in async_add_job
return self.async_create_task(target, eager_start=eager_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 816, in async_create_task
self.verify_event_loop_thread("async_create_task")
File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
frame.report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
_report_integration(what, integration_frame, level, error_if_integration)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
raise RuntimeError(
RuntimeError: Detected that custom integration 'google_photos' calls async_create_task from a thread at custom_components/google_photos/camera.py, line 135: self.hass.async_add_job(self.coordinator.select_next(mode)). Please report it to the author of the 'google_photos' custom integration.
Is your feature request related to a problem? Please describe.
I'd like to show a carousel of Google Photos in my Home Assistant dashboard on my camper van while I'm traveling with intermittent connectivity.
Describe the solution you'd like
I'd like to push a button to have the integration synchronize an offline copy of a particular Google Photos album. Once that's done, all of the photos and their metadata would be retrieved from the local filesystem without hitting the network.
If the button is modeled as a home assistant entity, then I could also write an automation to periodically initiate a sync when the network is available under appropriate conditions.
Alternatively, the integration could download the photos directly into the home assistant Local Media directory.
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'}}]">
Solved : I could not reuse the old settings because that was not configured as a webapplication
I try to install this integration.
I allready had a google id with credentials for home assistant . So I added the google photo api to that.
After downloading the integration in home assistant and restarting HASS I want to add the integration.
When I add name and credentials I click continue. The error I get is : You cannot login because this app send a invalid request. Try again later or send a message to the developer about this problem.
Error:400: redirect_uri_mismatch
I am not sure I use the correct name, but I suppose I have to use OAuth 2.0 Client IDs name ?
Tried the name on the Oauth consent screen too
Version Home assistant
Home Assistant 2023.9.2
Supervisor 2023.10.0
Operating System 10.5
Frontend 20230911.0 - latest
I am running Home Assistant on a virtual machine
I am sorry when this topic does not meet all requirement to add a new issue but I am hoping this information is enough to solve this problem
Hello -
My API settings changed and I need to re-enter them. I have removed and reinstalled the HACS & Integrations, but don't have the ability to enter the new info.
When I install the new Integration it launches the Google page (https://accounts.google.com/signin/oauth/error/v2?authError...)
How do I update it?
I really appreciate any advice.
Many thanks,
N.
At the final step of authenticating through Google I received this error pop-up
"Failed to query google api: Request had insufficient authentication scopes."
FIXED by...
-- Add Scope to View for Photos API ('sensitive' unfortunately)
-- Revert publishing status to "Testing" (otherwise proceed through a verification process)
-- Add myself as a Test User
First time I've used Google's API's so, its very likely I missed something from your instructions.
Your instructions were great -- and this addon was exactly what I needed!! Thank you
gives an error when trying to select an album no list is shown
2023-06-12 16:54:08.633 DEBUG (MainThread) [custom_components.google_photos.config_flow] async_albumselect_confirm called with user_input: None
2023-06-12 16:54:08.642 INFO (SyncWorker_15) [googleapiclient.discovery_cache] file_cache is only supported with oauth2client<4.0.0
2023-06-12 16:54:08.642 DEBUG (SyncWorker_15) [googleapiclient.discovery] URL being requested: GET https://www.googleapis.com/discovery/v1/apis/photoslibrary/v1/rest
2023-06-12 16:54:08.961 DEBUG (SyncWorker_15) [googleapiclient.discovery] URL being requested: GET https://photoslibrary.googleapis.com/v1/albums?pageSize=50&fields=albums%28id%2Ctitle%2CmediaItemsCount%29%2CnextPageToken&alt=json
2023-06-12 16:54:09.548 DEBUG (SyncWorker_15) [googleapiclient.discovery] Next page request URL: list_next https://photoslibrary.googleapis.com/v1/albums?pageSize=50&fields=albums%28id%2Ctitle%2CmediaItemsCount%29%2CnextPageToken&alt=json&pageToken=CkQKPnR5cGUuZ29vZ2xlYXBpcy5jb20vZ29vZ2xlLnBob3Rvcy5saWJyYXJ5LnYxLkxpc3RBbGJ1bXNSZXF1ZXN0EgIIMhLMAUFIX3VRNDNELXdhSmNBUzZDTUlJd0VHanRxSEJfQWlSUHQ1R0pQTkpNWkJtdHRJdGJfUWJxSnlzV1d1ZnU1NkM2N1FUSVkyZ3l3ZkhGSmNHbGl5MnRkNEl2T3h1NGhxRzNYMUpBc29rb1hqaERWaEZaWjc0b2N4UjJqdVNMcmNGSVQzM0hHeC1XMTUybVNPYzlEeFl5X0czZWxlQUwtUXllakZ5djc5a29WVTUzZmRGT2E1a00zTklMUUJNQkp6NER1T05i
Home Assistant version: Home Assistant 2023.4.2
Plugin version: v0.5.0
The picture entity works fine when the dashboard is displayed via a browser or the mobile app. However, when it's casted pictures don't appear.
This issue only occurs with Google Photos picture entities, other picture entities work fine. I've tested this with my security cameras.
While trying to debug on the browser (where the image is displayed correctly), I noticed that the URL that is used to load the picture shows an error on the browser's developer tools. The type of the file is not recognized as an image.
After that, there's another request that has a type x-mixed-replace that apparently contains the image data. I'm not sure what else I can do to help debug.
Let me know if you have any questions.
Hello,
I've experienced a strange behavior when using "Original" mode. On "Crop" mode it seems fine, pictures get cropped at the view container size, however on "Original" mode, pictures get resized to either the fallback width or height values (1024 x 512 px) (values in code. This leads to seriously blurry pictures.
I tried manually changing the values to 3000x3000 just to test, and indeed it now generates much clearer pictures.
Do you think it might be a good idea to increase these fallback values or would there be a reason not to?
Thanks a lot!
V0.4.4
configured through UI
All sensors seem to become unavailable on occasion. Once they become available again, the current photo resets to the same one every time. Sometimes it seems like opeing the entity/device page in the frontend can trigger this. The debug logs do not seem to show any activity during the event,yet the device logs do as in screenshots attached.
Use case: I'm using this intergration with wallpanel to have a screensaver photo that updates daily at 04:00 via a service call automation. This seems to work perfectly, but then at some stage during the day the displayed photo reverts to the original one. This hapened with the previous version as well as latest.
2023-03-30 03:29:26.838 DEBUG (SyncWorker_6) [googleapiclient.discovery] URL being requested: GET https://photoslibrary.googleapis.com/v1/mediaItems/AMrVKRFzNtwJT4tchGK9ypqykPAvXAjWb1Z06JRjxrMLhBiQBCA-KpEabkpgvQom6CyfoZX9P5vJbjhR4xDLs3UV2WYmcoqLDQ?alt=json
2023-03-30 03:29:43.202 DEBUG (SyncWorker_3) [googleapiclient.discovery] URL being requested: GET https://photoslibrary.googleapis.com/v1/mediaItems/AMrVKREQ8Oog8B1mt0Uqg3e9d7_3yqQJorVfF2Y-tbQr0nGZGYbYl10DKS2VNwQkok5CkjndYjDI?alt=json
2023-03-30 03:29:52.456 DEBUG (SyncWorker_4) [googleapiclient.discovery] URL being requested: GET https://photoslibrary.googleapis.com/v1/mediaItems/AMrVKREg4SH2t61HgJRPf0-y5nX_2gS8mrx3oFwBa_SfVlvsdwLkPkJthi8Az6mJfxWqtYIMs4KglLa0kZdqWP5sMl9LMDqOvw?alt=json
Add your logs here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.