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

Commit

Permalink
Fix #32: Workaround removed method (#35)
Browse files Browse the repository at this point in the history
* Fix #32: Workaround removed method

* re-implement the removed method
  • Loading branch information
m50 authored Sep 28, 2024
1 parent 499e847 commit 523d91a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions custom_components/fallback_conversation/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."""
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion custom_components/fallback_conversation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 523d91a

Please sign in to comment.