From cb43ddc6908295c625724f1e61c6213db0c6e669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ovidiu=20D=2E=20Ni=C8=9Ban?= Date: Fri, 28 Jun 2024 20:09:06 +0300 Subject: [PATCH] Fix for Home Assistant 2024.6.0 (#15) * Convert unique IDs returned by agent_manager.async_get_agent_info to agent IDs * Get entity_id from registry_entry --- .../fallback_conversation/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/custom_components/fallback_conversation/__init__.py b/custom_components/fallback_conversation/__init__.py index 5d2e12b..38f703e 100644 --- a/custom_components/fallback_conversation/__init__.py +++ b/custom_components/fallback_conversation/__init__.py @@ -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