New PJLink Binding for controlling multiple projector brands/models

@struvusmaximus Sadly it turned out a bit more complicated than expected…

With the PJLink test tool I got it working quickly, but my real projector has its special behaviours. It does not like polling on the selected input at all (blocks the request until a timeout occurs), so I created three additional configuration options to enable/disable polling of power, mute, input channel respectively.

The binding is currently building and should be available in max. 2 hours from now at the usual URL.

Best Regards,
Nils

1 Like

thanks @nils I just tested the new snapshot with two beamers and the new status polling works fine!

I also see your binding got some feedback from the maintainers. So hopefully your work will be added to the add-on repo in the near future.
Thanks for all the effort you already put in this binding.

1 Like

Hi all,

Just want to confirm this binding is also working fine with my Epson EH-TW9400 projector (also known as Pro Cinema 6050UB), which is a PJ link class 2

Thanks for the development!

1 Like

Hi
I try to use this Binding with a Optoma UHD3700. But I got only a Communication Error Read timed out.
When I used the Testprogram mentioned befor its working.

I use the last binding 2.5 with the latest Openhabian on an Respberry Pi

Hi Matthias,

please set the log level of org.openhab.binding.pjlinkdevice to at least INFO and add your projector again. Then post the corresponding log file section here, maybe I can identify the issue this way.

Hi at the Scan for the address I got this Log Entry
2019-06-16 14:41:41.605 [WARN ] [discovery.DiscoveryParticipantClass1] - No PJLinkDevice here /192.168.1.153 [java.net.PlainSocketImpl.socketConnect(Native Method), java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350), java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206), java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188), java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392), java.net.Socket.connect(Socket.java:589), org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice.connect(PJLinkDevice.java:117), org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice.connect(PJLinkDevice.java:88), org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice.checkAvailability(PJLinkDevice.java:206), org.openhab.binding.pjlinkdevice.internal.discovery.DiscoveryParticipantClass1.checkAddress(DiscoveryParticipantClass1.java:77), org.openhab.binding.pjlinkdevice.internal.discovery.AbstractDiscoveryParticipant.lambda$0(AbstractDiscoveryParticipant.java:56), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624), java.lang.Thread.run(Thread.java:748)]

If it try to add the Projector manualy I see in the log this entry

2019-06-16 14:44:02.718 [hingStatusInfoChangedEvent] - ‘pjLinkDevice:pjLinkDevice:e19d51a1’ changed from UNINITIALIZED to INITIALIZING

==> /var/log/openhab2/openhab.log <==

2019-06-16 14:44:03.159 [WARN ] [kdevice.internal.device.PJLinkDevice] - Cannot handle introduction response pjlink 0

2019-06-16 14:44:03.166 [WARN ] [kdevice.internal.device.PJLinkDevice] - Could not create a socket connection

org.openhab.binding.pjlinkdevice.internal.device.command.ResponseException: Invalid header: pjlink 0

at org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice.connect(PJLinkDevice.java:149) [269:org.openhab.binding.pjlinkdevice:2.5.0.201903011503]

at org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice.connect(PJLinkDevice.java:88) [269:org.openhab.binding.pjlinkdevice:2.5.0.201903011503]

at org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice.checkAvailability(PJLinkDevice.java:206) [269:org.openhab.binding.pjlinkdevice:2.5.0.201903011503]

at org.openhab.binding.pjlinkdevice.internal.PJLinkDeviceHandler.setupDevice(PJLinkDeviceHandler.java:201) [269:org.openhab.binding.pjlinkdevice:2.5.0.201903011503]

at org.openhab.binding.pjlinkdevice.internal.PJLinkDeviceHandler.initialize(PJLinkDeviceHandler.java:182) [269:org.openhab.binding.pjlinkdevice:2.5.0.201903011503]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240]

at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

==> /var/log/openhab2/events.log <==

2019-06-16 14:44:03.241 [hingStatusInfoChangedEvent] - ‘pjLinkDevice:pjLinkDevice:e19d51a1’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): Invalid header: pjlink 0

If I use the Test Programm it works well and I got the follow responce

[2019.06.16 14:46:41.320] Connected!!!
[2019.06.16 14:46:41.595] RECV:pjlink 0

