From 3a8d38e298a6077314b80613a36656adac33d9fd Mon Sep 17 00:00:00 2001 From: ionut531 Date: Sun, 6 Sep 2026 16:15:27 +0300 Subject: [PATCH] Fix OptionsFlow AttributeError on Home Assistant 2025.12+ HA 2025.12 finished the deprecation of manually setting OptionsFlow.config_entry in __init__: it is now a read-only property populated by the framework. The old boilerplate pattern now raises: AttributeError: property 'config_entry' of 'TermoAlertOptionsFlowHandler' object has no setter ...on any attempt to open the options/reconfigure dialog (surfaces in the UI as a generic 500 Internal Server Error on the config flow endpoint). Fix: drop the __init__ override and the config_entry argument passed to it in async_get_options_flow(); config_entry is still available via the inherited property everywhere it's read later in the class. Reproduced and fixed against Home Assistant 2026.9.1; the underlying framework change shipped in 2025.12, so this affects every HA version from 2025.12 onward. --- custom_components/termoalert/config_flow.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/custom_components/termoalert/config_flow.py b/custom_components/termoalert/config_flow.py index bbf3bc7..41db567 100644 --- a/custom_components/termoalert/config_flow.py +++ b/custom_components/termoalert/config_flow.py @@ -94,15 +94,18 @@ def async_get_options_flow( config_entry: config_entries.ConfigEntry, ) -> config_entries.OptionsFlow: """Get the options flow for this handler.""" - return TermoAlertOptionsFlowHandler(config_entry) + return TermoAlertOptionsFlowHandler() class TermoAlertOptionsFlowHandler(config_entries.OptionsFlow): - """Handle options for TermoAlert București.""" - - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: - """Initialize options flow.""" - self.config_entry = config_entry + """Handle options for TermoAlert București. + + Note: no __init__ override here. Since Home Assistant 2025.12, + OptionsFlow.config_entry is a read-only property populated + automatically by the framework; assigning to it manually (the old + boilerplate pattern) raises: + AttributeError: property 'config_entry' of '...' object has no setter + """ async def async_step_init( self, user_input: dict[str, Any] | None = None