Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion homeassistant/components/qbittorrent/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from qbittorrent.client import Client, LoginRequired
from requests.exceptions import RequestException
import urllib3
import voluptuous as vol

from homeassistant.components.sensor import (
Expand All @@ -17,6 +18,7 @@
CONF_PASSWORD,
CONF_URL,
CONF_USERNAME,
CONF_VERIFY_SSL,
DATA_RATE_KIBIBYTES_PER_SECOND,
STATE_IDLE,
)
Expand Down Expand Up @@ -57,6 +59,7 @@
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We no longer allow integrations to add or change a platform YAML configuration.

More information on this can be found in Architecture Decision Record:

Please note that this integration connects to a device or service and another Architecture Decision Record applies that disallows the use of YAML configuration in favor of a configuration flow via the UI:

See our developer documentation on how to get started creating a configuration flow for this integration:

https://developers.home-assistant.io/docs/config_entries_config_flow_handler

As these changes often involve a bit of work and some significant shift in the current code, we will close this PR for now.

We (and our community!) would really appreciate it if you could start on the refactoring of this integration in a new PR.

Thanks already! 👍

}
)

Expand All @@ -69,8 +72,12 @@ def setup_platform(
) -> None:
"""Set up the qBittorrent sensors."""

# Suppress InsecureRequestWarning if verify_ssl is False.
if not config[CONF_VERIFY_SSL]:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

try:
client = Client(config[CONF_URL])
client = Client(config[CONF_URL], verify=config[CONF_VERIFY_SSL])
client.login(config[CONF_USERNAME], config[CONF_PASSWORD])
except LoginRequired:
_LOGGER.error("Invalid authentication")
Expand Down