I have controlled my projector screen (and other IR devices) for a while with Vera as described in the ?NOTE? below. The problem is that my projector screen goes too far down. Adjusting the default stop mechanism of my screen (from Elite Screens) is rather cumbersome. Either it goes down to max length (default) or I have to actually open it and adjust the mechanical off (max) switch manually.
So, this is how I solved this with Vera:
NOTE: See this thread for preperation http://forum.micasaverde.com/index.php?topic=47918.0
First I clocked the screen to take exactly 55 seconds to my wanted ?max low position?.
Then I added a delayed action into the lua file (ircommand.lua) like this.
function screendown() -- Prepare to send screen stop command after 55 sec cmd = 'sendir,1:3,1,38000,1,1,17,46,17,1141,46,18,46,18,46,18,46,18,17,46,17,46,17,46,17,47,17,46,17,46,17,46,46,18,17,46,46,18,17,46,46,18,46,18,46,18,17,46,17,46,46,18,46,18,17,46,17,47,17,46,46,18,46,18,46,18,46,18,17,46,17,46,17,3700' luup.call_timer('sendir',1,'55','',cmd) -- Start lowering screen cmd = 'sendir,1:3,1,38000,1,1,47,15,47,15,47,15,47,15,15,47,15,47,15,47,15,47,15,47,47,15,15,47,15,1329,47,15,47,15,47,15,47,15,15,47,15,47,15,47,15,47,15,47,47,15,15,47,15,3379' sendir(cmd) end
For the call_timer function to work, that means for the call_timer function too recognize the ?sendir? function, the latter needs to be global. To do this change ?function sendir(commandtosend)? to ?function _G.sendir(commandtosend)?, so the senddir function should now look like this:
function _G.sendir(commandtosend) commandtosend = commandtosend .. ',\r' local socket = require("socket") c = assert(socket.connect("192.168.1.97", 4998)) c:settimeout(5) local sres, serr = c:send(commandtosend) local data, rerr = c:receive(5) c:close() end
That’s all. If anyone see any issues, or suggestions to do it better please give feedback.