- Provide clear, repo-specific instructions for autonomous agents working in this repository.
- Follow Home Assistant developer docs: https://developers.home-assistant.io/docs/.
- Be concise and explain coding steps briefly when making code changes; include code snippets where relevant.
- For non-trivial edits, provide a short plan. For small, low-risk edits, implement and include a one-line summary.
- Focus on a single conceptual change at a time when public APIs or multiple modules are affected.
- Maintain project style and Python 3.14+ compatibility. Target latest Home Assistant core.
- If deviating from these guidelines, explicitly state which guideline is deviated from and why.
- Agents may create and use a repository-local venv at
./.venvand should reference./.venv/bin/pythonwhen running commands. - Installing packages from repo manifests (e.g.,
requirements-dev.txt,pyproject.toml) into./.venvis allowed for running tests or local tooling; avoid unrelated network operations without explicit consent.
custom_components/ha_carrier: integration code.README.md: primary documentation.
- Keep code modular: separate files for entity types, services, and utilities.
- Store constants in
const.pyand use aconfig_flow.pyfor configuration flows. ha_carrieruses the external librarycarrier_api(https://github.com/dahlb/carrier_api & https://pypi.org/project/carrier-api/). This is maintained by the same maintainer asha_carrier.- Any changes that require changes to both
ha_carrierandcarrier_apiwill require a branch and PR in both repos.
- Add typing annotations to all functions and classes (including return types).
- Add or update docstrings for all files, classes and methods, including private methods and nested methods. Method docstrings must follow the Google Style.
- Do not use
castorassertin the main code. They are ok in tests. - Preserve existing comments and keep imports at the top of files.
- Follow existing repository style; run
./scripts/lint.
- Use the repo's
prek,mypy, andpytestcommands inside./.venv. You must always run these inside./.venv. - By default, run the full pytest suite. If running targeted tests, explain why.
- Use Home Assistant's logging framework.
- Catch specific exceptions (do not catch Exception directly).
- Add robust error handling and clear debug/info logs.
- If tests fail due to missing dev dependencies, either install them into
./.venv(if allowed) or report exactpip installcommands.
- Use
pytestand Home Assistant pytest helpers (e.g.,MockConfigEntry). - Add typed, well-documented tests in
tests/and use fixtures inconftest.py. - One test module per integration source file; achieve high coverage (target >= 80%).
- Parameterize tests when appropriate; avoid duplicate test functions.
- Create branches or PRs only when explicitly requested. Do not open PRs autonomously.
- Obtain explicit consent before any network operations outside the repository not strictly needed to run local tests.
- Package installs required for running tests are allowed when user approves.
- Use GitHub Actions for CI/CD where applicable.
- When editing code, prefer fixing root causes over surface patches.
- Keep changes minimal and consistent with the codebase style.
- Add tests for any changed behavior and update documentation if needed.