Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for notify service if camera entity does not have an access_token #45

Open
AngellusMortis opened this issue Apr 25, 2024 · 0 comments

Comments

@AngellusMortis
Copy link

If a camera entity does not have an access_token attribute, calling the notify service with that camera will result in an error.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 742, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 705, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 275, in _async_notify_message_service
    await self.async_send_message(**kwargs)
  File "/config/custom_components/hass_agent/notify.py", line 81, in async_send_message
    access_token = camera.attributes["access_token"]
                   ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'access_token'

More context. I do not know exact what leads to access_token to not existing, but I am guessing it has something to do with the camera integration running into a timeout fetching the camera image since that seems to be what is happening to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant