mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Fix Plex component to use port number in discovery. (#8197)
* Fix Plex component to use port number in discovery. * Break line * Correctly save port to config * Handle port with fewer code changes * This is stuck configuring and I'm not sure why * Changes suggested by @dale3h
This commit is contained in:
parent
2dd7f0616e
commit
f02d169864
@ -88,6 +88,8 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
elif discovery_info is not None:
|
elif discovery_info is not None:
|
||||||
# Parse discovery data
|
# Parse discovery data
|
||||||
host = discovery_info.get('host')
|
host = discovery_info.get('host')
|
||||||
|
port = discovery_info.get('port')
|
||||||
|
host = '%s:%s' % (host, port)
|
||||||
_LOGGER.info("Discovered PLEX server: %s", host)
|
_LOGGER.info("Discovered PLEX server: %s", host)
|
||||||
|
|
||||||
if host in _CONFIGURING:
|
if host in _CONFIGURING:
|
||||||
@ -106,6 +108,7 @@ def setup_plexserver(host, token, hass, config, add_devices_callback):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
plexserver = plexapi.server.PlexServer('http://%s' % host, token)
|
plexserver = plexapi.server.PlexServer('http://%s' % host, token)
|
||||||
|
_LOGGER.info("Discovery configuration done (no token needed)")
|
||||||
except (plexapi.exceptions.BadRequest, plexapi.exceptions.Unauthorized,
|
except (plexapi.exceptions.BadRequest, plexapi.exceptions.Unauthorized,
|
||||||
plexapi.exceptions.NotFound) as error:
|
plexapi.exceptions.NotFound) as error:
|
||||||
_LOGGER.info(error)
|
_LOGGER.info(error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user