Capturing current input on Marantz receiver, changing inputs, then restoring

I have a Marantz SR7010 receiver and have the Denon plugin installed. I am wanting to create a scene that when my Aeotec doorbell is rung, the current receiver input is stored, the receiver changes to the PC input where the BlueIris software is running showing who is at the front door then after 30 seconds the receiver input switches back to the original input. Can someone help with some Luup code to accomplish this?

local DN_ID = 383 – enter the device ID of your Denon plug in

– Get the current input
local curInput = luup.variable_get(“urn:denon-com:serviceId:Receiver1”, “Source”,DN_ID)
For those that want to know:

luup.call_action(“urn:micasaverde-com:serviceId:InputSelection1”, “Input5”,{},DN_ID) – switch to Media Player

– Schedule to restore the input in 30 seconds
luup.call_delay(“input_restore_act”, 30)

– Start the current input
function input_restore_act()
luup.call_action(“urn:micasaverde-com:serviceId:InputSelection1”, curInput,{},DN_ID)
end