diff --git a/custom_components/fallback_conversation/conversation.py b/custom_components/fallback_conversation/conversation.py index c15f547..9bf5d15 100644 --- a/custom_components/fallback_conversation/conversation.py +++ b/custom_components/fallback_conversation/conversation.py @@ -5,7 +5,7 @@ from homeassistant.components import assist_pipeline, conversation from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant +from homeassistant.core import HomeAssistant, callback from homeassistant.util import ulid from homeassistant.helpers.entity_platform import AddEntitiesCallback from home_assistant_intents import get_languages @@ -30,6 +30,12 @@ CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) +DATA_DEFAULT_ENTITY = "conversation_default_entity" + +@callback +def get_default_agent(hass: HomeAssistant) -> conversation.default_agent.DefaultAgent: + """Get the default agent.""" + return hass.data[DATA_DEFAULT_ENTITY] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback) -> bool: """Set up Fallback Conversation from a config entry.""" @@ -93,12 +99,11 @@ async def async_process( ) -> conversation.ConversationResult: """Process a sentence.""" agent_manager = conversation.get_agent_manager(self.hass) - default_agent = conversation.default_agent.async_get_default_agent(self.hass) + default_agent = get_default_agent(self.hass) agent_names = self._convert_agent_info_to_dict( agent_manager.async_get_agent_info() ) agent_names[conversation.const.HOME_ASSISTANT_AGENT] = default_agent.name - agent_names[conversation.const.OLD_HOME_ASSISTANT_AGENT] = default_agent.name agents = [ self.entry.options.get(CONF_PRIMARY_AGENT, default_agent), self.entry.options.get(CONF_FALLBACK_AGENT, default_agent), diff --git a/custom_components/fallback_conversation/manifest.json b/custom_components/fallback_conversation/manifest.json index 415acb5..e9c9ff4 100644 --- a/custom_components/fallback_conversation/manifest.json +++ b/custom_components/fallback_conversation/manifest.json @@ -14,5 +14,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/m50/ha-fallback-conversation/issues", "requirements": [], - "version": "1.1.0" + "version": "2.0.2" } \ No newline at end of file