Plex Sensor

I’m trying to setup the Plex Sensor and am getting the following in my log:

16-11-11 09:43:27 plexapi: http://plex.tv:443: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
16-11-11 09:43:28 homeassistant.components.sensor: Error while setting up platform plex

Any ideas? Why is it trying to connect to plex.tv:443?

Here’s my config:

sensor:
  - platform: plex
    host: 192.168.1.200
    username: <username>
    password: <password>

Thanks!

Are you using a port other than 32400 on your Plex server? Also it looks like you’re pointing it at the Plex website (http://plex.tv) rather than at the IP address of your local plex server.

I’m using port 32400 and am pointing it at the local IP address of my Plex server. I don’t know why it’s trying to connect to http://plex.tv. Seems strange.

The only thing I can think of is it trying to authenticate; check your account settings in the config and then check over at Plex.tv and see if you can login OK.

Edit: Also try specifying the port, even though it’s the default, just to rule out anything.

Edit 2 (as I keep thinking of things): Look at this post and see if it applies:

Thanks for digging around for me. I added the port to my conf and tried adding my token to plex.conf like that other thread suggested. Still no luck.

I think it’s definitely something to do with authentication.

I’m running both Plex and Home Assistant as docker containers on UNRAID. When I add my desktop (different PC) IP address to the PMS network setting for “doesn’t require auth” then I can use curl to access the API. But if I remove that IP address and try to access the API with my username and password it doesn’t work. Maybe I’m doing something wrong there.

For some reason adding the IP address of my UNRAID server to that section of PMS settings doesn’t seem to work. I SSH into my server and can’t use curl like I can on my desktop. Maybe something to do with docker?

I don’t have any experience with docker but hopefully someone else will check in with some ideas.

Some progress: I can now use curl to access the API from any machine on my LAN (even if not on the PMS list) by adding my token to the url being passed to curl.

Also, I noticed that if I leave my username/password out of my config then I get an error showing unauthorized from the IP of the PMS, but if I put it in then I get the error above showing plex.tv/443.

There’s a setting on the Plex server in advanced under network where you can specify allowed host access. Try putting the IP of the HA server in there and try again without the username/password.

That doesn’t work for some reason. It works from my desktop, but not from the server for some reason. Might have something to do with docker.

I know this is an old thread but I had the same problem. I don’t use docker but I do have plex media server installed on the same ubuntu server that I have HA installed on.

I was finally able to get it to work by adding my subnet and localhost under the advanced network settings in plex - “List of IP addresses and networks that are allowed without auth”.

I then removed the username and password from my configuration.yaml and restarted.

I now have a counter which tells me how many devices are streaming.

2 Likes