Plex Thing not being recognized - but log says it is connecting

  • Platform information:
    • Hardware: RaspPi 3
    • OS: what OS is used and which version
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 2.2.0
  • Issue of the topic: Plex Thing not being regonized

Okay so I’m relatively new to openHAB so maybe I’m missing something obvious. First of all, my Plex Server is not in my home, it is on a VPS I rent. However, the hostname seems to resolve on my RaspPi and openHab actually connects and gets play/pause messages. I set org.openhab.binding.Plex to debug:

2018-03-18 22:02:31.053 [DEBUG] [org.openhab.binding.plex            ] - BundleEvent STARTING - org.openhab.binding.plex
2018-03-18 22:02:31.059 [DEBUG] [.binding.plex.internal.PlexActivator] - Plex binding has been started.
2018-03-18 22:02:31.132 [DEBUG] [org.openhab.binding.plex            ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.plex.PlexBindingProvider}={component.name=org.openhab.binding.plex.genericbindingprovider, component.id=185, service.id=311, service.bundleid=207, service.scope=bundle} - org.openhab.binding.plex
2018-03-18 22:02:31.141 [DEBUG] [org.openhab.binding.plex            ] - BundleEvent STARTED - org.openhab.binding.plex
2018-03-18 22:02:31.266 [DEBUG] [ab.binding.plex.internal.PlexBinding] - Plex config, server at 123.xyz:32400
2018-03-18 22:02:32.280 [DEBUG] [.binding.plex.internal.PlexConnector] - Server found, version 1.12.0.4829-6de959918, api level v2
2018-03-18 22:02:32.910 [DEBUG] [.binding.plex.internal.PlexConnector] - Connecting web socket to Plex
2018-03-18 22:02:32.923 [DEBUG] [org.openhab.binding.plex            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={component.name=org.openhab.binding.plex.binding, port=32400, token=UpkkEa7jE1dmneA4orEm, username=xxxx, refresh=5000, service.pid=org.openhab.plex, component.id=184, password=xxx, event.topics=openhab/command/*, host=xxx, service.id=317, service.bundleid=207, service.scope=bundle} - org.openhab.binding.plex
2018-03-18 22:02:34.096 [INFO ] [.binding.plex.internal.PlexConnector] - Plex websocket connected to xxx.plex.direct:32400
2018-03-18 22:02:49.128 [DEBUG] [.binding.plex.internal.PlexConnector] - [xxxx.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"59","guid":"local://3602","ratingKey":"3602","url":"","key":"/library/metadata/3602","viewOffset":46160,"playQueueItemID":890,"state":"paused"}]}}

2018-03-18 22:06:33.171 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":9000,"playQueueItemID":934,"state":"playing"}]}}
2018-03-18 22:06:40.276 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"59","guid":"local://3602","ratingKey":"3602","url":"","key":"/library/metadata/3602","viewOffset":46160,"playQueueItemID":890,"state":"paused"}]}}
2018-03-18 22:06:41.436 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":9000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:06:43.352 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:06:53.401 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:07:03.342 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:07:13.352 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:07:14.777 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"59","guid":"local://3602","ratingKey":"3602","url":"","key":"/library/metadata/3602","viewOffset":46160,"playQueueItemID":890,"state":"paused"}]}}
2018-03-18 22:07:23.379 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:07:33.332 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:07:43.402 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:07:53.352 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}
2018-03-18 22:07:54.229 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"59","guid":"local://3602","ratingKey":"3602","url":"","key":"/library/metadata/3602","viewOffset":46160,"playQueueItemID":890,"state":"paused"}]}}
2018-03-18 22:08:03.524 [DEBUG] [.binding.plex.internal.PlexConnector] - [185-112-249-210.aa9aaf2aa4fe454faa65ada588ad8061.plex.direct]: Message received: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"61","guid":"","ratingKey":"3573","url":"","key":"/library/metadata/3573","viewOffset":17000,"playQueueItemID":934,"state":"paused"}]}}

But when I go to things and Inbox -> Bindings and Select Plex Binding, it is just empty. When I go to search for new things, it only allows me to search for 3-4 type of things/bindings I have installed, Plex not being one of them. What gives?

Thanks!

Hi,

It looks like your plex.cfg is correct as you are receiving data.
The plex binding does not auto discover
You have to set up you items manually in an items file.
For example:
plex.items

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

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

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

On a side note, before posting logs or other things make sure you hide/remove you usernames and passwords… :wink:

Oh lord, didnt realize that was in printed in the log hahah. thanks for the heads up!

So the plex items work on my sitemap now, for the most part.

For example the title shows up correctly.

However, actions do not work. For example play/pause.

In the log I receive this error:

2018-03-19 01:08:46.951 [DEBUG] [.binding.plex.internal.PlexConnector] - Cannot send command, host is unknown for machine ID XYZ

However that machine ID is obviously working for receiving the title?

Any idea whats going on here?

Can I see you plex.cfg and your item files, please?

Yeah no problem, here’s the plex.items content:

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

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

Dimmer PlexTVVolume             "Volume"                <video>         {plex="[playerID]#playback/volume"}
Switch PlexTVPause              "Pause"                 <video>         {plex="[playerID]#playback/pause"}
Switch PlexTVPlay               "Play"                  <video>         {plex="[playerID]#playback/play"}
Switch PlexTVPlayPause  "PlayPause"             <video>         {plex="[playerID]#playback/playpause"}
Switch PlexTVStop               "Stop"                  <video>         {plex="[playerID]#playback/stop"

And here’s the plex.cfg:

# IP address or hostname of the Plex server
host=abc.xyz

# 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 username

 # Plex password
#password=Plex password

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

What is the host name on the Plex server?

The hostname is the URL of the plex server (i.e. “myplexserver.com”)

Machine ID XYZ
Is that the actual log?

lol no

I kind of need real info there to be able to debug

No offense, but I’m a bit suspicious providing anymore real info since you theoretically may still have my old password and any other info I had accidentally pasted in.

The full line looks like this:


2018-03-19 01:08:46.951 [DEBUG] [.binding.plex.internal.PlexConnector] - Cannot send command, host is unknown for machine ID jtfkx1xaaabbbbcccccyrer2v

Ok, I don’t use the binding but I am trying to help
After reading the binding docs
You got the Machine ID. Is that the same as the [playerID] in the items?

Appreciate the help!

The binding refers to it as Machine ID in the logs, but according to plex it is known as the clientIdentifier. Let me check the items, 1 sec. It should be…

EDIT: Yup, the items are identified as such:

Switch PlexTVPower              "Power"         <video>         {plex="jtfkx1xyaaaaazyrer2v#power"}

It’s basically 1:1 out of the docs…

It looks like there is nothing wrong with your set-up
Someone ran into this problem before.
And it looks like it was resolved:

Good luck

Thanks for the help and link! I’ll give it a try.

The only other thing I can suggest is to restart from scracth:

  • Remove the binding
  • Reboot
  • Install the binding
  • Obtain a new machine ID

If it doesn’t work, have a look on github if there is an issue raised for this problem and if not raise one.

Okay, good to know theres nothing wrong with the config at least.

I’ll experiment when I get home from work later today with other clientIDs and what not (android phone, web client, etc.)

If may help,
I noticed that the plex command is not working on some players (i.e. my Samsung Tv app) while is working for example on the browser.

I suppose not all features are available on all players and that does not depend from the Plex machine but from the players itself (app/browser/etc. etc)

yeah that makes sense. The player I was trying to get to work above though was a browser client, so I figured that must have at least worked…

It does READ info (i.e. Title, Artist, etc.) just cannot send any commands (pause, play, volume, etc.).

Very strange…