Fix for changed OptionsFlow in HA

Model options weren't accessible anymore due to changes in HA. This commit applies the needed changes.
This commit is contained in:
Thyraz
2025-12-10 21:24:37 +01:00
parent e041e8d936
commit cfcad1383b
@@ -148,19 +148,16 @@ class GroqConfigFlow(ConfigFlow, domain=DOMAIN):
config_entry: ConfigEntry,
) -> OptionsFlow:
"""Create the options flow."""
return GroqOptionsFlow(config_entry)
return GroqOptionsFlow()
class GroqOptionsFlow(OptionsFlow):
"""Groq Cloud config flow options handler."""
def __init__(self, config_entry: ConfigEntry) -> None:
def __init__(self) -> None:
"""Initialize options flow."""
self.config_entry = config_entry
self.last_rendered_recommended = config_entry.options.get(
CONF_RECOMMENDED, False
)
self.last_rendered_recommended = False
async def async_step_init(
self, user_input: dict[str, Any] | None = None
@@ -168,6 +165,9 @@ class GroqOptionsFlow(OptionsFlow):
"""Manage the options."""
options: dict[str, Any] | MappingProxyType[str, Any] = self.config_entry.options
if user_input is None:
self.last_rendered_recommended = options.get(CONF_RECOMMENDED, False)
if user_input is not None:
if user_input[CONF_RECOMMENDED] == self.last_rendered_recommended:
if user_input[CONF_LLM_HASS_API] == "none":
@@ -271,4 +271,4 @@ class InvalidAPIKey(exceptions.HomeAssistantError):
class ModelNotFound(exceptions.HomeAssistantError):
"""Model can't be found in the GroqCloud model's list."""
"""Model can't be found in the GroqCloud model's list."""