Public Access
Merge pull request #15 from Thyraz/options
Fix for changed OptionsFlow in HA
This commit is contained in:
@@ -148,19 +148,16 @@ class GroqConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> OptionsFlow:
|
) -> OptionsFlow:
|
||||||
"""Create the options flow."""
|
"""Create the options flow."""
|
||||||
return GroqOptionsFlow(config_entry)
|
return GroqOptionsFlow()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GroqOptionsFlow(OptionsFlow):
|
class GroqOptionsFlow(OptionsFlow):
|
||||||
"""Groq Cloud config flow options handler."""
|
"""Groq Cloud config flow options handler."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize options flow."""
|
"""Initialize options flow."""
|
||||||
self.config_entry = config_entry
|
self.last_rendered_recommended = False
|
||||||
self.last_rendered_recommended = config_entry.options.get(
|
|
||||||
CONF_RECOMMENDED, False
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
@@ -168,6 +165,9 @@ class GroqOptionsFlow(OptionsFlow):
|
|||||||
"""Manage the options."""
|
"""Manage the options."""
|
||||||
options: dict[str, Any] | MappingProxyType[str, Any] = self.config_entry.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 is not None:
|
||||||
if user_input[CONF_RECOMMENDED] == self.last_rendered_recommended:
|
if user_input[CONF_RECOMMENDED] == self.last_rendered_recommended:
|
||||||
if user_input[CONF_LLM_HASS_API] == "none":
|
if user_input[CONF_LLM_HASS_API] == "none":
|
||||||
|
|||||||
Reference in New Issue
Block a user