Plex binding for OH3 | Will it be ported?

You can find the ID’s in the https://plex.tv/devices.xml view.
It’s the clientIdentifier you’re looking for.

1 Like

I have missing something. I go to that link and get:

Please sign in.

You have to log in to plex.tv first and then go to that link.

Yeah. That’s the problem. I am on plex.tv. I can see that I am logged in by clicking the three bars at the top left. I then go to the link and still get the Please sign in page.

I got it this time.

so you got it working?

I can see the status set to Playing when I play and Paused when I pause. I just cannot figure out how to dim to lights to a value when playing and to a different value when paused. I have created a rule for instance.

triggers:

  • id: “1”
    configuration:
    itemName: PLEXPlayerMonitor_PlayerState
    state: Playing
    type: core.ItemStateUpdateTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: CeilingWallDimmerSwitch
    command: “0”
    type: core.ItemCommandAction
  • inputs: {}
    id: “3”
    configuration:
    command: “10”
    itemName: SconsesWallDimmerSwitch
    type: core.ItemCommandAction

I created a test rule that simply turns a light (non dimmer) on at a certain time. I wait until that time and observe that the light indicates it is now on in the OpenHAB UI but the light is not actually turned on. The zwave bridge device that I have is the zstick usb device. It is set to a secondary device and has pulled in all of the devices from the primary controller. I have a thing as a legit switch and an item created from it. Obviously I have done something wrong as the switch does not physically turn on. Ideas why anyone?

Hello!

Have you tried adding that switch to a sitemap and turning lights ON/OFF manually, using that switch? I haven’t tried using new rule engine, so I can’t help you with that (I’m still using DSL rules I’ve made in OpenHAB 1.X and OpenHAB 2.5). Here’s simplified example of DSL rule that takes care of lights, based on Plex Player state:

rule "Multimedia - Plex - LivingRoom - State - Value changed"
when
	Item Multimedia_Plex_LivingRoom_State_Value changed from "Stopped" to "Playing" or
	Item Multimedia_Plex_LivingRoom_State_Value changed from "Stopped" to "Buffering" or
	Item Multimedia_Plex_LivingRoom_State_Value changed from "Paused" to "Playing" or 	
	Item Multimedia_Plex_LivingRoom_State_Value changed from "Paused" to "Buffering"
then
	Lights_Dimmer_Kitchen_MainLight_Value.sendCommand(OFF)
	Lights_Dimmer_Hallway_MainLight_Value.sendCommand(OFF)
	Lights_Dimmer_LivingRoom_Lamp_Value.sendCommand(ON)	
	Lights_Switch_Corridor_MainLight_Value.sendCommand(OFF)
	Lights_Switch_Pantry_MainLight_Value.sendCommand(OFF)
	Lights_Switch_Lobby_MainLight_Value.sendCommand(OFF)
end

Best regards,
Davor

They all need to be local players, it won’t detect any players that are not on your network when you scan. That’s all handled by Plex. So I guess in some cases for some people that are running in containers that are on “other networks” plex may show what you think are local players as “remote”, so they won’t display. I’m not sure how I could go about fixing that, as I know some plex servers handle many outside connections that I don’t want to be displaying.

That would go into a .rules file? In C:\openHAB\conf? In C:\openHAB\addons\conf? I have both locations with a readme.txt file in it.

Hello!

It should go into .rules file in C:\OpenHAB\conf\rules folder.

Best regards,
Davor

But the new rule engine should work fine I would think. Has anyone used the engine?

Hello!

New engine should work, but I can’t help you with it, because I haven’t used it yet.

Best regards,
Davor

So I just create Test.rules, put something accurate into it, and the rule will automatically be recognized?

File is Test.rules:

rule “TestIt”
when
Time is “07:45”
then
Airhockeytablelights_Switch_Value.sendCommand(ON)
end

Hello!

Yes, it should automatically reload rules when you add a new file, or change an existing one. I’m not sure about Time trigger though, because I haven’t used it. I know you could use Cron jobs as trigger, but not sure about exact time. You can find more about time triggers here.

Best regards,
Davor

I was only using time as a very simple test to turn on a light. If you know another way I would be happy to try. No sense fighting with the Plex bridge until I can verify whether OpenHAB can control the lights in a simple fashion,

I am not sure that’s the case here. I have got plex running in a docker container so that’s the token I am using. The players are all on my local network via my wifi. I managed to get my iphone configured (I added it manually), but that’s the only one that I managed to get working.

Also, my binding goes off line after a while:
COMMUNICATION_ERROR

Plex is not returning valid session data

I can see the different tokens and clientidentifiers in my xml file, but you’re saying that if I use the token for my plex media server (which is also in my xml file), I should be able to get my players? Otherwise I would have to setup a bridge for each token/clientidentifier combination?

Did you use plex.tv to get your xml (and for your server token?)?

Thanks.

Are you referring to my thread?

This is what I just created in the new rules engine and it works
triggers:

  • id: “1”
    configuration:
    itemName: PLEXPlayerI1_PlayerState
    state: Playing
    type: core.ItemStateUpdateTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: Light
    command: OFF
    type: core.ItemCommandAction