GC100 - What to expect?

I’m running Vera UI7, with the GC100 plugin. I see the plugin, I’ve added my IP Address and MAC to it… and now what?

I mean, I see the item in th elist of devices, but there’s no controls. What should I expect to be able to see/do with it? Can I use it in PLEG for example?

It’s been a while since I used that plugin but I believe you need to use scenes and the advanced editor or PLEG or reactor. I have an GC iTach and use Lua to send the Global Cache commands to it. I can give you examples of the code if you want but I do not have access to my system right this minute. Also be aware that the GC-100 only allows one connection at a time so if your Vera is using it. It will not be available to other utilities like one of the mobile remote apps out there.

1 Like

Cool…

So if I use PLEG, do I need to send the entire command to it, or can I reference the saved ones that are on the iTach?

I just installed the plugin and I am not sure about the compatibility with PLEG. It seems the 3 ports for the iTach do not show up under PLEG. This may be the reason I opted to not use the plugin back when I was using PLEG. I have since switched to Reactor for the logic programming. The ports are there in Veras advanced scene editor and under Reactor. I suppose if you encounter the same thing you can set up a Vera scene and execute it via PLEG as a work around. I also think the naming of the ports is a bit confusing.

CG100 I/R Port = Port 1
CG100 I/R Port 1 = Port 2
CG100 I/R Port 2 = Port 3

Yes you would send the entire command. It looks like the plugin is looking for HEX Pronto

If you would like to not use the plugin and use Lua instead you can send a command using the following as an example.

–[[Samsung TV power on----]]
local socket = require(“socket”)
tcp = assert(socket.connect(“itach IP here”, 4998))
tcp:send(“sendir,1:3,1,38000,1,1,172,172,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,64,22,64,22,21,22,21,22,64,22,21,22,64,22,64,22,21,22,21,22,64,22,64,22,21,22,1820” … “\r\n”)
luup.sleep(1050)
tcp:close()

The 3 after the colon is the port (sendir,1:3,1,38000,1) The 1 following 38000 is the repeat, just change the 1 to the number of times you need the command to fire if needed.

Both GC and Hex Codes can be obtained from the Global Cache Control Tower

https://irdb.globalcache.com/

Running this code in te Lua test, powers my TV off just fine.

commandtosend = 'sendir,1:3,1,38000,1,1,172,172,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,64,22,64,22,21,22,21,22,64,22,21,22,64,22,64,22,21,22,21,22,64,22,64,22,21,22,1820'
commandtosend = commandtosend .. ',\r'
local socket = require("socket")
c = assert(socket.connect("10.0.0.60", 4998))
c:settimeout(5)
local sres, serr = c:send(commandtosend)
local data, rerr = c:receive(5)
c:close()

However, this fails:

require "ircommand"
ircommand.Power_off()

Says: Failed to test code, please try again

Log says:

08      06/09/19 22:31:46.085   JobHandler_LuaUPnP::HandleActionRequest argument action=RunLua <0x71e33520>
08      06/09/19 22:31:46.085   JobHandler_LuaUPnP::HandleActionRequest argument Code=require "ircommand"

ircommand.3d() <0x71e33520>
01      06/09/19 22:31:46.086   LuaInterface::LoadCode: [string "require "ircommand"..."]:4: malformed number near '.Power_off' <0x71e33520>
01      06/09/19 22:31:46.086   JobHandler_LuaUPnP::RunLua failed: require "ircommand"


ircommand.3d() <0x71e33520>
02      06/09/19 22:31:46.086   JobHandler_LuaUPnP::RunAction d

snippet of ircommand.lua is:

module("ircommand", package.seeall)
local cmd

function POWER_OFF()
cmd = 'sendir,1:3,1,38000,1,1,173,173,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,21,21,65,21,65,21,65,21,65,21,21,21,21,21,65,21,65,21,21,21,1832'
sendir(cmd)
end

function sendir(commandtosend)
commandtosend = commandtosend .. ',\r'
local socket = require("socket")
c = assert(socket.connect("172.0.0.10", 4998))
c:settimeout(5)
local sres, serr = c:send(commandtosend)
local data, rerr = c:receive(5)
c:close()
end