I have a fairly extensive Micasa Verde Z Wave setup at my house. Now I’m trying to incorporate my PWM RGB LED strings into the system. I’ve modified and RGB RGB amplifier to drive PWM RGB Light strips. I’m using an iTach Wifi23IR set to PWM LED mode to drive the amp channels. Using the Global Cache iTest app as a test platform I have programmed several buttons in my iRule app that work really well, but iRule has no way to automate commands.
What I would like to do use some automated scenes based on times. Here is a screen grab of the iTest app. What I would like to do is to send the literal command string “set_LED_Lighting,1:1,0,5” to IP Address: 169.254.1.70 using port 4998.
Can anyone please throw out a few ideas or point me in the right direction?
I tried to run this with no result or error on Vera, I’m lost. I attempted to locate each command definition and syntax for the code online without success. In a Lua.org demo program it returns “input:1: attempt to call global ‘require’ (a nil value)”. This is going to be painful but I need to automate my bar lights!
Can anyone see the error or point me to some decent documentation for has been CompSci that would help me to figure it out? All the Pascal, Fortran, Assembly and Machine language courses I took in college are forgotten.
local socket = require(“socket”)
host = “169.254.1.74”
c = assert(socket.connect(host, 4998))
c:send(“set_LED_LIGHTING,1:1,9,5”)
c:close()
function VeraAlert(Port, Msg)
local Host = "192.168.10.100"
local socket = require("socket")
local tcp = socket.tcp()
tcp:settimeout(3)
if (tcp:connect(Host, Port)) then
if (tcp:send(Msg)) then
else
print("Error Sending Msg")
end
else
print("Error Opening Socket")
end
tcp:close(socket)
end
I am not sure if you are getting a TCP or UDP socket.
Maybe you device needs a line feed to terminate the command!
OK I got it using the suggested code. Thank you very much for your help futile and Richard
local socket = require(“socket”)
host = “169.254.1.74”
c = assert(socket.connect(host, 4998))
c:send(“set_LED_LIGHTING,1:3,9,5\013”)
c:close()
Heres another question. Why do you think this doesn’t work? Should I add a pause between send commands. Could the stream may be too fast for the Global Cache box?
local socket = require(“socket”)
host = “169.254.1.74”
c = assert(socket.connect(host, 4998))
c:send(“set_LED_LIGHTING,1:3,9,5\013”)
c:send(“set_LED_LIGHTING,1:3,9,5\013”)
c:send(“set_LED_LIGHTING,1:3,9,5\013”)
c:close()
The Global Cache has a command/response protocol.
A guess is the Device might not accept any more commands until you eat (read) the response it sends from the previous command.
That sounds reasonable. I used three sets of the code, one for each color channel in the Lua Code and it works fine. All of the functions that the Global Cache boxes use are similar so I can also use this to close contacts, send other IR commands, etc. later as I expand the system.
Thanks for you input and help.
Best Home Automation shopping experience. Shop at Ezlo!