Persist an empty LLM API selection in OpenAI Conversation (#179893)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Paulus Schoutsen
2026-08-23 12:53:41 +02:00
committed by GitHub
co-authored by Claude
parent 26b3d95441
commit 1fb1057c73
2 changed files with 20 additions and 1 deletions
@@ -309,7 +309,7 @@ class OpenAISubentryFlowHandler(ConfigSubentryFlow):
] = bool
if user_input is not None:
if not user_input.get(CONF_LLM_HASS_API):
if user_input.get(CONF_LLM_HASS_API) is None:
user_input.pop(CONF_LLM_HASS_API, None)
if user_input[CONF_RECOMMENDED]:
@@ -647,6 +647,25 @@ async def test_form_invalid_auth(hass: HomeAssistant, side_effect, error) -> Non
@pytest.mark.parametrize(
("current_options", "new_options", "expected_options"),
[
( # Test clearing every llm api is stored as an empty list
{
CONF_RECOMMENDED: True,
CONF_LLM_HASS_API: ["assist"],
CONF_PROMPT: "",
},
(
{
CONF_RECOMMENDED: True,
CONF_LLM_HASS_API: [],
CONF_PROMPT: "",
},
),
{
CONF_RECOMMENDED: True,
CONF_LLM_HASS_API: [],
CONF_PROMPT: "",
},
),
( # Test converting single llm api format to list
{
CONF_RECOMMENDED: True,