-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Add SFTP Client #147300
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 SFTP Client #147300
Conversation
There's already an open PR for SFTP support for backups #135844 |
The CI / Run tests Python 3.13 (9) error test (pull_request) is not related to my code |
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.
There's already another PR that’s further in the review process, please rather check if it makes sense to join forces
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Damn, I just saw it now. |
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
Adds a new SFTPClient integration to perform Home Assistant backups over SFTP.
- Introduces SSH and SFTP connection helpers with error handling and streaming utilities
- Implements a user-driven config flow and translation strings for configuration and setup errors
- Provides a
BackupAgent
implementation for listing, uploading, downloading, and deleting backups, along with comprehensive tests and type checking
Reviewed Changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
homeassistant/components/sftp_client/helpers.py | SSH and SFTP connection helpers, path operations, JSON streaming, and error classes |
homeassistant/components/sftp_client/config_flow.py | Config flow schema, validation (InvalidAuth , CannotConnect ), and entry creation |
homeassistant/components/sftp_client/backup.py | BackupAgent implementation for managing backups over SFTP |
homeassistant/components/sftp_client/strings.json | Localization strings for UI steps and exception messages |
homeassistant/components/sftp_client/manifest.json | Integration metadata, dependencies, and quality scale setting |
homeassistant/components/sftp_client/quality_scale.yaml | Quality scale compliance for Bronze through Platinum levels |
tests/components/sftp_client/conftest.py | Common fixtures mocking SFTP connections and file streams |
tests/components/sftp_client/test_init.py | Tests for setup and teardown behavior of the integration |
tests/components/sftp_client/test_helpers.py | Tests for helper error handling (permission denied path) |
tests/components/sftp_client/test_config_flow.py | Config flow tests covering success, auth errors, connection errors, and duplicates |
tests/components/sftp_client/test_backup.py | Tests for backup agent API: list, details, upload, download, delete, and error cases |
requirements_all.txt & requirements_test_all.txt | Added asyncssh==2.21.0 dependency |
mypy.ini | Strict typing rules enabled for the new integration |
CODEOWNERS & .strict-typing | Ownership assignment and strict typing registration for SFTP client |
Comments suppressed due to low confidence (1)
tests/components/sftp_client/test_helpers.py:14
- [nitpick] This test name duplicates
test_load_config_entry
intest_init.py
but tests a permission-denied scenario. Rename it to something liketest_permission_denied_on_connect
to reflect its purpose.
async def test_load_config_entry(
"""Open SFTP Connection.""" | ||
await self.async_ssh_connect() | ||
if self._conn is None: | ||
raise RuntimeError("SHH Connection is failed") |
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.
The error message has a typo (“SHH”) and awkward phrasing. Consider using something like RuntimeError("SSH connection failed")
for clarity.
raise RuntimeError("SHH Connection is failed") | |
raise RuntimeError("SSH connection failed") |
Copilot uses AI. Check for mistakes.
Proposed change
SFTP Client allows you to specify an SFTP source to perform Home Assistant backups
Brand for new integration : home-assistant/brands#7312
Documentation: home-assistant/home-assistant.io#39676
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: