[SOLVED] Plex Binding Bug or config problem?

Hi,

I recently re-installed my openhab system from scratch and had the plex binding working before.
However, after re-building my setup it does not work anymore.

Setup is as follows:

Plex Device.xml with the desired token (changed for security):

Device name="SHIELD Android TV" publicAddress="134.101.211.29" product="Plex for Android (TV)" productVersion="7.22.1.12828" platform="Android" platformVersion="9" device="SHIELD Android TV" model="darcy" vendor="NVIDIA" provides="player,pubsub-player,controller" clientIdentifier="cb3415cde10a83a8-com-plexapp-android" version="7.22.1.12828" id="232464541" token="ABCs" createdAt="1536911449" lastSeenAt="1570593100" screenResolution="1920x1080" screenDensity="320">
<SyncList itemsCompleteCount="0" totalSize="0" version="2"/>
<Connection uri="http://192.168.78.42:32500"/>

plex.cfg in services:

# IP address or hostname of the Plex server
host=192.168.78.58

# Optional, port that the Plex server is running on. Default = 32400
port=32400

# Refresh interval in ms. Default = 5000.
refresh=5000

# If you're using Plex Home you need to supply the username and password of your
# Plex account here. If you don't want to enter your credentials you can also
# directly set your account token below instead.
#username=

 # Plex password
#password=

# Plex account token, use instead of username/password when using Plex Home.
token=ABCs

and finally my plex.items accordingly:

Switch PlexTVPower	"Power"         <video>		{plex="cb3415cde10a83a8-com-plexapp-android#power"}
String PlexTVStatus	"Status [%s]"	<video>		{plex="cb3415cde10a83a8-com-plexapp-android#state"}
String PlexTVTitle	"Title [%s]"	<video>		{plex="cb3415cde10a83a8-com-plexapp-android#title"}
String PlexTVType	"Type [%s]"		<video>		{plex="cb3415cde10a83a8-com-plexapp-android#type"}
String PlexTVCover	"Cover"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/cover"}

Dimmer PlexTVProgress   "Progress [%.1f%%]"    <video>    {plex="cb3415cde10a83a8-com-plexapp-android#playback/progress"}
DateTime PlexTVEndTime  "End time [%1$tR]"     <video>    {plex="cb3415cde10a83a8-com-plexapp-android#playback/endTime"}

Dimmer PlexTVVolume	"Volume"		<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/volume"}
Switch PlexTVPause	"Pause"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/pause"}
Switch PlexTVPlay	"Play"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/play"}
Switch PlexTVPlayPause	"PlayPause"		<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/playpause"}
Switch PlexTVStop	"Stop"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/stop"}

Switch PlexTVSelect	"Select"		<video>		{plex="cb3415cde10a83a8-com-plexapp-android#navigation/select"}
Switch PlexTVBack	"Back"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#navigation/back"}
Switch PlexTVUp		"Up"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#navigation/moveUp"}
Switch PlexTVDown	"Down"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#navigation/moveDown"}
Switch PlexTVLeft	"Left"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#navigation/moveLeft"}
Switch PlexTVRight	"Right"			<video>		{plex="cb3415cde10a83a8-com-plexapp-android#navigation/moveRight"}



Switch PlexTVForward	"Forward"		<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/stepForward"}
Switch PlexTVReverse	"Reverse"		<video>		{plex="cb3415cde10a83a8-com-plexapp-android#playback/stepBack"}

So everything would seem fine but its not working in habpanel.
DEBUG mode says:

2019-10-09 16:25:08.712 [DEBUG] [.binding.plex.internal.PlexConnector] - 192-168-78-58.11565f46484d47ab9925586c8e7b7843.plex.direct

java.net.UnknownHostException: 192-168-78-58.11565f46484d47ab9925586c8e7b7843.plex.direct

	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) ~[?:?]

	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]

	at java.net.Socket.connect(Socket.java:589) ~[?:?]

	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666) ~[?:?]

	at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[?:?]

	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[?:?]

	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[?:?]

	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) ~[?:?]

	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) ~[?:?]

	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1165) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1049) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1047) ~[?:?]

	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]

	at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:784) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1046) ~[?:?]

	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1573) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:94) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1493) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1491) ~[?:?]

	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]

	at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:784) ~[?:?]

	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1490) ~[?:?]

	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268) ~[?:?]

	at org.openhab.binding.plex.internal.PlexConnector.doHttpRequest(PlexConnector.java:622) [267:org.openhab.binding.plex:1.13.0]

	at org.openhab.binding.plex.internal.PlexConnector.getDocument(PlexConnector.java:599) [267:org.openhab.binding.plex:1.13.0]

	at org.openhab.binding.plex.internal.PlexConnector.refresh(PlexConnector.java:592) [267:org.openhab.binding.plex:1.13.0]

	at org.openhab.binding.plex.internal.PlexBinding.execute(PlexBinding.java:61) [267:org.openhab.binding.plex:1.13.0]

	at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [198:org.openhab.core.compat1x:2.4.0]

	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [198:org.openhab.core.compat1x:2.4.0]

2019-10-09 16:25:08.595 [DEBUG] [.binding.plex.internal.PlexConnector] - [192-168-78-58.11565f46484d47ab9925586c8e7b7843.plex.direct]: Websocket connection error

2019-10-09 16:25:08.597 [DEBUG] [.binding.plex.internal.PlexConnector] - Error connecting to Plex

java.util.concurrent.ExecutionException: java.net.ConnectException: wss://192-168-78-58.11565f46484d47ab9925586c8e7b7843.plex.direct:32400/:/websockets/notifications?X-Plex-Token=25AUB6NfztWBvmnUPSeF

	at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:341) ~[267:org.openhab.binding.plex:1.13.0]

	at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:107) ~[267:org.openhab.binding.plex:1.13.0]

	at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427) ~[267:org.openhab.binding.plex:1.13.0]

	at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145) ~[267:org.openhab.binding.plex:1.13.0]

	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1130) ~[267:org.openhab.binding.plex:1.13.0]

	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:927) ~[267:org.openhab.binding.plex:1.13.0]

	at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:524) ~[267:org.openhab.binding.plex:1.13.0]

	at com.ning.http.client.AsyncHttpClient$BoundRequestBuilder.execute(AsyncHttpClient.java:236) ~[267:org.openhab.binding.plex:1.13.0]

	at org.openhab.binding.plex.internal.PlexConnector.open(PlexConnector.java:198) ~[267:org.openhab.binding.plex:1.13.0]

	at org.openhab.binding.plex.internal.PlexConnector.connect(PlexConnector.java:484) [267:org.openhab.binding.plex:1.13.0]

	at org.openhab.binding.plex.internal.PlexConnector.run(PlexConnector.java:186) [267:org.openhab.binding.plex:1.13.0]

Caused by: java.net.ConnectException: wss://192-168-78-58.11565f46484d47ab9925586c8e7b7843.plex.direct:32400/:/websockets/notifications?X-Plex-Token=25AUB6NfztWBvmnUPSeF

	at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:103) ~[?:?]

	... 9 more

So obviously it seems like a network error right? I searched the forums and included the plex tv server hostname *.plex.direct as well as the FQDN in the DNS rebind protection exclusions.

Anybody had this behaviour? I am running openhab 2.4 on raspberry pi 3+

Thanks,
Henning

I suspect you’ll need to add the
192-168-78-58.11565f46484d47ab9925586c8e7b7843.plex.direct
to your hosts file on the platform you’re running OH on and point it to your actual Plex server.

e.g.
192.168.78.58 192-168-78-58.11565f46484d47ab9925586c8e7b7843.plex.direct

YOU are the man! @nick_wootton Thank you!

I was so confused that I did not try this because before in the old setup there was no need for a direct hosts entry. I have no idea why this is now needed but it solved the problem and the binding can now reach the plex server.
Wonderful, thank you!

I ran into exactly the same issue and someone else pointed this out to me! Glad to help.