Skip to content

Commit dd0f834

Browse files
committed
Fix OptionsFlow config_entry setter error in Home Assistant 2024.x+
In Home Assistant 2024.x and later, the OptionsFlow base class provides config_entry as a read-only property. The previous implementation tried to set self.config_entry in __init__, which fails with: AttributeError: property 'config_entry' of 'OpenHASPOptionsFlowHandler' object has no setter This caused a 500 Internal Server Error when clicking the gear icon to configure any openHASP device in the integration settings. Fix: Remove the custom __init__ method and don't pass config_entry to the constructor. The base class automatically provides self.config_entry.
1 parent d82fa8b commit dd0f834

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

custom_components/openhasp/config_flow.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,12 @@ async def async_step_personalize(self, user_input=None):
220220
@callback
221221
def async_get_options_flow(config_entry):
222222
"""Set the OptionsFlowHandler."""
223-
return OpenHASPOptionsFlowHandler(config_entry)
223+
return OpenHASPOptionsFlowHandler()
224224

225225

226226
class OpenHASPOptionsFlowHandler(config_entries.OptionsFlow):
227227
"""ConfigOptions flow for openHASP."""
228228

229-
def __init__(self, config_entry):
230-
"""Initialize openHASP options flow."""
231-
self.config_entry = config_entry
232-
233229
async def async_step_init(self, user_input=None):
234230
"""Manage the options."""
235231
if user_input is not None:

0 commit comments

Comments
 (0)