Hello,
I have a Vera plus since 5 years. I would like to create a Luup code to switch on my TV (Sony Bravia)
First I have to switch on the MyStrom Switch with http get request to switch on all my equipment pluged (TV, Sat …, wait for about 120 sec, send a tcp command to wake up the Sony Bravia, wait for 10 sec, and send a tcp command to choose a specifical function on my Sony Bravia.
I tested each commands separatly, it works. I have a problem to include wait function.
I wrote this code :
local socket = require("socket")
local host, port = "10.1.6.5", 20060
local tcp = assert(socket.tcp())
local delay1 = 120
local delay2 = 10
http = require("socket.http")
http.request{
url = "http://10.1.9.6/relay?state=1"
}
tcp:connect(host, port);
tcp:send("*SCPOWR0000000000000001\n");
luup.call_delay(delay1)
tcp:connect(host, port);
tcp:send("*SCIRCC0000000000000100\n");
But this code doesn’t work.
Anybody can help me to resolve it ?
Thanks in advance.
gvals