Plex Media Player Connection Refused

I recently built a Plex Media server on a Raspberry Pi which I want to to control from my HA server. My HA server discovers the Plex Server but every time I try to use the configurator, the connection is refused. I obtain the token using the recommended steps. The log shows the following error.

ERROR (Thread-4) [plexapi] http://192.168.1.97: HTTPConnectionPool(host=‘192.168.1.97’, port=80): Max retries exceeded with url: /?X-Plex-Token=< MY TOKEN > (Caused by NewConnectionError(’<requests.packages.urllib3.connection.HTTPConnection object at 0x6e7f9fd0>: Failed to establish a new connection: [Errno 111] Connection refused’,))

I get the same thing.
When I try and go to the url it suggests in the “GET” line in the error log above the one you posted, the browser can’t connect (e.g. http://192.168.0.2/?X-Plex-Token=<MY_TOKEN>), however if I add the port to that address (e.g. http://192.168.0.2:32400/?X-Plex-Token=<MY_TOKEN>), then I get what I assume is the XML HA is looking for.

My plex.conf is configured as it should be, according to the guide:

{"192.168.0.2:32400": {"token": "MY_TOKEN"}}

Sorry I’m not much help, I’ll keep an eye out should someone else have a solution to this.

I get a similar error here too, just the port number is different and the token doesn’t match what I have set in my plex.conf file

2017-08-21 21:08:53 ERROR (Thread-15) [plexapi] http://EXTERNAL_IP_NO:18439: HTTPConnectionPool(host='EXTERNAL_IP_NO', port=18439): Max retries exceeded with url: /?X-Plex-Token=DIFFERENT_TOKEN_TO_CONFIG (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x6d9cd450>: Failed to establish a new connection: [Errno 111] Connection refused',))

Did anyone ever get this working?

I just installed a PLEX server and get the same error. Have tried every possible suggestion found online.

My plex server is running in an NVIDIA Shield TV in the same network.

2018-11-13 17:18:05 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform plex
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/connection.py”, line 171, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/connection.py”, line 79, in create_connection
raise err
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/connection.py”, line 69, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused