[quote=“a-lurker, post:100, topic:198239”]@pCleavage The luup.sleep() function may cause the Luup engine to restart if you use delays greater than about one second. You can use luup.delay() for longer delays but it only has second resolution, rather millisecond resolution. You could try this code in the Lua test code box and see if works for you:
[code]local IRDeviceID = 531
local resetInputSelList = ‘26 00 78 00 00 01 28 91 15 10 15 10 15 10 15 10 15 10 15 10 15 34 15 10 15 35 17 32 16 34 15 35 15 34 15 35 15 10 15 34 15 10 15 10 15 35 15 10 15 10 15 10 15 34 15 10 15 35 15 34 15 10 15 35 15 34 15 35 15 10 15 34 15 00 05 16 00 01 29 47 15 00 0c 44 00 01 28 47 17 00 0c 42 00 01 29 47 16 00 0c 43 00 01 28 47 15 00 0c 44 00 01 2a 45 18 00 0c 42 00 01 2a 45 15 00 0d 05’
local input8ButtonPress = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’
local steps = {
– Turn TV ON and wait 1 second
{delay = 1, code = ‘26 00 50 00 00 01 29 91 15 10 15 10 15 10 15 10 15 10 15 0f 16 34 15 10 15 34 16 34 15 35 15 34 15 35 15 34 16 0f 16 34 15 10 15 34 16 0f 16 0f 16 34 15 10 15 10 15 10 15 34 16 0f 16 34 15 34 16 10 15 34 15 35 15 34 15 00 05 16 00 01 28 47 15 00 0d 05 00 00 00 00 00 00 00 00’},
– Turn ON Xbox One and wait 8 seconds
{delay = 8, code = ‘0000 006D 0000 0024 0151 00A7 0016 0015 0017 0014 0016 0015 0015 0016 0015 0016 0015 0016 0015 0016 0015 003F 0016 0014 0017 0014 0016 0016 0015 003F 0016 003F 0016 0015 0016 003F 0015 0040 0015 0016 0015 0040 0015 0014 0016 003F 0016 0015 0016 003F 0018 0013 0016 0015 0016 003F 0015 0016 0015 0040 0015 0016 0015 003E 0016 0016 0016 003F 0016 003F 0016 066C 0151 0055 0015 0ED8’},
– Change TV to live tv (to reset input selection list to consistent selection) and wait 1 second
{delay = 1, code = resetInputSelList},
– Change TV to live tv (to reset input selection list to consistent selection) and wait 1 second
{delay = 1, code = resetInputSelList},
– Change input selection to HDMI 3 (8 input button press) and wait 1 second
{delay = 1, code = input8ButtonPress},
– Change input selection to HDMI 3 (8 input button press) and wait 1 second
{delay = 1, code = input8ButtonPress},
– Change input selection to HDMI 3 (8 input button press) and wait 1 second
{delay = 1, code = input8ButtonPress},
– Change input selection to HDMI 3 (8 input button press) and wait 1 second
{delay = 1, code = input8ButtonPress},
– Change input selection to HDMI 3 (8 input button press) and wait 7 seconds
{delay = 7, code = input8ButtonPress},
– Press Xbox green button to select default application (Emby) and wait 1 second before exiting
{delay = 1, code = ‘0000 006D 0000 0024 0151 00A9 0016 0015 0015 0016 0015 0016 0015 0016 0016 0015 0016 0015 0016 0014 0017 003E 0017 0014 0017 0014 0016 0015 0016 003F 0017 003E 0017 0014 0016 003F 0015 0040 0015 0016 0015 0040 0014 003F 0017 0014 0017 0014 0016 003F 0016 003F 0016 0015 0016 003F 0015 0016 0015 0016 0015 0040 0015 003F 0016 0015 0016 0015 0015 003F 0015 066D 0150 0055 0015 0ED8’},
}
local stepNumber = 0
function nextCodeToTransmit()
stepNumber = stepNumber+1
luup.log(‘INC STEP NUMBER’,50)
if (not steps[stepNumber]) then luup.log(‘IR FINISHED’,50) return end
luup.log(steps[stepNumber].code,50)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = steps[stepNumber].code}, IRDeviceID)
luup.log(‘CALL DELAY’,50)
luup.call_delay(‘nextCodeToTransmit’, steps[stepNumber].delay)
end
nextCodeToTransmit()
return true
[/code][/quote]
Kind of works except for the Input selection change 8 button press need to be 600ms, is it possible to incorporate luup.sleep (600) with the remainder of your luup delay() code?
I have attempted the following but I get failed to test code:
– Turn TV ON
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 50 00 00 01 29 91 15 10 15 10 15 10 15 10 15 10 15 0f 16 34 15 10 15 34 16 34 15 35 15 34 15 35 15 34 16 0f 16 34 15 10 15 34 16 0f 16 0f 16 34 15 10 15 10 15 10 15 34 16 0f 16 34 15 34 16 10 15 34 15 35 15 34 15 00 05 16 00 01 28 47 15 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (1000)
–Turn ON Xbox One
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘0000 006D 0000 0024 0151 00A7 0016 0015 0017 0014 0016 0015 0015 0016 0015 0016 0015 0016 0015 0016 0015 003F 0016 0014 0017 0014 0016 0016 0015 003F 0016 003F 0016 0015 0016 003F 0015 0040 0015 0016 0015 0040 0015 0014 0016 003F 0016 0015 0016 003F 0018 0013 0016 0015 0016 003F 0015 0016 0015 0040 0015 0016 0015 003E 0016 0016 0016 003F 0016 003F 0016 066C 0151 0055 0015 0ED8’}, 531)
luup.delay (8)
–Wait 8 seconds then change TV to live tv (to reset input selection list to consistent selection)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 78 00 00 01 28 91 15 10 15 10 15 10 15 10 15 10 15 10 15 34 15 10 15 35 17 32 16 34 15 35 15 34 15 35 15 10 15 34 15 10 15 10 15 35 15 10 15 10 15 10 15 34 15 10 15 35 15 34 15 10 15 35 15 34 15 35 15 10 15 34 15 00 05 16 00 01 29 47 15 00 0c 44 00 01 28 47 17 00 0c 42 00 01 29 47 16 00 0c 43 00 01 28 47 15 00 0c 44 00 01 2a 45 18 00 0c 42 00 01 2a 45 15 00 0d 05’}, 531)
luup.sleep (500)
----Change TV to live tv (to reset input selection list to consistent selection)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 78 00 00 01 28 91 15 10 15 10 15 10 15 10 15 10 15 10 15 34 15 10 15 35 17 32 16 34 15 35 15 34 15 35 15 10 15 34 15 10 15 10 15 35 15 10 15 10 15 10 15 34 15 10 15 35 15 34 15 10 15 35 15 34 15 35 15 10 15 34 15 00 05 16 00 01 29 47 15 00 0c 44 00 01 28 47 17 00 0c 42 00 01 29 47 16 00 0c 43 00 01 28 47 15 00 0c 44 00 01 2a 45 18 00 0c 42 00 01 2a 45 15 00 0d 05’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.sleep (600)
–Change input selection to HDMI 3 (8 input button press)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘26 00 b0 00 00 01 29 91 15 10 15 10 15 10 15 10 15 0f 15 10 15 35 15 10 15 34 16 34 15 35 15 34 15 35 15 34 15 10 15 35 15 10 15 10 15 34 15 10 15 35 15 10 15 10 15 10 15 34 15 35 15 10 15 34 15 10 15 35 15 35 15 34 15 00 05 15 00 01 29 47 15 00 0c 45 00 01 29 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 28 47 15 00 0c 46 00 01 29 46 16 00 0d 05 00 00 00 00 00 00 00 00’}, 531)
luup.delay (7)
–Wait 7 seconds then Press Xbox green button to select default application (Emby)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘0000 006D 0000 0024 0151 00A9 0016 0015 0015 0016 0015 0016 0015 0016 0016 0015 0016 0015 0016 0014 0017 003E 0017 0014 0017 0014 0016 0015 0016 003F 0017 003E 0017 0014 0016 003F 0015 0040 0015 0016 0015 0040 0014 003F 0017 0014 0017 0014 0016 003F 0016 003F 0016 0015 0016 003F 0015 0016 0015 0016 0015 0040 0015 003F 0016 0015 0016 0015 0015 003F 0015 066D 0150 0055 0015 0ED8’}, 531)