[2019.06.16 14:46:41.604] SEND:%1LAMP ?

[2019.06.16 14:46:41.764] RECV:%1lamp=4 1

[2019.06.16 14:46:41.771] Closed!!!(Disconnect)
[2019.06.16 14:46:45.049] Connected!!!
[2019.06.16 14:46:45.300] RECV:pjlink 0

[2019.06.16 14:46:45.306] SEND:%1INST ?

[2019.06.16 14:46:45.476] RECV:%1inst=11 21 31 32 41

[2019.06.16 14:46:45.481] Closed!!!(Disconnect)
[2019.06.16 14:46:46.460] Connected!!!
[2019.06.16 14:46:46.811] RECV:pjlink 0

[2019.06.16 14:46:46.816] SEND:%1NAME ?

[2019.06.16 14:46:47.075] RECV:%1name=Optoma UHD

[2019.06.16 14:46:47.080] 4F 70 74 6F 6D 61 20 55 48 44
[2019.06.16 14:46:47.087] Closed!!!(Disconnect)
[2019.06.16 14:46:48.172] Connected!!!
[2019.06.16 14:46:48.419] RECV:pjlink 0

[2019.06.16 14:46:48.424] SEND:%1INFO ?

[2019.06.16 14:46:48.677] RECV:%1info=UHD

[2019.06.16 14:46:48.683] Closed!!!(Disconnect)
[2019.06.16 14:46:49.580] Connected!!!
[2019.06.16 14:46:49.655] RECV:pjlink 0

[2019.06.16 14:46:49.659] SEND:%1INF1 ?

[2019.06.16 14:46:49.809] RECV:%1inf1=Optoma

[2019.06.16 14:46:49.814] Closed!!!(Disconnect)
[2019.06.16 14:46:50.491] Connected!!!
[2019.06.16 14:46:50.697] RECV:pjlink 0

[2019.06.16 14:46:50.701] SEND:%1INF2 ?

[2019.06.16 14:46:50.955] RECV:%1inf2=Optoma UHD

[2019.06.16 14:46:50.961] Closed!!!(Disconnect)
[2019.06.16 14:46:52.708] Connected!!!
[2019.06.16 14:46:52.960] RECV:pjlink 0

[2019.06.16 14:46:52.965] SEND:%1CLSS ?

[2019.06.16 14:46:53.217] RECV:%1clss=1

[2019.06.16 14:46:53.222] Closed!!!(Disconnect)
[2019.06.16 14:47:00.565] Connected!!!
[2019.06.16 14:47:00.881] RECV:pjlink 0

[2019.06.16 14:47:00.887] SEND:%1ERST ?

[2019.06.16 14:47:01.168] RECV:%1erst=000000

[2019.06.16 14:47:01.214] Closed!!!(Disconnect)
[2019.06.16 14:47:02.182] Connected!!!
[2019.06.16 14:47:02.487] RECV:pjlink 0

[2019.06.16 14:47:02.492] SEND:%1POWR ?

[2019.06.16 14:47:02.580] RECV:%1powr=1

[2019.06.16 14:47:02.585] Closed!!!(Disconnect)
[2019.06.16 14:47:02.846] Connected!!!
[2019.06.16 14:47:03.054] RECV:pjlink 0

[2019.06.16 14:47:03.060] SEND:%1INPT ?

[2019.06.16 14:47:03.288] RECV:%1inpt=41

[2019.06.16 14:47:03.295] Closed!!!(Disconnect)
[2019.06.16 14:47:03.392] Connected!!!
[2019.06.16 14:47:03.635] RECV:pjlink 0

[2019.06.16 14:47:03.640] SEND:%1AVMT ?

[2019.06.16 14:47:03.876] RECV:%1avmt=20

[2019.06.16 14:47:03.881] Closed!!!(Disconnect)
[2019.06.16 14:47:04.034] Connected!!!
[2019.06.16 14:47:04.137] RECV:pjlink 0

[2019.06.16 14:47:04.142] SEND:%1ERST ?

[2019.06.16 14:47:04.308] RECV:%1erst=000000

[2019.06.16 14:47:04.313] Closed!!!(Disconnect)
[2019.06.16 14:47:04.446] Connected!!!
[2019.06.16 14:47:04.705] RECV:pjlink 0

