LAB02-Research / HASS.Agent-Integration

HASS.Agent's Home Assistant integration. Adds notifications and mediaplayer capabilities to HASS.Agent - a Windows based client (companion app) for Home Assistant.
MIT License
101 stars 17 forks source link

Bug: error when sending notification #2

Closed LAB02-Admin closed 1 year ago

LAB02-Admin commented 1 year ago

I've added my device through mqtt autodiscovery. When trying to send a notification, it gives this error:

2022-09-30 10:39:34.130 DEBUG (MainThread) [custom_components.hass_agent.notify] Preparing notification
2022-09-30 10:39:34.130 DEBUG (MainThread) [custom_components.hass_agent.notify] Sending notification
2022-09-30 10:39:34.130 ERROR (MainThread) [homeassistant.components.script.notification_staging_test] Notification - Staging Test: Error executing script. Unexpected error for call_service at pos 1: 'url'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 230, in _async_notify_message_service
    await self.async_send_message(**kwargs)
  File "/config/custom_components/hass_agent/notify.py", line 98, in async_send_message
    if entry.data[CONF_URL] is None:
KeyError: 'url'
2022-09-30 10:39:34.134 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140016872995520] 'url'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 306, in service_handler
    await script_entity.async_turn_on(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 421, in async_turn_on
    await coro
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 451, in _async_run
    return await self.script.async_run(script_vars, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 230, in _async_notify_message_service
    await self.async_send_message(**kwargs)
  File "/config/custom_components/hass_agent/notify.py", line 98, in async_send_message
    if entry.data[CONF_URL] is None:
KeyError: 'url'

I'm guessing something goes wrong because I haven't configured any part of the local API, but it still checks?