Should just be able to drop the jar in addons and then go from there.
got it working! thanks!
Thank you so much for this pre-release.
I will note one thing, play music on plex and this takes a nose diveā¦
Change back to tv/movie and itās golden.
Hi bhomeyer
Would you be able to look at creating a parameter to extend the timeout on the API Connector, my Plex server is remote from my OH install and often times out:
[DEBUG] [lex.internal.handler.PlexApiConnector] - 2java.util.concurrent.TimeoutException: Total timeout 2000 ms elapsed
java.io.IOException: java.util.concurrent.TimeoutException: Total timeout 2000 ms elapsed
at org.openhab.core.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:260) ~[bundleFile:?]
at org.openhab.core.io.net.http.HttpUtil.executeUrl(HttpUtil.java:155) ~[bundleFile:?]
at org.openhab.core.io.net.http.HttpUtil.executeUrl(HttpUtil.java:130) ~[bundleFile:?]
at org.openhab.binding.plex.internal.handler.PlexApiConnector.doHttpRequest(PlexApiConnector.java:226) [bundleFile:?]
at org.openhab.binding.plex.internal.handler.PlexApiConnector.getApi(PlexApiConnector.java:193) [bundleFile:?]
at org.openhab.binding.plex.internal.handler.PlexServerHandler.initialize(PlexServerHandler.java:106) [bundleFile:?]
at org.openhab.core.thing.binding.BaseThingHandler.thingUpdated(BaseThingHandler.java:152) [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.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:829) [?:?]
Caused by: java.util.concurrent.TimeoutException: Total timeout 2000 ms elapsed
at org.eclipse.jetty.client.HttpDestination$TimeoutTask.onTimeoutExpired(HttpDestination.java:582) ~[?:?]
at org.eclipse.jetty.io.CyclicTimeout$Wakeup.run(CyclicTimeout.java:282) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
... 3 more
Certainly can, canāt think of a good way to test that but Iāll drop it in and put it in the advanced binding config for the server thing. Will update when complete.
Time to get some music on my server. Thanks for the update and testing.
Thanks!
Hello,
I downloaded the latest snapshot release from @bhomeyer in this thread and placed it in the addons folder on my raspberry pi. I am running OH 3.0.1
After rebooting, I see this error in the Logviewer:
2021-08-19 18:07:42.003 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.plex-3.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.plex [261]
Unresolved requirement: Import-Package: org.osgi.framework; version="[1.9.0,2.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]
Is there a way to resolve this? I am a newbie when it comes to these manual addons to OH.
Also, after successful installation, should I be able to see the binding in the UI? Or do I have to add all Plex Things manually in the files?
I believe due to a change in OH, it only works on 3.1.0 upwards
I updated OH and I see the binding in the UI now, thanks for the tipp. Setting up the server is a bit of a hassle but sometimes itās recognized
OH3 3.2 Snapshot
Is there anyway to get around this as OH3 have removed org.apache.commons from OH3.0?
Error executing command: Error executing command on bundles:
Error starting bundle 235: Could not resolve module: org.openhab.binding.plex [235]
Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)"
Hello,
I thought I would give this a try but canāt seem to get it working. Running binding v0.9 and OH 3.1.0 release, I get this in my debug log when I try to create the bridge and the bridge goes red with āUnable to fetch API, token may be wrong?ā. Do I need to move up to a snapshot build for this build of the binding?
2021-09-01 15:05:23.021 [DEBUG] [x.internal.handler.PlexServerHandler] - Token is not set, trying to fetch one
2021-09-01 15:05:23.978 [DEBUG] [ex.internal.handler.PlexApiConnector] - PLEX login successful using username/password
2021-09-01 15:05:23.980 [DEBUG] [ex.internal.handler.PlexApiConnector] - Auth token set to : Uf--redacted--n
2021-09-01 15:05:23.981 [DEBUG] [ex.internal.handler.PlexApiConnector] - Auth static = Uf--redacted--n
2021-09-01 15:05:24.202 [DEBUG] [x.internal.handler.PlexServerHandler] - Unable to fetch API, token may be wrong?
2021-09-01 15:05:32.601 [INFO ] [control.internal.WebSocketConnection] - Web Socket close 1006. Reason: Disconnected
My thing config is pretty straight forward too
UID: plex:server:453ced0cd6
label: Plex Server Thing
thingTypeUID: plex:server
configuration:
host: 192.168.0.45
password: mysupersecretpassword
refreshRate: 5
portNumber: 32400
username: myusername
Have you got your plex token mate? your log is saying that your token might be wrong?
āUnable to fetch API, token may be wrong?ā
I finally got mine working last night, It took ages to get it working but i found out it was a simple as copying my token wrong
Iām using these instructions to copy my token when I try to set it up with token directly but shouldnāt the binding populate the token itself if I put in username and password instead? Finding an authentication token / X-Plex-Token | Plex Support
You need token, username and password.
Then restart openhab or the binding.
Also make sure you copy and paste your token properly, i missed a letter off of mine and it took over an hour to realise.
Definitely have the full token copied and I didnāt know you had to fill in all three, it looks like itās an either option kind of thing reading everything but after putting in all three Iām still not successful unfortunately. I turned on debug logging and get this huge log when restarting the binding
PlexBundleLog.txt (50.1 KB)
This line jumps out to me as a potential cause of the issue, but iām on 3.1 already and using the 0.9 version and didnāt see anything in the thread that said I needed to install a dependency and the binding does come up as Active in bundle:list so iām not sure. Do I need to move to a snapshot build or install some other package manually?
2021-09-03 09:48:27.827 [DEBUG] [ing.plex.internal.PlexHandlerFactory] - bundle org.openhab.binding.plex:3.1.0.202108041914 (301)[org.openhab.binding.plex.internal.PlexHandlerFactory(368)] : Not all dependencies satisfied, cannot activate
2021-09-03 09:48:27.828 [DEBUG] [l.PlexStateDescriptionOptionProvider] - bundle org.openhab.binding.plex:3.1.0.202108041914 (301)[org.openhab.binding.plex.internal.PlexStateDescriptionOptionProvider] : Dependency Manager created ChannelTypeI18nLocalizationServiceinterface=org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService, filter=null, policy=static, cardinality=1..1, bind=setChannelTypeI18nLocalizationService, unbind=unsetChannelTypeI18nLocalizationService, updated=null, field=null, field-option=null, collection-type=null, parameter=null
@tardismechanic I had similar issues at first and this is what worked for me:
1 - Fill out the Token only, donāt put anything in username and password, then Save
2 - Reboot
3 - Go to the Plex Server Thing and without changing anything (including token, and the system may have entered your OH3 username and password, simply ignore these) press āSaveā at the top right.
4 - Everytime you do a reboot or system stop and start, just go back into the Plex Server Thing and click āSaveā without changing anything.
Can you try this and see what happens?
I just tried your instructions by the letter, even deleted my existing thing and started fresh and on step 3 when I click save all I get is this in the log:
2021-09-07 13:59:19.440 [DEBUG] [x.internal.handler.PlexServerHandler] - Disposing PLEX Bridge Handler.
2021-09-07 13:59:19.680 [DEBUG] [x.internal.handler.PlexServerHandler] - Unable to fetch API, token may be wrong?
I know the IP and port are right since I can reach plex by going to https://192.168.0.45:32400 in my browser and I even tried getting a fresh token by logging into plex.tv after clearing all browser cache, etc and even that token doesnāt work. I also tried using the token I got when trying this powershell script ([How To] Request a X-Plex-Token token for your app - #2 by ccarvell-plex - Development - Plex Forum) but same issue. I donāt know what else to try, I may just have to throw in the towel on this one