Skip to content

Add config flow to qBittorrent#82560

Merged
epenet merged 23 commits into
home-assistant:devfrom
chrisx8:qbittorrent
Mar 29, 2023
Merged

Add config flow to qBittorrent#82560
epenet merged 23 commits into
home-assistant:devfrom
chrisx8:qbittorrent

Conversation

@chrisx8
Copy link
Copy Markdown
Contributor

@chrisx8 chrisx8 commented Nov 23, 2022

Breaking change

The YAML configuration has been deprecated. Existing YAML configuration will imported into the UI automatically. Once the import succeeds, it's safe to remove the qBittorrent YAML configuration from your configuration.yaml file.

Proposed change

  • Refactor qbittorrent integration and add support for config_flow.
  • Support disabling SSL verification via the config_flow.
  • Import existing YAML config.
    • The new CONF_VERIFY_SSL option defaults to True, to preserve the old behavior.
    • CONF_NAME is optional in YAML. If CONF_NAME doesn't exist in YAML, default to the DEFAULT_NAME

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant home-assistant Bot added cla-signed config-flow This integration migrates to the UI by adding a config flow has-tests integration: qbittorrent new-feature labels Nov 23, 2022
@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @geoffreylagaisse, mind taking a look at this pull request as it has been labeled with an integration (qbittorrent) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of qbittorrent can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign qbittorrent Removes the current integration label and assignees on the issue, add the integration domain after the command.

@chrisx8 chrisx8 marked this pull request as ready for review November 23, 2022 04:54
@MartinHjelmare MartinHjelmare changed the title qbittorrent: Refactor & Implement config_flow Refactor & add config_flow for qbittorrent Nov 23, 2022
@chrisx8 chrisx8 force-pushed the qbittorrent branch 2 times, most recently from 209c731 to c247aa9 Compare December 2, 2022 02:21
@bdraco bdraco removed their request for review January 11, 2023 00:14
@chrisx8 chrisx8 force-pushed the qbittorrent branch 2 times, most recently from 5a29ae6 to 334b50a Compare February 17, 2023 03:57
Comment thread homeassistant/components/qbittorrent/const.py Outdated
Comment thread homeassistant/components/qbittorrent/sensor.py Outdated
Comment thread homeassistant/components/qbittorrent/sensor.py Outdated
Comment thread homeassistant/components/qbittorrent/sensor.py Outdated
Comment thread homeassistant/components/qbittorrent/sensor.py Outdated
Comment thread homeassistant/components/qbittorrent/translations/en.json Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft March 22, 2023 15:49
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@epenet epenet changed the title Add config flow to qbittorrent Add config flow to qBittorrent Mar 26, 2023
@chrisx8 chrisx8 marked this pull request as ready for review March 26, 2023 20:07
@home-assistant home-assistant Bot requested a review from epenet March 26, 2023 20:07
Comment thread homeassistant/components/qbittorrent/__init__.py
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft March 27, 2023 07:58
chrisx8 and others added 2 commits March 27, 2023 13:54
Co-authored-by: epenet <epenet@users.noreply.github.com>
Co-authored-by: epenet <epenet@users.noreply.github.com>
@chrisx8 chrisx8 marked this pull request as ready for review March 27, 2023 14:04
@home-assistant home-assistant Bot requested a review from epenet March 27, 2023 14:05
Comment thread homeassistant/components/qbittorrent/config_flow.py Outdated
Comment thread homeassistant/components/qbittorrent/config_flow.py Outdated
Comment thread homeassistant/components/qbittorrent/config_flow.py Outdated
Comment thread homeassistant/components/qbittorrent/sensor.py Outdated
Comment thread homeassistant/components/qbittorrent/sensor.py Outdated
Comment thread tests/components/qbittorrent/conftest.py Outdated
Comment thread tests/components/qbittorrent/conftest.py Outdated
Comment thread tests/components/qbittorrent/test_config_flow.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft March 28, 2023 05:54
@chrisx8 chrisx8 marked this pull request as ready for review March 28, 2023 14:23
@home-assistant home-assistant Bot requested a review from epenet March 28, 2023 14:23
Copy link
Copy Markdown
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@epenet epenet merged commit 7c77884 into home-assistant:dev Mar 29, 2023
Copy link
Copy Markdown
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address these two recommendations in follow-up PRs

)
except LoginRequired as err:
_LOGGER.error("Invalid credentials")
raise ConfigEntryNotReady from err
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time to implement reauth flow...


self._attr_name = f"{client_name} {description.name}"
self._attr_unique_id = f"{config_entry.entry_id}-{description.key}"
self._attr_name = f"{config_entry.title} {description.name}"
Copy link
Copy Markdown
Contributor

@epenet epenet Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should now look at adding DeviceInfo and set _attr_has_entity_name accordingly

@chrisx8
Copy link
Copy Markdown
Contributor Author

chrisx8 commented Mar 29, 2023

@epenet Thanks a lot for the help ❤️

FYI, the doc PR is still awaiting: home-assistant/home-assistant.io#25028

@chrisx8 chrisx8 deleted the qbittorrent branch March 29, 2023 22:10
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2023
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments in a new PR. Thanks!

Comment thread homeassistant/components/qbittorrent/__init__.py
Comment thread homeassistant/components/qbittorrent/config_flow.py
@home-assistant home-assistant unlocked this conversation Jun 5, 2023
@chrisx8 chrisx8 mentioned this pull request Jun 5, 2023
20 tasks
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qBittorrent ignore SSL verification

3 participants