TCP Send and receive data for GC100 control

I am using GC100 to detect Video signal for IR Control. I installed GC100 Plug for sensor detection and worked ok. However, I found the device# for this sensor will change on and off (maybne due to reboot, network whatever). Recently I even found not notification. I set it Autonotify. Anyway, I decided to check it by sending TCP command using the following code:

local socket = require(“socket”)
local tcp = assert(socket.tcp())
tcp:connect(IP, Port)
local reply = tcp:receive(50)

if (reply == “state,4:3,1”) then
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “1”}, 26)
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “0”}, 26)

However, I found no data reply back after send. Does anyone help me fix the problem and let me where the issue behind? What’s a good appraoch for TCP send then receive? Appreciate for your support in advance. Thank.

Best regards,

I have checked the error. It always prompts me “timeout” on receive() after send(). Howver, I can use GCScan.exe to send the same command then get the status properly. Something wrong on this code or logic? Anyone can help???

local IP = “”
local Port = “4998”
local Command = “getstate,4:3\r”

local socket = require(“socket”)
c = assert(socket.connect(IP, Port))
local sres, serr = c:send(Command)
local reply, rerr = c:receive()

The GC100 devices only allow one connection to the device at a time.
If you have a GC100 driver attached to the device … you can NOT talk to it with another TCP connection.

HI RichardT,

Apprecaite for your advice. I make sure no GC100 plug in and testing tools running on at the same time. I can get the state on GC Test then I close it then put above code into App Luup Test but still got timeout in receive(). Is my code correct to get the return after the command was send? Anything I can test?

I also found another intersting thing that all my Vera devices (whatever it ia Vera3, VeraLite running UI5 or VeraEdge runnig UI7) will suddently re-appear GC100 Plug-In again (I’m sure to sucessfully uninstall GC100-Plug on these deveices before) when GC100 power off then on. Sometime, it may to related to the change of port mode configuration. Do you know why? It will affect a new device # on those sensors…Is it a bug on plug-in? I just install from market, should I use some latest version somewhere?

Thank you so much :slight_smile:

Best regards,

I have changed from GC100-12 to GC100-6. The problem seems to disappear. However, I found all “uninstalled” GC100 Plug-in will appear on other Vera Units when GC100 has restarted. It is very annonying. Can anyone point me how to fix it so that unisntalled GC100 Plugin will not appear again. I tried to follow a clear uninstall steps to remove UPnP Event but nothing helps.

Im about to start learning the gc100 plugin (it looks hard on the face of this thread). When I install the plugin it shows in “my apps” but not in the device list so I cannot use/configure it.

Can anyone help?