Delay is ramdom


What is wrong with this:

local device = 40 – Switch on device 40:

luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“1” },device)
luup.call_delay( ‘switch_off’, 300) – Call the switch off function after a delay of 300 seconds

function switch_off()
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“0” },device)

300 should be 300 seconds, but it works as the wind blows. I just tested it three times and the light switched of after 26 seconds, 2 m 59 s and 1 m 46. It is not even close to 5 minutes!