Remove discovery and legacy config file loading for Plex (#32510)
This commit is contained in:
1 parent
8aea538662
commit
4717d072c9
5 files changed
+2
-102
No files matched your search
@@ -11,11 +11,10 @@ import voluptuous as vol
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.http.view import HomeAssistantView
|
||||
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
|
||||
from homeassistant.const import CONF_SSL, CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL
|
||||
from homeassistant.const import CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util.json import load_json
|
||||
|
||||
from .const import ( # pylint: disable=unused-import
|
||||
AUTH_CALLBACK_NAME,
|
||||
@@ -28,7 +27,6 @@ from .const import ( # pylint: disable=unused-import
|
||||
CONF_USE_EPISODE_ART,
|
||||
DEFAULT_VERIFY_SSL,
|
||||
DOMAIN,
|
||||
PLEX_CONFIG_FILE,
|
||||
PLEX_SERVER_CONFIG,
|
||||
SERVERS,
|
||||
X_PLEX_DEVICE_NAME,
|
||||
@@ -180,29 +178,6 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
errors={},
|
||||
)
|
||||
|
||||
async def async_step_discovery(self, discovery_info):
|
||||
"""Set default host and port from discovery."""
|
||||
if self._async_current_entries() or self._async_in_progress():
|
||||
# Skip discovery if a config already exists or is in progress.
|
||||
return self.async_abort(reason="already_configured")
|
||||
|
||||
json_file = self.hass.config.path(PLEX_CONFIG_FILE)
|
||||
file_config = await self.hass.async_add_executor_job(load_json, json_file)
|
||||
|
||||
if file_config:
|
||||
host_and_port, host_config = file_config.popitem()
|
||||
prefix = "https" if host_config[CONF_SSL] else "http"
|
||||
|
||||
server_config = {
|
||||
CONF_URL: f"{prefix}://{host_and_port}",
|
||||
CONF_TOKEN: host_config[CONF_TOKEN],
|
||||
CONF_VERIFY_SSL: host_config["verify"],
|
||||
}
|
||||
_LOGGER.info("Imported legacy config, file can be removed: %s", json_file)
|
||||
return await self.async_step_server_validate(server_config)
|
||||
|
||||
return self.async_abort(reason="discovery_no_file")
|
||||
|
||||
async def async_step_import(self, import_config):
|
||||
"""Import from Plex configuration."""
|
||||
_LOGGER.debug("Imported Plex configuration")
|
||||
|
||||
Reference in new issue
Block a user