Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
[fix] Correct fetching of agent ID, and handle if still unknown (#20)
Browse files Browse the repository at this point in the history
Fixes #17
  • Loading branch information
m50 authored Jul 5, 2024
1 parent 0fe28a9 commit c066e5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions custom_components/fallback_conversation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@ async def async_process(
all_results = []
result = None
for agent_id in agents:
agent_name = "[unknown]"
if agent_id in agent_names:
agent_name = agent_names[agent_id]
else:
_LOGGER.warning("agent_name not found for agent_id %s", agent_id)

result = await self._async_process_agent(
agent_manager,
agent_id,
agent_names[agent_id] or "[unknown]",
agent_name,
user_input,
debug_level,
result,
Expand Down Expand Up @@ -155,8 +161,9 @@ def _convert_agent_info_to_dict(self, agents_info: list[conversation.AgentInfo])
r = {}
for agent_info in agents_info:
agent = agent_manager.async_get_agent(agent_info.id)
agent_id = None
agent_id = agent_info.id
if hasattr(agent, "registry_entry"):
agent_id = agent.registry_entry.entity_id
r[agent_id] = agent_info.name
_LOGGER.debug("agent_id %s has name %s", agent_id, agent_info.name)
return r
2 changes: 1 addition & 1 deletion custom_components/fallback_conversation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/m50/ha-fallback-conversation/issues",
"requirements": [],
"version": "1.0.4"
"version": "1.0.5"
}

0 comments on commit c066e5c

Please sign in to comment.