Jump to content
  • 0

VD & TCP/IP Commands


Question

Hi All,

I am trying to get a understanding of creating VD's for control of my TV's and projector. I was able to download a VD from the Fibaro Market Place for my Panasonic TV which works. I am currently running v4.580

I have spent the last 2 days trying all sorts of different LUA codes to try and control my JVC projector which I can control via telnet from my laptop though I am stuck trying to do this from a VD. Below is what I have tried and the projector requires the following TCP/IP command PJREQ first then it leaves the socket open for 5 secs so you can send the next command. I am only looking to be able to turn it on & off. In the example below is the HEX string to turn the projector ON............apologies this is all new to me so any help would be very much appreciated

 

I have already assigned the correct IP address and Port in the advanced section of the VD..........I just can't workout how to sent the actual command strings

 

local device = fibaro:getSelfId();
local ipaddress = fibaro:getValue(device, "IPAddress");
local port = fibaro:getValue(device, "TCPPort");
FIBARO = Net.FHttp(ipaddress, port)
tcpSocket:write(string.char(PJREQ))
tcpSocket:setReadTimeout(5000);
tcpSocket:write(string.char(PJREQ));
tcpSocket:write(string.char(21 89 01 50 57 31 0A));
tcpSocket = Net.FTcpSocket(ip, port);

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I have just added an article on Lua programming for virtual devices which you can find here: https://snys.nl/?page=domotica/en/fibaro_lua_api_virtual_device.html

Hope that helps with the lua comms side of things. Let me know if there is anything missing or I haven't explained something correctly.

 

Have you written a telnet client before? I seem to remember there is some sort of NVT (network virtual terminal) handshake required on connection setup which might be a bit tricky to start with. Once that's over it should be simple enough.

 

Let us know how you get on, good luck. T

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...