[2019.06.16 14:47:04.709] SEND:%1LAMP ?

[2019.06.16 14:47:04.764] RECV:%1lamp=4 1

[2019.06.16 14:47:04.768] Closed!!!(Disconnect)
[2019.06.16 14:47:04.864] Connected!!!
[2019.06.16 14:47:05.014] RECV:pjlink 0

[2019.06.16 14:47:05.018] SEND:%1INST ?

[2019.06.16 14:47:05.344] RECV:%1inst=11 21 31 32 41

[2019.06.16 14:47:05.349] Closed!!!(Disconnect)
[2019.06.16 14:47:05.437] Connected!!!
[2019.06.16 14:47:05.602] RECV:pjlink 0

[2019.06.16 14:47:05.606] SEND:%1NAME ?

[2019.06.16 14:47:05.686] RECV:%1name=Optoma UHD

[2019.06.16 14:47:05.690] 4F 70 74 6F 6D 61 20 55 48 44
[2019.06.16 14:47:05.693] Closed!!!(Disconnect)
[2019.06.16 14:47:06.024] Connected!!!
[2019.06.16 14:47:06.095] RECV:pjlink 0

[2019.06.16 14:47:06.099] SEND:%1INFO ?

[2019.06.16 14:47:06.329] RECV:%1info=UHD

[2019.06.16 14:47:06.333] Closed!!!(Disconnect)
[2019.06.16 14:47:06.465] Connected!!!
[2019.06.16 14:47:06.549] RECV:pjlink 0

[2019.06.16 14:47:06.553] SEND:%1INF1 ?

[2019.06.16 14:47:06.746] RECV:%1inf1=Optoma

[2019.06.16 14:47:06.750] Closed!!!(Disconnect)
[2019.06.16 14:47:06.935] Connected!!!
[2019.06.16 14:47:07.145] RECV:pjlink 0

[2019.06.16 14:47:07.150] SEND:%1INF2 ?

[2019.06.16 14:47:07.436] RECV:%1inf2=Optoma UHD

[2019.06.16 14:47:07.440] Closed!!!(Disconnect)
[2019.06.16 14:47:07.586] Connected!!!
[2019.06.16 14:47:07.634] RECV:pjlink 0

[2019.06.16 14:47:07.638] SEND:%1CLSS ?

[2019.06.16 14:47:07.798] RECV:%1clss=1

[2019.06.16 14:47:07.801] Closed!!!(Disconnect)

I guess your device responds with lowercase prefixes (e.g. pjlink 0 instead of PJLINK 0). I’ll try to provide a version which is able to handle that till next weekend.

Unfortunately I first need to get my development environment working again after the numerous changes introduced by the ESH integration and new build system, that’s why it will take some time even if it’s only a small adjustment.

Hi @Matthias1,

I’ve built a version which should ignore case when parsing responses from the projector.

It’s available from a different location than usual as it seems like the pull request builder is currently broken.

Please test it and let me know if it resolves the issues you were experiencing.

Best Regards,
Nils

Edit: Removed github release link

Hi Nils
Thx a lot now it’s works…

Hi @nils.schnabel,
I tried installing the version org.openhab.binding.pjlinkdevice-2.5.0-SNAPSHOT.jar manually into my openhab 2.5.0.M3 installation. I used the console to install that jar bundle but when starting, it provides the following error:
Error starting bundle 280: Could not resolve module: org.openhab.binding.pjlinkdevice [280]
Unresolved requirement: Import-Package: org.apache.commons.net.util; version="[3.3.0,4.0.0)"

Any ideas ?
Thanks, Daniel.

Hi Daniel,

I assume you downloaded the file from github that I wrote here some posts ago. That’s an outdated build. Because the pull request builder is working again you should download the file from the location mentioned in the opening post of this thread.

I don’t want to copy the link here to avoid that I have to update it everywhere whenever it changes. Please go to the opening post of this thread and download the current JAR using the link on

The lastest JAR can be found here

Best Regards,
Nils

P.S. 2.5.0.M4 will have the binding included, so when it will be released, there won’t be a need for manual installing of JARs any more :slight_smile:

