Global Cache "getstate" quesiton and help

I’ve used LUUP in several scenes to send commands to global cache units to control PWM LED’s and close contacts with excellent results. I want to write a LUUP procedure to:

Check the state of a port on a Global Cache GC-100 and if it returns a 0 perform an action and if it returns a 1 perform another action. It has been a quite a while since I did heavy programming and I need help

I think I can use the Global Cache get_state command: get_state,1:1 (where the first 1 is the module and the second 1 is the port). This command will return “state,1;1,0” (low or off) or "state,1:1,1 (high or on)

With this state information I would like to if/then some commands. I’m comfortable with the commands but I’m having trouble understanding how I can get the returned state data.

Does anyone have experience coding this in LUUP? Is it even possible?

The following is what I’m looking for

local socket = require(“socket”)
host = “192.168.1.79”
c = assert(socket.connect(host, 4998))
c:send(“get_state,1:1”)
.
.
IF state,1:1,0
Then
.
Else
.
EndIf

c:close()

No replies… :frowning: Could I have posted this in the wrong place?