RS-232 Can not get code to work

Hi guys,

I am trying to figure this out with no luck at all. Have read as much as I could, and trying to understand but it just is not working.
I am trying to send a Hex Code to my russound CAV6, I am successful in sending it using Global Cache itest. When I put the hex code into a lua script and try running it in vera, I get a message that says code sent OK, but nothing happens on the Russound.

I am using the follwoing:
Netwon GW212 (www.neteon.net/products/serial-ethernet-device-servers/gw212.html)
The GW212 is set to use port 5000 ip is 192.168.1.101

Hex Code I am trying to run is (which works with itest):

F0 00 00 7F 00 00 70 05 02 02 00 00 F1 23 00 01 00 05 00 01 17 F7

Lua script I am trying:

local socket = require(“socket”)
host = “192.168.0.101”
c = assert(socket.connect(host, 5000))
c:settimeout(5)

local sres, serr = c:send(string.char(F0 00 00 7F 00 00 70 05 02 02 00 00 F1 23 00 01 00 05 00 01 17 F7))
print(“Send:”, sres, serr)
local data, rerr = c:receive(300)
luup.log (data)
print (“Receive:”, data, rerr)

c:close()

I have tried entering it:

0xF0,0x00,0x00,0x7F,0x00,0x00,0x70,0x05,0x02,0x02,0x00,0x00,0xF1,0x23,0x00,0x01,0x00,0x00,0x00,0x01,0x12,0xF7
F0,00,00,7F,00,00,70,05,02,02,00,00,F1,23,00,01,00,05,00,01,17,F7
F0/00/00/7F/00/00/70/05/02/02/00/00/F1/23/00/01/00/05/00/01/17/F7

Any thoughts on how I can enter the hex code? Am i missing something?

Thanks

try using:

local socket = require(“socket”)
host = “192.168.1.101”
c = assert(socket.connect(host, 5000))
c:send(string.char(0xF0,0x00,0x00,0x7F,0x00,0x00,0x70,0x05,0x02,0x02,0x00,0x00,0xF1,0x23,0x00,0x01,0x00,0x00,0x00,0x01,0x12,0xF7))
data = c:receive(300)
luup.log (data)
print (data)
c:close()

Thanks! Worked perfectly.

No problem, I am sure others might have a better way of sending it, but that is what I use for my roussound.

You might also want to have a timeout after line 3
c:settimeout(5)

(I think you had that in your original post)