Guidance for working on sensor.feedparser, a Home Assistant custom integration (HACS) that turns RSS/Atom feeds into sensors. Python, config-flow based, with YAML import for legacy setups.
custom_components/feedparser/β the integrationconfig_flow.py,yaml_import.pyβ UI setup and legacy YAML importcoordinator.py,fetch.py,reader.py,source.pyβ fetching and parsing feedssensor.pyβ sensor entitiesconst.py,compat.py,manifest.json,strings.json,translations/(en,de,el)
tests/β pytest suite;tests/data/holds saved feeds (*.xmlwith a matching*.jsonof expected output)hacs.json,package.yaml,pyproject.tomlβ packaging and tooling configtest_hass/andrun-hass.shβ local Home Assistant for manual testing
scripts/setup # pip install -e .[dev]
pre-commit run --all-files # black, ruff, mypy, xmllint, toml/yaml checks
pytest -sv tests/ # offline tests (online ones are excluded by default)
pytest -sv -p no:homeassistant -m online tests/ # tests that need real network access
scripts/develop # run a local Home Assistant with the integration linked inThe Home Assistant pytest plugin blocks DNS, which is why the online tests must run with -p no:homeassistant.
- Line length 88 (black and ruff). Ruff has a broad rule set (
ANN,D,PL,TRY,SIM, ...), so new code needs type annotations and docstrings. - Python versions:
pyproject.tomldeclaresrequires-python = ">=3.14"because the test dependencies need it, buthacs.jsonallows Home Assistant 2025.8, which runs on Python 3.13. So the integration undercustom_components/must stay valid on 3.13 (CI compiles it with 3.13) while tests run on 3.14. This mismatch is intentional; don't "fix" it, and don't use 3.14-only syntax in the integration. - Keep
mypyclean. Typing stubs for Home Assistant andvoluptuousare pinned inpyproject.toml; keephomeassistant-stubson the same release aspytest-homeassistant-custom-component. - Don't block Home Assistant's event loop. Feed fetching uses the synchronous
requestslibrary (fetch.py), which is only ever run throughhass.async_add_executor_job(seecoordinator.pyandconfig_flow.py), and always with a timeout. Flag any new directrequestscall in async code, and any request without a timeout. - Handle malformed, empty and unreachable feeds without raising out of the coordinator, and keep sensors in a sensible unavailable state.
- Config options: keep the UI flow (
config_flow.py), the YAML import (yaml_import.py),strings.json, and every file intranslations/in sync, and update the README's configuration reference. - New feed edge cases: add a saved feed under
tests/data/(.xmlplus the expected.json) and register it intests/constants.pyrather than mocking around the problem. - Releases: the version lives in
pyproject.toml,manifest.jsonandconst.py;bumpverkeeps them aligned. Don't edit them by hand.
- Keep PRs focused on one change, and call out follow-up work instead of bundling it.
- CI must pass. The checks are defined in
.github/workflows/(pull_request.ymlfor code quality, tests and the Python 3.13 syntax check, plus the hassfest and HACS validation workflows).