Welcome to Smart Home Forum by FIBARO
Search the Community
Showing results for tags 'settimeout'.
Many of my scenes have this structure where I am iterating through an array and processing each entry, and I want a delay between each. I have always used fibaro:sleep. I am struggling to find a good way to use setTimeout here. Surely if I call Process_Entry with setTimeout, the loop is going to carry on running. function Main_Loop () for I,Entry in pairs(Events) do Debug (0, 'Entry '..I) Process_Entry (I, Entry) -- Breather if not Testing then fibaro:sleep (Breather_Secs*1000) end end local Delay = Resolution_Mins * 60 / 2 * 1000 fibaro.setTimeout (Delay, function() Main_Loop () end) end