Logic Machine Forum
PJLINK to Panasonic Projector - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: PJLINK to Panasonic Projector (/showthread.php?tid=2606)



PJLINK to Panasonic Projector - manos@dynamitec - 22.04.2020

Hello All,



I need to control a Panasonic Projector which is compatible with the PJLINK (TCP/IP) protocol on port 4352.



I will need to send some hex or character commands to the IP 192.168.1.98 port 4352. Please see below example:



Power ON :
CHARACHTER =>    %1POWR(SP)0(CR)
HEX =>   25 31 50 4f 57 52 20 30 0d


Can this be done via an event script triggered by a virtual object?


HomeLynk V3.0 FW:2.4.0

Thank you in advance


RE: PJLINK to Panasonic Projector - admin - 22.04.2020

Event script mapped to binary on/off object:
Code:
value = event.getvalue() and 1 or 0
sock = require('socket').tcp()
cmd = '%1POWR ' .. value .. '\r'
sock:settimeout(1)
res, err = sock:connect('192.168.1.98', 4352)

if res then
  res, err = sock:receive(9)

  if res and res == 'PJLINK 0\r' then
    sock:send(cmd)
    res, err = sock:receive(10)
    log('receive reply', res, err)
  else
    log('receive init failed', res, err)
  end
else
  log('connect failed', err)
end

sock:close()
Result and any errors will be visible in Logs tab. You can remove log() calls if everything is working correctly.


RE: PJLINK to Panasonic Projector - manos@dynamitec - 22.04.2020

(22.04.2020, 14:55)admin Wrote: Event script mapped to binary on/off object:
Code:
value = event.getvalue() and 1 or 0
sock = require('socket').tcp()
cmd = '%1POWR ' .. value .. '\r'
sock:settimeout(1)
res, err = sock:connect('192.168.1.98', 4352)

if res then
  res, err = sock:receive(9)

  if res and res == 'PJLINK 0\r' then
    sock:send(cmd)
    res, err = sock:receive(10)
    log('receive reply', res, err)
  else
    log('receive init failed', res, err)
  end
else
  log('connect failed', err)
end

sock:close()
Result and any errors will be visible in Logs tab. You can remove log() calls if everything is working correctly.


Thank you Admin. I will try tomorrow.

If I need to send the command ON only when the object has a value 1 (True) then OFF using an other object with value 1 (TRUE) then the code will be like?:
Code:
value = event.getvalue()
sock = require('socket').tcp()
cmd = '%1POWR 1\r'  --OR '%1POWR 0\r' for OFF
sock:settimeout(1)
res, err = sock:connect('192.168.1.98', 4352)

if value and res then
  res, err = sock:receive(9)

  if res and res == 'PJLINK 0\r' then
    sock:send(cmd)
    res, err = sock:receive(10)
    log('receive reply', res, err)
  else
    log('receive init failed', res, err)
  end
else
  log('connect failed', err)
end

sock:close()



RE: PJLINK to Panasonic Projector - admin - 22.04.2020

The example already handles this, don't change anything.


RE: PJLINK to Panasonic Projector - YOUSSEF - 04.11.2020

Hello admin
am trying an event based script to change input based on  
11: RGB 1
31: HDMI 1
32: HDMI 2
nothing is working :/ any help on this 
tks


RE: PJLINK to Panasonic Projector - manos@dynamitec - 04.11.2020

(04.11.2020, 15:16)YOUSSEF Wrote: Hello admin
am trying an event based script to change input based on  
11: RGB 1
31: HDMI 1
32: HDMI 2
nothing is working :/ any help on this 
tks

Hello Youssef, please see below my code that worked without problems. The trigger value was always set to ON (1) for me. Make sure that the password for the user account is empty and that the webcontrol and PJLINK is active on the projector settings. 

You have to change the '12' (input source) to your values every time and also change the IP address/Port to match your installation. 

Code:
--Projector Input RGB1 triggered by event script
--Sends the command via the PJLINK Protocol to the Projector

value = event.getvalue() and 1 or 0
sock = require('socket').tcp()
cmd = '%1INPT ' .. 11 .. '\r'
sock:settimeout(1)
res, err = sock:connect('192.168.1.98', 4352)
if res then
res, err = sock:receive(9)
if res and res == 'PJLINK 0\r' then
sock:send(cmd)
res, err = sock:receive(10)
log('receive reply', res, err)
else
--log('receive init failed', res, err)
end
else
--log('connect failed', err)
end
sock:close()



RE: PJLINK to Panasonic Projector - YOUSSEF - 05.11.2020

Thank you ,perfect


RE: PJLINK to Panasonic Projector - YOUSSEF - 10.06.2021

Hello 
am having problems reading informations like state of the projector: 
%POWR ? (power on off)
%1ERST ? (errors) 
Lens working hours?
 
should it be resident script? any help ? Thank you


RE: PJLINK to Panasonic Projector - admin - 10.06.2021

You either need a resident or a scheduled script depending on how often you want to read the status.
Try this example, you might need to install 2021 firmware as *r pattern is not supported in older firmwares. Change IP/port as needed. If the status read works then the script can be modified to write info into objects.
Code:
sock = require('socket').tcp()
sock:settimeout(1)
res, err = sock:connect('192.168.1.98', 4352)

if res then
  res, err = sock:receive('*r')
  
  if res and res == 'PJLINK 0' then
    sock:send('%POWR ?\r')
    res, err = sock:receive('*r')  
    log('received powr reply', res, err)

    sock:send('%1ERST ?\r')
    res, err = sock:receive('*r')  
    log('received error reply', res, err)

    sock:send('%1LAMP ?\r')
    res, err = sock:receive('*r')  
    log('received lamp reply', res, err)
  else
    log('receive init failed', res, err)
  end
else
  log('connect failed', err)
end

sock:close()



RE: PJLINK to Panasonic Projector - YOUSSEF - 11.06.2021

this is the log am getting 

* arg: 1
  * string: receive init failed
* arg: 2
  * string: PJLINK 0
* arg: 3
  * nil



I did the install the the 2021 FW,


RE: PJLINK to Panasonic Projector - admin - 11.06.2021

The new pattern strips the \r character. I've modified the script, please try again.


RE: PJLINK to Panasonic Projector - YOUSSEF - 11.06.2021

Correct, Big thanks