Plex server not found

Firstly, I am new to HA and am just getting starting, currently have Hass.io installed on a RPi3+ with Plex server running on a Synology Nas DS918+

My configuration did not have the discover line in (although even without it is knew I had hue and Tradfri?) so when I loaded the discover line it found my Apple TV but did not find Plex server.

I have checked the documentation and have checked that Enable local network discovery (GDM) is ticked.

I then tried adding:

media_player:
  - platform: plex

which gave no config errors, but plex has still not appeared in the discovered list.

I can carry on working through the documentation and do this bit:

In the event that discovery does not work (GDM disabled or non-local Plex server), you can manually create a plex.conf file manually and place it in your configuration directory or /config/ if you are running Hass.io. The following is an example of plex.conf :

{"IP_ADDRESS:PORT": {"token": "TOKEN", "ssl": false, "verify": true}}

CONFIGURATION VARIABLES

IP_ADDRESS
(string)(Required)IP address of the Plex Media Server.
PORT
(integer)(Required)Port where Plex is listening.
Default value: 32400
TOKEN
(string)(Optional)Only if authentication is required. Set to null (without quotes) otherwise.
ssl
(boolean)(Optional)Whether to use SSL/TLS or not.
Default value: false
verify
(boolean)(Optional)Perform a verification of the certificate. To allow invalid or self-signed SSL certificates set it to false .

Default value: true

But feels like I am missing something already? Plex works on iphone and on Apple tv but I do not have plex pass?

Any thoughts?

What does your log file tell you?

2019-06-20 21:37:38 ERROR (MainThread) [homeassistant.components.updater] Got unexpected response: None
2019-06-21 00:15:06 ERROR (MainThread) [homeassistant.core] Error doing job: SSL handshake failed
Traceback (most recent call last):
  File "uvloop/sslproto.pyx", line 500, in uvloop.loop.SSLProtocol._on_handshake_complete
  File "uvloop/sslproto.pyx", line 484, in uvloop.loop.SSLProtocol._do_handshake
  File "/usr/local/lib/python3.7/ssl.py", line 763, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: VERSION_TOO_LOW] version too low (_ssl.c:1056)
2019-06-21 00:15:28 ERROR (MainThread) [homeassistant.core] Error doing job: SSL handshake failed
Traceback (most recent call last):
  File "uvloop/sslproto.pyx", line 500, in uvloop.loop.SSLProtocol._on_handshake_complete
  File "uvloop/sslproto.pyx", line 484, in uvloop.loop.SSLProtocol._do_handshake
  File "/usr/local/lib/python3.7/ssl.py", line 763, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1056)
2019-06-21 02:43:46 ERROR (MainThread) [homeassistant.core] Error doing job: SSL handshake failed
Traceback (most recent call last):
  File "uvloop/sslproto.pyx", line 500, in uvloop.loop.SSLProtocol._on_handshake_complete
  File "uvloop/sslproto.pyx", line 484, in uvloop.loop.SSLProtocol._do_handshake
  File "/usr/local/lib/python3.7/ssl.py", line 763, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)
2019-06-21 06:57:40 ERROR (MainThread) [homeassistant.core] Error doing job: SSL handshake failed
Traceback (most recent call last):
  File "uvloop/sslproto.pyx", line 500, in uvloop.loop.SSLProtocol._on_handshake_complete
  File "uvloop/sslproto.pyx", line 484, in uvloop.loop.SSLProtocol._do_handshake
  File "/usr/local/lib/python3.7/ssl.py", line 763, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)

I’ll just own up and say I have no idea what any of that means I am afraid.

I cannot see mention of plex in the part of the log you have posted, but that is by no means all of your log.

Edit, just gone to home assistant log in my config folder and that is all that is there.

I updated the HA version yesterday, does that clear the log?

Yes it does

I’ve got the same issue.
My Plex server runs on a NUC machine on Ubuntu though.
Is this thread solved? If so, not sure what happened to resolve it… Except clear a log?

No, because we never got a log demonstrating the problem.

Fair call. :slightly_smiling_face:
I’ve just installed a new instance of HA on Intel-NUC for transition from RPi3 B+ .
I’ll see if I can get logs to share. Unless of course it works on the new machine.
Thanks for the reply - much appreciated.

Hi @nickrout you still about?
I’m now trying to get my plex server recognised and am having trouble.
Wanted to see if anyone was here before I posted logs…

I’m here. Can’t necessarily help, but no one can without a log.

Of Course!
:slight_smile:

My Environment:
HomeAssistant - version 0.95.4
Generic Linux Build - arch x86_64

Plex Server Prefers Secure connections - Self-Certified SSL
Have GDM enabled
have enabled the HA server as ‘allowed without Auth’.
Using plex.conf under /config/
Simple contents:

{
    "192.168.X.Y:32400": {
        "ssl": true,
        "token": "TOKEN",
        "verify": false
    }
}

tried the community method to get the Plex Token (lasts 4 minutes)
Also tried this method to get the token:

https://community.home-assistant.io/t/problems-setting-up-plex-sensor/72567/3

My Plex-related log below:

Log Details (ERROR)
Error while setting up platform plex
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f32a4fff080>: Failed to establish a new connection: [Errno 111] Connection refused

Appears to be auth related, but can’t see why.
my PLEX server ISN’T in DNS - am using static IP’s… There is a note about this…
Should I make a hosts file and see if that helps?

Okay I added my Plex server to the locat /etc/hosts file on the HA machine. Can now resolve over DNS.
Have changed “/config/plex.conf” to use “PlexName:PORT rather than IP:PORT”
This is my resulting log file:

Error while setting up platform plex
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fd8e1e56828>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd8e1e56828>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/plex/sensor.py", line 57, in setup_platform
    plex_token, config.get(CONF_VERIFY_SSL))], True)
  File "/usr/src/homeassistant/homeassistant/components/plex/sensor.py", line 91, in __init__
    self._server = PlexServer(plex_url, None, cert_session)
  File "/usr/local/lib/python3.7/site-packages/plexapi/server.py", line 102, in __init__
    data = self.query(self.key, timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/plexapi/server.py", line 341, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd8e1e56828>: Failed to establish a new connection: [Errno 111] Connection refused'))
Connection lost. Reconnecting…

Seem to be trying to connect to Plex via localhost… ?

I think It’s there…
Jeepers.
Took a step back and read the instructions properly…
Doh!
Thanks again for taking the time to respond.