fix: Fix OptionsFlowHandler for HA 2024.1+ compatibility

- Remove __init__ method that was passing config_entry as argument
- OptionsFlow now automatically receives config_entry from base class
- Fixes '500 Internal Server Error' when editing existing integrations
This commit is contained in:
SMKRV
2025-12-30 17:10:06 +03:00
parent 0859c35aec
commit 986c78dd90
+1 -5
View File
@@ -473,16 +473,12 @@ class HATextAIConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
@callback @callback
def async_get_options_flow(config_entry: config_entries.ConfigEntry) -> config_entries.OptionsFlow: def async_get_options_flow(config_entry: config_entries.ConfigEntry) -> config_entries.OptionsFlow:
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return OptionsFlowHandler(config_entry) return OptionsFlowHandler()
class OptionsFlowHandler(config_entries.OptionsFlow): class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle options flow.""" """Handle options flow."""
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry
async def async_step_init(self, user_input: Optional[Dict[str, Any]] = None) -> FlowResult: async def async_step_init(self, user_input: Optional[Dict[str, Any]] = None) -> FlowResult:
"""Manage the options.""" """Manage the options."""
if user_input is not None: if user_input is not None: