Skip to content

Fix OptionsFlowHandler initialization - config_entry is read-only property#30

Merged
Geek-MD merged 2 commits intomainfrom
copilot/fix-aiohttp-request-error
Feb 17, 2026
Merged

Fix OptionsFlowHandler initialization - config_entry is read-only property#30
Geek-MD merged 2 commits intomainfrom
copilot/fix-aiohttp-request-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 17, 2026

OptionsFlowHandler.__init__() attempted to assign self.config_entry = config_entry, but the base class OptionsFlow provides config_entry as a read-only property, causing AttributeError: property 'config_entry' of 'OptionsFlowHandler' object has no setter.

Changes

config_flow.py:

  • Removed config_entry parameter from OptionsFlowHandler.__init__()
  • Removed manual assignment to self.config_entry
  • Added lazy initialization in async_step_init() to load counters from self.config_entry.options on first access
  • Updated async_get_options_flow() to instantiate handler without arguments

Before:

def __init__(self, config_entry: ConfigEntry) -> None:
    self.config_entry = config_entry  # AttributeError here
    self._counters = list(config_entry.options.get("counters", []))

After:

def __init__(self) -> None:
    self._counters: list[dict[str, Any]] = []
    # config_entry is automatically available via base class property

async def async_step_init(self, user_input: dict[str, Any] | None = None) -> FlowResult:
    if not self._counters:
        self._counters = list(self.config_entry.options.get("counters", []))

Version bumped to 1.4.1 with corresponding changelog entry.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Geek-MD <25725990+Geek-MD@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix aiohttp request handling error in version 1.4.1 Fix OptionsFlowHandler initialization - config_entry is read-only property Feb 17, 2026
Copilot AI requested a review from Geek-MD February 17, 2026 12:06
@Geek-MD Geek-MD marked this pull request as ready for review February 17, 2026 12:08
@Geek-MD Geek-MD merged commit c0f1553 into main Feb 17, 2026
3 checks passed
@Geek-MD Geek-MD deleted the copilot/fix-aiohttp-request-error branch February 17, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants