-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Add config flow to Entur #158160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Add config flow to Entur #158160
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…s be in the native language
|
Hey there @hfurubotten, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds GUI configuration support to the Entur public transport integration, enabling users to set up and configure the integration through the Home Assistant UI instead of requiring YAML configuration. The integration is also upgraded from legacy to bronze quality scale.
Key changes:
- Added config flow with validation and error handling for GUI-based setup
- Added options flow to allow users to modify settings after initial setup
- Implemented DataUpdateCoordinator for efficient, centralized data polling
- Added YAML import support with deprecation notices (scheduled for removal in 2027.1.0)
- Comprehensive test coverage for all new functionality
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/entur_public_transport/__init__.py |
Added config entry setup/unload functions and options update listener |
homeassistant/components/entur_public_transport/config_flow.py |
New config flow implementation with user flow, import flow, and options flow |
homeassistant/components/entur_public_transport/const.py |
Centralized constants for configuration keys, icons, and attributes |
homeassistant/components/entur_public_transport/coordinator.py |
New DataUpdateCoordinator for efficient API polling and data management |
homeassistant/components/entur_public_transport/sensor.py |
Refactored to use config entries and coordinator pattern, added YAML import trigger |
homeassistant/components/entur_public_transport/strings.json |
Translation strings for config flow, options flow, and repair issues |
homeassistant/components/entur_public_transport/manifest.json |
Updated to enable config_flow, set quality_scale to bronze, added integration_type |
homeassistant/components/entur_public_transport/quality_scale.yaml |
Quality scale rule tracking for bronze certification |
tests/components/entur_public_transport/__init__.py |
Test module initialization |
tests/components/entur_public_transport/conftest.py |
Test fixtures for config entries, mock clients, and integration setup |
tests/components/entur_public_transport/test_config_flow.py |
Comprehensive config flow tests covering all flows and error cases |
tests/components/entur_public_transport/test_init.py |
Integration setup, unload, reload, and options update tests |
tests/components/entur_public_transport/test_sensor.py |
Sensor entity tests for states, attributes, and edge cases |
script/hassfest/quality_scale.py |
Removed entur_public_transport from legacy exemption lists |
CODEOWNERS |
Added test directory to codeowners (missing new codeowner in this PR) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The quality_scale upgrade from legacy to bronze should be done in a separate PR. This reverts the quality_scale changes while keeping the config flow implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Catch TimeoutError and ClientError specifically for connection errors - Fall back to bare exception for unexpected errors with 'unknown' error - Add tests for timeout, connection error, and unknown error cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
…andling - Move platform expansion to _async_setup method for one-time initialization - Add bare exception catch for unexpected errors during expansion - Fix test attribution to match actual library output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
|
I now tested this locally and it works fine. It successfully imported my old yaml config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are making quite a lot of changes - some of which can be done in preliminary PRs (eg. codeowner or integration type) and some of which can be done in follow-up PRs (eg. coordinator)
This makes the PR bigger than it needs to be, and much harder to review.
Can you please explain why adding the coordinator now is compulsory?
Thanks for the feedback @epenet I thought DataUpdateCoordinator was the recommended replacement for that pattern when using config entries. I was just thinking that when we allreqady refactor a big part for the integration we may as well do this refactor as well. But I'm happy to revert to the proxy approach if we prefer to keep changes minimal. I can then implement the |
Yes please. Config flow PRs are some of the hardest to review - so the smaller we can make them the better. |
Breaking change
N.A
Proposed change
This change will let users configure the entur integration using the GUI instead of having to configure it in the
configuration.yamlAddedThis will be added later in a separate PR as requestedquality_scale.yamlto use the new quality scale system, upgrading the integration from legacy to bronzeNotes
py.typedmarker file.I can split out thequality_scale.yamlinto a separate PR if preferred?Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: