-
-
Notifications
You must be signed in to change notification settings - Fork 34.9k
Feature/ns config flow and coordinator #151567
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?
Feature/ns config flow and coordinator #151567
Conversation
…chpaul/core into feature/improving_NS_integration
…tion Feature/improving ns integration
…tion Feature/improving ns integration
…ng and remove quality scale file, Will create another PR to add this
…escriptions in strings.json
…oving_NS_integration
Co-authored-by: Norbert Rittel <norbert@rittel.de>
Removed duplications Co-authored-by: Norbert Rittel <norbert@rittel.de>
- Implement unit tests for the init module, covering setup and unload entry success and failure scenarios. - Create tests for repair notifications to ensure proper issue creation during platform and integration migration. - Add comprehensive tests for the sensor platform, including various scenarios for trip data and attributes. - Introduce utility tests for validation functions, time formatting, and station cache validation.
- Implement unit tests for the init module, covering setup and unload entry success and failure scenarios. - Create tests for repair notifications to ensure proper issue creation during platform and integration migration. - Add comprehensive tests for the sensor platform, including various scenarios for trip data and attributes. - Introduce utility tests for validation functions, time formatting, and station cache validation. Signed-off-by: Heindrich Paul <heindrich.paul@gmail.com>
…eindrichpaul/core into feature/ns-config-flow-and-coordinator Signed-off-by: Heindrich Paul <heindrich.paul@gmail.com>
Hey there @YarmoM, 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 modernizes the Nederlandse Spoorwegen integration by implementing a complete config flow with UI-based configuration, replacing the legacy YAML configuration system. The integration moves from legacy to Bronze quality scale with comprehensive test coverage and modern Home Assistant standards compliance.
Key improvements include:
- Config flow implementation with proper UI-based setup and options flow for route management
- Data coordinator pattern with centralized data fetching and error handling
- Automatic YAML migration with repair notifications to guide users through the transition
Reviewed Changes
Copilot reviewed 23 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
homeassistant/components/nederlandse_spoorwegen/__init__.py |
Complete rewrite implementing config flow setup, YAML migration support, and repair issue management |
homeassistant/components/nederlandse_spoorwegen/api.py |
New API wrapper with proper error handling and station data management |
homeassistant/components/nederlandse_spoorwegen/config_flow.py |
New config flow implementation with user setup, import flow, and options management |
homeassistant/components/nederlandse_spoorwegen/coordinator.py |
New data update coordinator with centralized data fetching and validation |
homeassistant/components/nederlandse_spoorwegen/sensor.py |
Rewritten to use coordinator pattern instead of legacy platform setup |
homeassistant/components/nederlandse_spoorwegen/utils.py |
New utility functions for validation, normalization, and data handling |
homeassistant/components/nederlandse_spoorwegen/const.py |
Constants definition for the integration |
homeassistant/components/nederlandse_spoorwegen/strings.json |
Localization strings for UI elements and error messages |
homeassistant/components/nederlandse_spoorwegen/manifest.json |
Updated to Bronze quality scale with config flow support |
homeassistant/components/nederlandse_spoorwegen/quality_scale.yaml |
Bronze tier compliance documentation |
tests/components/nederlandse_spoorwegen/ |
Comprehensive test suite with 74% coverage across all modules |
script/hassfest/quality_scale.py |
Removed integration from exemption list for Bronze requirements |
requirements_test_all.txt |
Added nsapi dependency for testing |
CODEOWNERS |
Added additional codeowner for the integration |
Comments suppressed due to low confidence (1)
homeassistant/components/nederlandse_spoorwegen/coordinator.py:1
- Remove the comment on line 62. Inline comments like this that explain basic usage are unnecessary noise in production code. The parameter name and context make its purpose clear.
"""Data update coordinator for Nederlandse Spoorwegen integration."""
Co-authored-by: Norbert Rittel <norbert@rittel.de>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Thanks for modernizing this integration!
Since this is quite a big PR, I would suggest splitting this up into smaller PRs. For example:
- Adding tests for the current version
- Adding the config flow and import flow
- Adding the coordinator
- Add the quality scale
- ...
That will help getting this modernization in, since those smaller PRs are much easier to review :)
…on and enhance departure sensor logic
…tion Signed-off-by: Heindrich Paul <heindrich.paul@gmail.com>
…egration and add corresponding repair notifications
Thanks for the comment and review. I am currently working on this PR while staying in contact with @joostlek |
Breaking change
YAML configuration for Nederlandse Spoorwegen is now deprecated and will be removed in a future release. The integration automatically migrates existing YAML configuration and creates repair notifications to guide users. To complete the migration:
nederlandse_spoorwegen:
section from yourconfiguration.yaml
sensor:
entries withplatform: nederlandse_spoorwegen
Your existing routes and settings are automatically preserved in the new UI-based configuration.
Proposed change
This PR modernizes the Nederlandse Spoorwegen integration by implementing a complete config flow with options management, replacing the legacy YAML configuration system. Key improvements include:
The integration automatically imports existing YAML configuration, so users experience no disruption to their existing sensors and automations.
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: