so here is what I did: I have two things so far, the bridge and a player (plexamp on linux). Player and Server are on same computer, which is different from my openhab installation.
Enabling Bridge:
2021-02-25 10:02:11.441 [DEBUG] [ex.internal.handler.PlexApiConnector] - Plex Api fetched. Found configured PLEX server in Api request, applied.
2021-02-25 10:02:11.454 [DEBUG] [ex.internal.handler.PlexApiConnector] - Connecting to WebSocket
2021-02-25 10:02:30.601 [DEBUG] [x.internal.handler.PlexPlayerHandler] - Initializing PLEX player : 9215b0eb-3341-42c1-832e-4f9a3d4923b6
2021-02-25 10:02:30.603 [WARN ] [x.internal.handler.PlexServerHandler] - Bridge: Monitor handler was initialized for plex:player:265e8db400:17e35f31f1 with id 9215b0eb-3341-42c1-832e-4f9a3d4923b6
Enabling Thing (Player)
2021-02-25 10:02:30.591 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'plex:player:265e8db400:17e35f31f1' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2021-02-25 10:02:30.603 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'plex:player:265e8db400:17e35f31f1' changed from INITIALIZING to UNKNOWN
2021-02-25 10:02:32.505 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PlexServer_CurrentPlayers' changed from 0 to 1
Starting playback on player
2021-02-25 10:04:42.845 [WARN ] [x.internal.handler.PlexServerHandler] - An exception occurred while polling the PLEX Server: 'null'
2021-02-25 10:04:42.850 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'plex:server:265e8db400' changed from ONLINE to OFFLINE
2021-02-25 10:04:42.855 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'plex:player:265e8db400:17e35f31f1' changed from UNKNOWN to OFFLINE (BRIDGE_OFFLINE)
Edit: Bridge thing goes offline as soon as playback is start (device doesnt matter, tried with plexamp on android and on linux).
I just installed another plex server on the same machine as OH3 instance and still get same result.
Some input on my plex setup:
I have more than one user setup, the user that I used to get the token with is admin and has a passcode enabled. I tried adding the ip from OH3 instance to âtrusted domainsâ in network options but didnt help.
Have to admit that I never got the old Plex-Binding for OH2 running (OH3 was just about to be released when I started taking an interest).
So the token is fetched from plex.tv, not your local machine. What that request does is list out your instances as well as provide the token. To do this, it uses your username/password. If the username/password that you are putting into the binding is a âuserâ of plex and not the admin for the plex.tv account youâre likely going to have problems.
Once that token is fetched, then the binding connects to the actual machine running plex. Possibilities here I would think are the IP that youâre putting into the binding doesnât match the IP that is configured for PLEX. At this point, Iâm more interested than anything and would love to help you get this going. Let me add in some more debug here and post a version for you to try.
Thank you for this rewrite. I will be testing this. It was one of the things that I was missing.
Also, I have the exact scenario, you are describing with multiple devices:
Smart-TV and then via HDMI switch (Hue Sync) a Smart-BluRay Player and a Chromecast connected. So it shall be interesting.
Binding: v0.8
PWS: 1.20.0.3181 and 1.22.0.4163 (I tried to downgrade in an attempt to get it working)
OpenHAB: 3.1.0M2
I have extracted both hostname and token, even tried using the IP. It has to be said though, that the server is not on my local network, but remote. Iâm not sure, if that is an issue.
Debug output from the openhab.log:
2021-03-14 18:33:28.889 [WARN ] [ex.internal.handler.PlexApiConnector] - An exception occurred while fetching API :'null:{}' java.lang.NullPointerException: null at org.openhab.binding.plex.internal.handler.PlexApiConnector.getApi(PlexApiConnector.java:182) [bundleFile:?] at org.openhab.binding.plex.internal.handler.PlexServerHandler.initialize(PlexServerHandler.java:106) [bundleFile:?] at org.openhab.core.thing.binding.BaseThingHandler.handleConfigurationUpdate(BaseThingHandler.java:107) [bundleFile:?] at org.openhab.core.thing.internal.ThingRegistryImpl.updateConfiguration(ThingRegistryImpl.java:94) [bundleFile:?] at org.openhab.core.io.rest.core.internal.thing.ThingResource.updateConfiguration(ThingResource.java:504) [bundleFile:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) [bundleFile:1.0.9] at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) [bundleFile:1.0.9] at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) [bundleFile:1.0.9] at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) [bundleFile:1.0.9] at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [bundleFile:1.0.9] at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [bundleFile:1.0.9] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [bundleFile:1.0.9] at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [bundleFile:1.0.9] at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [bundleFile:1.0.9] at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [bundleFile:1.0.9] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [bundleFile:1.0.9] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [bundleFile:1.0.9] at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216) [bundleFile:1.0.9] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) [bundleFile:1.0.9] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:237) [bundleFile:1.0.9] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) [bundleFile:3.1.0] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) [bundleFile:1.0.9] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) [bundleFile:9.4.20.v20190813] at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [bundleFile:?] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) [bundleFile:9.4.20.v20190813] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) [bundleFile:?] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [bundleFile:9.4.20.v20190813] at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [bundleFile:?] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.Server.handle(Server.java:494) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [bundleFile:9.4.20.v20190813] at java.lang.Thread.run(Thread.java:829) [?:?]
Another quite peculiar thing is, that the Plex Binding is not listed under Bindings. But yet, when I want to add a Plex Bridge etc. it is listed there.
Anyone else getting a problem with the binding since doing an update to Openhab? The binding isnât starting, and when I try to start it manually, I see this error:
Error starting bundle 262: Could not resolve module: org.openhab.binding.plex [262]
Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)"
Edit: 7th April 2021 - should have been clear this is when I used the latest Milestone build. Dropped back to Stable and all OK again.
Trying out the 0.8 Binding on Plex Server: 1.22.1.4275, no Plex Pass. - vanilla out of the box configuration and observing odd behavior on OH3 Plex Bridge Thing. (binding added manually to addons folder)
The bridge goes from âOnlineâ To âOfflineâ when a player starts - Bridge shows error: Plex is not returning valid session data. And then Offline to Online when the player stops (if paused it does not go to online, has to be stopped)
I have entered username and password, doesnât seem to do anything until I add a x-token which I got from âview xmlâ on a library item. Deleted all player monitor things, still same online then offline behavior.
Clarification request on x-tokens : The token you get from visiting via: app.plex.tv is one thing, the token from localnetworkIP:32400 is another - which token should one use? ( I tried both same result)
The log doesnât say much:
[ab.event.ThingStatusInfoChangedEvent] - Thing âplex:server:26ff5b0919â changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Plex is not returning valid session data.
[ab.event.ThingStatusInfoChangedEvent] - Thing âplex:server:26ff5b0919â changed from OFFLINE (COMMUNICATION_ERROR): Plex is not returning valid session data to ONLINE
I previously had monkeyed around with .1 release and had things and items from that, that I re-assigned to the new binding - probably a bad idea.
Deleted all things and items related to plex, restarted OH3 and recreated them (via UI) its working now, picking up the play pause stop events on players within 0.5 sec or so and most importantly staying online !
I had to use the x-token from the app.plex.tv browsing of your library, not the one from direct browsing you local plex install ip. Plex pass not required.
Hi, just been playing around with a new OH3 install to see if I can migrate everything over from 2.5 to 3 and stumbled upon this binding for Plex.
I seem to be able to get it working mostly, but I seem to be hitting a timeout issue when connecting to the Plex server
[DEBUG] [lex.internal.handler.PlexApiConnector] - java.util.concurrent.TimeoutException: Total timeout 2000 ms elapsed
java.io.IOException: java.util.concurrent.TimeoutException: Total timeout 2000 ms elapsed
If upon first connection it fails, it never seems to retry and just sits in error state, but if it succeeds everything seems to work fine. Are you able to add a parameter to increase the timeout to see if it helps things (my plex server can be a bit slow at times)?
Thanks for all your work on this binding, Iâll keep playing now and see if I find any other bugs
I had the same issue with Milestone.
Though switching back appears to still be an issue as of today⊠Iâm getting a null pointer exception errorâŠ
my openhab.log
2021-05-28 11:38:44.801 [WARN ] [ex.internal.handler.PlexApiConnector] - An exception occurred while fetching API :'null:{}'
java.lang.NullPointerException: null
at org.openhab.binding.plex.internal.handler.PlexApiConnector.getApi(PlexApiConnector.java:182) [bundleFile:?]
at org.openhab.binding.plex.internal.handler.PlexServerHandler.initialize(PlexServerHandler.java:106) [bundleFile:?]
at jdk.internal.reflect.GeneratedMethodAccessor90.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Hi @bhomeyer thanks for your work on the migration of this binding.
I wanted to try it on a recent snapshot, however some dependencies seem to be broken currently.
I was wondering what your plans are with this binding.
I can confirm the same (3.1). Iâm forced to use another 2.5-10 OH with the old 1.x binding. There is a similar problem/error with the Chamberlain binding, so hopefully itâs not a huge problem to fix long term.