Update config_flow.py#59
Open
LukaszP2 wants to merge 1 commit into
Open
Conversation
This PR fixes a critical "500 Internal Server Error" in Home Assistant 2024.x/2025.x/2026.x caused by an AttributeError in config_flow.py.
|
Hello, thank you for the PR, could you please TL;DR me a way to reproduce the described issue? |
Author
|
It is when you want to reconfig your settings |
Author
|
I've downloaded 2.1.1 version of the integration but it still works correctly. Could you please check if there are any errors in the logs and show me those if so? |
4 tasks
|
Let's move the investigation to #61 |
|
Could you please try the same? #61 |
v1k70rk4
referenced
this pull request
in v1k70rk4/HASS.Agent.NET10-Integration
Jun 5, 2026
### Summary Full modernization of the HASS.Agent custom integration to ensure compatibility with Home Assistant 2026.x, fix known bugs, and align with current HA development best practices. --- ### 🐛 Bug Fixes - **Fix Configure button 500 error** (PR #59 / Issue #61) — Removed broken `OptionsFlowHandler.__init__` that overwrote the parent without calling `super()`, preventing `self.config_entry` from being injected by the framework. - **Fix notify platform unload error** — The old `"ValueError: Config entry was never loaded!"` is gone because notify now uses standard `async_forward_entry_setups` instead of `discovery.async_load_platform`. - **Fix thumbnail view crash** — Returns 404 instead of crashing with `AttributeError` when an invalid entity ID is requested. ### 🔄 HA 2026.x Compatibility - **`FlowResult` → `ConfigFlowResult` / `OptionsFlowResult`** — Replace deprecated type from `data_entry_flow`. - **`BaseNotificationService` → `NotifyEntity`** — Full rewrite of `notify.py` from legacy service-based pattern to modern entity-based `NotifyEntity` with standard `async_setup_entry`. - **`utcnow()` → `datetime.now(UTC)`** — Replace deprecated `homeassistant.util.dt.utcnow()` with Python 3.11+ native approach. ### ⚡ Performance - **Synchronous `requests` → async `aiohttp`** — All HTTP calls in `__init__.py`, `config_flow.py`, and `notify.py` now use `async_get_clientsession`. The event loop is no longer blocked by synchronous I/O. ### 🛡️ Error Handling - `async_setup_entry` now returns `False` with an error log if the device is unreachable, instead of crashing. - Config flow catches specific `ClientError`/`TimeoutError` instead of bare `Exception`. - Notification HTTP error handling simplified from 60+ line status code switch to concise `response.ok` check. ### 🧹 Code Cleanup - Removed ~15 unused imports (`asyncio`, `Coroutine`, `suppress`, `Path`, `cast`, `SOURCE_IMPORT`, `SERVICE_RELOAD`, `slugify`, `discovery`, `requests`, etc.) - Removed commented-out code blocks (notify unload workaround) - Simplified platform unload to single `async_unload_platforms` call with a list ### 📦 Repository & HACS - All GitHub links updated to `v1k70rk4/HASS.Agent-Integration` - `codeowners` updated to `@v1k70rk4` - HACS version set to `20260601.1` - Minimum HA version bumped to `2024.1`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR fixes a critical "500 Internal Server Error" in Home Assistant 2024.x/2025.x/2026.x caused by an AttributeError in config_flow.py.