I have seen many times people saying they wish they could control their devices with the built in conversation agent in Home Assistant, but then forward other requests to ChatGPT (for example), and after not seeing anyone else do it, I decided to dip my toes into writing my first ever Home Assistant custom component: Fallback Conversation Agent.
Here’s an example of it in use (with some debugging enabled to make it clear):
Features
This custom component allows you to use two conversation agents, falling back if your primary agent fails to handle the intent.
An example use case of this is to use the built-in Home Assistant conversation agent to handle manipulating devices, but then fallback to using ChatGPT for example to handle general questions such as the capital of a country or measurement conversions.
The options provide 3 debug levels:
No Debug: This silently handles fallback, and pipes back the raw response to you.
Low Debug: This will add information such as what agent is responding to the response. This way you can determine if fallback is working as you expect.
Verbose Debug: Will provide you with more information, including the error of the previous response.
For now, this only allows a primary and a fallback conversation agent, but I do plan on adding the ability to have a list so you can specify as many as you’d like, but I figured I’d let people have access to it in the meantime, and get some feedback.
Installation
Install via registering as a custom repository of HACS or by copying the fallback_conversation folder into <config>/custom_components.
Restart Home Assistant.
Go to Settings > Devices & Services.
In the bottom right corner, select the Add Integration button.
Set a name and your preferred debug level.
Click on Fallback Conversation Agent and select Configure on your created agent.
Set the primary and fallback conversations agents from the list.
Go to Settings > Voice Assistants.
Click to edit Assistant (named “Home Assistant” by default).
Select the name of your Fallback Conversation Agent from the “Conversation agent” tab
The most recent update (to v1.1.0) of this Integration mentioned that we would need to go back into the Integration settings menu of HA, hit ‘configure’, then ‘submit’.
Thank you @marisa !
Even though this was introduced in 2024.12.1, I still installed your component, because unlike yours, the official fallback doesn’t work in the REST API.
I know this repo is not maintained but the inbuilt fallback behaves poorly for me. I find it just uses the primary. The Secondary works, but it never falls back.
My scenario is I have two Ollama hosts at home. One on my Gaming PC (that’s not always on) and one on my server. I want to use the former and fall back to the server that has an older GPU and a smaller model loaded.
I tried installing this repo in a custom repo in HACS but nothing happens when I click add.
Is there any way to get this to work with out-of-the-box fallback?