Thanks for the response JOD however I managed to figure out my nightlight scene by looking at the examples page here http://wiki.micasaverde.com/index.php/Luup_Scenes_Events#Lighting_and_Switch_Actions
my new luup code is as follows - Quick Tip use “if not (luup.is_night()) then” to do testing in daytime.
EDIT - This works however if the motion sensor is triggered again whilst the light is still on before the 3 minute timer, this is not reset, i will be investigating soon but for now im just going to increase delay duration so it stays on for 6 minutes as this should solve most bedtime bathroom stops!!
[code]skip = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,34)
function lightoffdelay51()
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “0”}, 51)
end
function lightoffdelay52()
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “0”}, 52)
end
if(skip==“1”)then
return false
else
light51 = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,51)
light52 = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,52)
if (luup.is_night()) then
if (light51 =="0") then
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = "10"}, 51)
luup.call_delay('lightoffdelay51', 180)
end
if (light52 =="0") then
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = "10"}, 52)
luup.call_delay('lightoffdelay52', 180)
end
return true
end
return false
end[/code]