Conversation
Introduce full config entry support and UI options for the Feedparser integration. Adds config_flow, options flow, constants, translations/strings, and migration logic (ENTRY_VERSION bump) with normalization helpers for inclusions/exclusions and scan_interval. Refactors sensor to support async_setup_entry, unique_id, configurable scan_interval, safer typing/casting, improved image/link/date handling, and keeps legacy YAML platform support. Updates manifest (config_flow:true, version bump), README with UI setup and configuration reference, adds devcontainer and helper scripts for development, and includes minor test and test-data cleanups.
Import Home Assistant config validation and add CONFIG_SCHEMA = cv.platform_only_config_schema(DOMAIN) to declare platform-only YAML configuration and enable proper config validation. Also import DOMAIN from consts and tidy manifest.json key ordering (move config_flow, domain, name) for consistency; no functional logic changes.
…andling for improved clarity and functionality
|
Hello. Bumping this pull request. Looking to add a feature as well but don't want to branch off a stale main. Is there some additional requirements not met here? @ogajduse |
CarnsJalone
left a comment
There was a problem hiding this comment.
Quick review as I want to branch off this for new feature, once merged. If you don't mind. Shouldn't take more than a minute.
| self, | ||
| user_input: Mapping[str, object] | None = None, | ||
| ) -> FlowResult: | ||
| """Handle the initial step.""" |
There was a problem hiding this comment.
@iantrich The section below is a good opportunity to employ the early return pattern. You have too many levels of indentation, leading to cognitive and cyclomatic complexity. Can I suggest you separate the different branches of this function into private, file-level functions that each handle a single condition, returning as early as possible.
| "requirements": ["feedparser==6.0.11", "python-dateutil", "requests-file", "requests"], | ||
| "version": "0.1.11" | ||
| "requirements": [ | ||
| "feedparser==6.0.11", |
There was a problem hiding this comment.
To match pyproject.toml
| "feedparser==6.0.11", | |
| "feedparser==6.0.12", |
| await async_setup_entry(hass, entry) | ||
|
|
||
|
|
||
| async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: |
There was a problem hiding this comment.
Is the migration function worth covering by a test?
| async def async_step_user( | ||
| self, | ||
| user_input: Mapping[str, object] | None = None, | ||
| ) -> FlowResult: |
There was a problem hiding this comment.
Based on what mypy says, the return type annotation should be ConfigFlowResult instead. If this is changed, we should change the type in the below cast calls.
There was a problem hiding this comment.
Introduction of config flow is a significant change, it'd be great to have it covered by tests. Did you consider adding tests for it?
This pull request introduces a major refactor and modernization of the Feedparser custom component for Home Assistant. The integration now supports a full config flow for UI-based setup and options management, improves documentation for both UI and YAML configuration paths, and standardizes option handling and migration. The codebase is restructured for clarity and maintainability, and a development container is added for easier local development.
Core integration and configuration improvements:
custom_components/feedparser/config_flow.py) for UI-based setup and options, including validation, migration, and options flow support. This enables users to add and configure Feedparser entirely through the Home Assistant UI.custom_components/feedparser/__init__.py) to support config entry setup, unloading, migration, and option normalization for both UI and YAML paths.custom_components/feedparser/const.py) to centralize all option keys, defaults, and platform definitions, improving maintainability and consistency.Documentation and user guidance:
README.mdto clearly explain both UI and YAML configuration methods, provide detailed option references, clarify field behaviors, and add a section for development container usage.Development and packaging:
.devcontainer.jsonfor VS Code development container support, streamlining local development and testing of the integration.manifest.jsonto enable config flow support, bump the version to1.0.0, and format requirements and codeowners for clarity.