![]() |
|
Send Hex Values to an ser2net device - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Send Hex Values to an ser2net device (/showthread.php?tid=492) |
Send Hex Values to an ser2net device - Habib - 07.12.2016 Hi, I want to control my samsung smart TV via Visu/KNX. For that I setuped a Linux device with ser2net (local serial RS232 to TV) and connected them to my TV. The debug console from TV over ser2net works perfectly, but I can't send some hex values to control functions. How can I send via telnet from spaceLYnk some hex values like "082200000001d5 " or in this syntax "\x08h\x22h\x00h\x00h\x00h\x01h\xd5h" Can somebody give me one example? with this command I get an connection: telnet 192.168.100.55 4001 Thx forwards Regards Habib RE: Send Hex Values to an ser2net device - admin - 07.12.2016 Try this: Code: require('socket')
ip = '192.168.1.11'
port = 1234
data = string.char(0x08, 0x22, 0x00, 0x00, 0x00, 0x01, 0xd5)
sock = socket.tcp()
sock:settimeout(5)
res, err = sock:connect(ip, port)
if res then
res, err = sock:send(data)
if not res then
alert('send error ' .. tostring(err))
end
else
alert('connect error ' .. tostring(err))
end
sock:close() |