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

Commit

Permalink
Fix for Home Assistant 2024.6.0 (#15)
Browse files Browse the repository at this point in the history
* Convert unique IDs returned by agent_manager.async_get_agent_info to agent IDs

* Get entity_id from registry_entry
  • Loading branch information
ov1d1u authored Jun 28, 2024
1 parent 6b364bc commit cb43ddc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions custom_components/fallback_conversation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,16 @@ async def _async_process_agent(

return result

def _convert_agent_info_to_dict(self, agents: list[conversation.AgentInfo]) -> dict[str, str]:
def _convert_agent_info_to_dict(self, agents_info: list[conversation.AgentInfo]) -> dict[str, str]:
"""Takes a list of AgentInfo and makes it a dict of ID -> Name."""
r = {}
for agent in agents:
r[agent.id] = agent.name

return r

agent_manager = conversation.get_agent_manager(self.hass)

r = {}
for agent_info in agents_info:
agent = agent_manager.async_get_agent(agent_info.id)
agent_id = None
if hasattr(agent, "registry_entry"):
agent_id = agent.registry_entry.entity_id
r[agent_id] = agent_info.name
return r

0 comments on commit cb43ddc

Please sign in to comment.