dzVents allows randomised switch times using withinMin(minutes) etc but I've been unable to find anything in dzVents for a randomised duration. Here's the code to operate a switch with random on times and random duration ...
return {
on = {
timer = {'every 30 minutes'}
},
execute = function(dz)
local n = tostring(math.random(5, 15))
if( dz.time.matchesRule('between sunset and 23:00') ) then
dz.devices(15).switchOn().withinMin(15).forMin(n)
end
end
}
Well; as you have already found. The randomised duration is within! There is: withinMin(minutes); this enables to switch off or on within a random time.
But I guess it might influence too much with your current idea.
This might already switch off the light before the switch on.
Yes I agree, that is why I used the math.random(n, m) function to ensure that the randomised duration was applied after the switch had been turned on. It also has the advantage of being able to specify a minimum duration.