Use URI provided by Plex for local connections (#27515)

* Use provided URI for local connections

* Use provided plexapi connection method

* Remove unused mock from tests

* Handle potential edge case(s)
This commit is contained in:
jjlawren authored and Paulus Schoutsen committed 2019-10-17 17:31:53 -07:00
1 parent 564789470e
commit 0888098718
3 files changed
+11 -34

No files matched your search

+3 -2
View File
@@ -89,9 +89,10 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
_LOGGER.error("Invalid credentials provided, config not created")
errors["base"] = "faulty_credentials"
except (plexapi.exceptions.NotFound, requests.exceptions.ConnectionError):
_LOGGER.error(
"Plex server could not be reached: %s", server_config[CONF_URL]
server_identifier = (
server_config.get(CONF_URL) or plex_server.server_choice or "Unknown"
)
_LOGGER.error("Plex server could not be reached: %s", server_identifier)
errors["base"] = "not_found"
except ServerNotSpecified as available_servers: