Error for notify service if camera entity does not have an `access_token`
Opened this issue · 0 comments
AngellusMortis commented
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.