Rako Lighting Control

I am trying to do one script that will activate my Rako Lighting ‘Scene 3’ and then after 3 minutes Turn off the lights by activating ‘Scene Off’

If I place this command in a scene and run it manually it will turn the Rako lighting to ‘Scene 3’ which is fine.

local status, result = luup.inet.wget(“http://192.168.1.71/rako.cgi?room=6&ch=0&com=5”, 5)

If I place this command in a scene and run it it will turn the Rako lighting ‘Scene Off’ which is also ok

local status, result = luup.inet.wget(“http://192.168.1.71/rako.cgi?room=6&ch=0&com=0”, 5)

How do I combined the two commands above with a 3 minute delay? Any help most appreciated.

The end plan is that when a person activates the motion sensor in the bathroom the Rako lights come on for 3 minutes. I plan to use the triggers to activate the scene.

so you have separate scenes for turning the light on and off, if you want to stick to your design youd have to have a 3rd scene that runs both these scenes so something like

function switch_off_light()
luup.inet.wget(“http://192.168.1.71/rako.cgi?room=6&ch=0&com=0”, 5) – turn light off
end

luup.inet.wget(“http://192.168.1.71/rako.cgi?room=6&ch=0&com=5”, 5) – turn light on
luup.call_delay( ‘switch_off_light’, 180) – Call the switch off function after a delay of 180 seconds

I personally would however use only one scene to do both tasks. So something like:

function switch_off_light()
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “0”}, 50)
end

luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “100”}, 50)
luup.call_delay( ‘switch_off_light’, 180) – Call the switch off function after a delay of 180 seconds