Hi All, long time Vera user, but newbie when it comes to Lua/Luup/scripting. I recently discovered how to incorporate luup code into scenes, but I have pretty much used examples found in the forums that matched the devices I was trying to control. Namely, a Panasonic TV in my kitchen and the Monoprice 6-zone Whole Home Audio receiver. The luup code for both of these devices are sent through an IP2IR Itach for my Panasonic TV and IPSerial Itach for the Monoprice. I am now able to have my wife ask Alexa to turn on TV in the kitchen as well as turn on Kitchen Speakers.
I also have the same Panasonic TV in my kids play room connected to an older Pioneer receiver. Both of these devices are controlled through the same IP2IR itach as the kitchen Panasonic TV. I have a few different gaming consoles connected into the Pioneer including a PS3 in HDMI 1, Classic Super Nintendo in HDMI 2 and a Mac Mini in HDMI 3.
I am trying to create a scene that will 1) Turn on Panasonic TV, 2) Switch Panasonic TV to HDMI 1 (in case its not as my kids often touch buttons on remotes), 3) Turn on Pioneer Receiver and 4) Turn Pioneer Receiver to HDMI 1. Then I want my kids to be able to ask Alexa to Turn On Super Nintendo and everything turns on and switches over for them.
I have all 4 necessary IR commands in the luup code that do work individually. However when I add all 4 codes and test the code on Vera, it will only turn on the TV and the Receiver, but it will not switch the HDMI ports on either the TV or receiver. When I press the test button again, it then will change both HDMI ports. I think I need to insert delays between the 4 IR commands as it takes a moment for the TV and the receiver to turn on. I have tried to research luup.call delay for the past day or so, but I cannot figure out what the commands I am supposed to add for this.
In other control programs I have used (Simple Control and IRule) I can set the delay between commands at whatever interval I want. I cannot figure it out here though. Anyone have any tips or pointers for me on how to achieve what I am trying to do? Here is the code that I am using for simply turning on the Panasonic TV and then trying to switch to HDMI 1. When I test this, it will only turn on the TV…when I test a 2nd time, it will then switch the input to HDMI 1…
local CommandtoSend
CommandtoSend= ‘sendir,1:1,1,37000,1,1,128,63,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,48,16,2712,\r’
print (“test:”, CommandtoSend)
– Connect and Send Command
local socket = require(“socket”)
host = “10.0.1.124” --IP2IR Living Room
c = assert(socket.connect(host, 4998))
c:settimeout(5)
local sres, serr = c:send(CommandtoSend)
print(“Send:”, sres, serr)
local data, rerr = c:receive(5)
print (“Receive:”, data, rerr)
local CommandtoSend
CommandtoSend= ‘sendir,1:1,1,37000,1,1,132,67,17,17,17,51,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,51,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,51,17,17,17,17,17,51,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,51,17,51,17,17,17,51,17,17,17,17,17,51,17,17,17,51,17,51,17,17,17,17,17,2846,\r’
print (“test:”, CommandtoSend)
– Connect and Send Command
local socket = require(“socket”)
host = “10.0.1.124” --IP2IR Living Room
c = assert(socket.connect(host, 4998))
c:settimeout(5)
local sres, serr = c:send(CommandtoSend)
print(“Send:”, sres, serr)
local data, rerr = c:receive(5)
print (“Receive:”, data, rerr)
c:close()
Any help is greatly appreciated and thanks in advance. My kids will thank you too