PPS: Just noticed that M4 is already released! So you could also go and update to M4, if that’s an option for you.

1 Like

Excellent. Thanks for the quick answer @nils.schnabel.
It worked ! I upgraded to M4 today and the binding is there and automatically discovered my Optoma beamer.
Just one problem surfaced: I turned on Power_State AutoPoll in the binding settings and the binding goes offline with the following error message in the logs:
" (COMMUNICATION_ERROR): Expected prefix ‘%1POWR=’, instead got ‘%1powr=0’ "
Can I fix this myself with a mapping ?
I had to turn off the Power_State polling again for now.
Thanks for your support :slight_smile:

Cheers, Daniel.

Hi Daniel,

good to know that the version shipped with M4 works for you in general!

The problem you have reported looks similar to an issue that was solved before. I’ll try to provide a new version/jar with a fix till Saturday. (Yay JAR installation! :smiley:)

Best Regards,
Nils

Hi,

Under the last stable version,I also have this problem:
2020-01-11 19:51:09.915 [hingStatusInfoChangedEvent] - ‘pjLinkDevice:pjLinkDevice:192_168_0_52_4352’ changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Expected prefix ‘%1POWR=’, instead got ‘%1powr=1’

2020-01-11 19:51:09.923 [hingStatusInfoChangedEvent] - ‘pjLinkDevice:pjLinkDevice:192_168_0_52_4352’ changed from OFFLINE (COMMUNICATION_ERROR): Expected prefix ‘%1POWR=’, instead got ‘%1powr=1’ to OFFLINE (COMMUNICATION_ERROR): Cannot understand status: 20

2020-01-11 19:51:09.931 [hingStatusInfoChangedEvent] - ‘pjLinkDevice:pjLinkDevice:192_168_0_52_4352’ changed from OFFLINE (COMMUNICATION_ERROR): Cannot understand status: 20 to ONLINE

Connexion is with an Optoma projector.

If you have a solution, let me know.

Thanks in advance.

Hi @ifred , hi @dhopkins1000 ,

could you please try this version of the addon: https://github.com/nils/openhab2-addons/releases/download/2.5.4-SNAPSHOT/org.openhab.binding.pjlinkdevice-2.5.4-SNAPSHOT.jar

That version has some improved logging that should allow me to find the reason for the issues you are facing. Please install the JAR in your addons folder and copy the log files here.

Best Regards,
Nils

@nils.schnabel

Hi Nils

Thanks for your great work.

Just to let you know, I’ve just installed an Optoma UHD65 and tried PJLink (binding available within 2.5.6) for the very first time.

https://petertyson.co.uk/optoma-uhd65-projector

PaperUI didn’t find it automatically, but creating the Thing in PaperUi, with just the IP and default password (12345) worked like a charm.

It provides Items for :

  • Power
  • Input
  • Mute

But as I only wanted Power & Input, that’s perfect :smile:

Thanks again

(Small detail that the Thing goes off-line when the projector is OFF, but I suspect this is a setting in the projector that is turning off the network connection)

1 Like

Hi,

I come back very late, but, I tested the new one today. Looks good.

Automatically find the optoma, and configuration looks ok.

I will do more tests soon.

Thanks,

I know this is quite an old thread…but, I’ve just got a Optoma Projector which supports PJLink. I’ve got it connected to the Openhab using the binding fine - thanks for the tips here on auto-discovery not working.

Question I have is that I want to send some commands to the projector - actually to change the zoom - Using the TCP Set command. Is this possible via the TP Link Binding? Or do i need to try a different route? It looks like you can use Set and Get commands as part of the PJLink v1 protocol.

Hi Pete,

unfortunately there is no such thing like a generic “TCP Set Command”.

You can see what the PJLink protocol supports by looking at the specification.

There, you’ll only find these commands:

  • Power control instruction
  • Input switch instruction
  • Mute instruction
  • Speaker volume adjustment instruction*
  • Microphone volume adjustment command*
  • Freeze instruction*

* these are PJLink Class 2 features not (yet?) supported by the binding

PJLink is a cross-vendor standard with a very basic feature scope. For more advanced features, you should check if there is any vendor-specific protocol available for your projector.

Best Regards,
Nils