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
@@ -37,7 +37,6 @@ SERVICE_KONNECTED = "konnected"
|
||||
SERVICE_MOBILE_APP = "hass_mobile_app"
|
||||
SERVICE_NETGEAR = "netgear_router"
|
||||
SERVICE_OCTOPRINT = "octoprint"
|
||||
SERVICE_PLEX = "plex_mediaserver"
|
||||
SERVICE_ROKU = "roku"
|
||||
SERVICE_SABNZBD = "sabnzbd"
|
||||
SERVICE_SAMSUNG_PRINTER = "samsung_printer"
|
||||
@@ -51,7 +50,6 @@ CONFIG_ENTRY_HANDLERS = {
|
||||
SERVICE_DAIKIN: "daikin",
|
||||
SERVICE_TELLDUSLIVE: "tellduslive",
|
||||
SERVICE_IGD: "upnp",
|
||||
SERVICE_PLEX: "plex",
|
||||
}
|
||||
|
||||
SERVICE_HANDLERS = {
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -15,7 +15,6 @@ PLATFORMS_COMPLETED = "platforms_completed"
|
||||
SERVERS = "servers"
|
||||
WEBSOCKETS = "websockets"
|
||||
|
||||
PLEX_CONFIG_FILE = "plex.conf"
|
||||
PLEX_MEDIA_PLAYER_OPTIONS = "plex_mp_options"
|
||||
PLEX_SERVER_CONFIG = "server_config"
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"all_configured": "All linked servers already configured",
|
||||
"already_configured": "This Plex server is already configured",
|
||||
"already_in_progress": "Plex is being configured",
|
||||
"discovery_no_file": "No legacy configuration file found",
|
||||
"invalid_import": "Imported configuration is invalid",
|
||||
"non-interactive": "Non-interactive import",
|
||||
"token_request_timeout": "Timed out obtaining token",
|
||||
|
||||
Reference in new issue
Block a user