Hi,
You could use couple of counter and timer to define time since last push like:
You could use couple of counter and timer to define time since last push like:
Code:
local pushcount = storage.get('pushcount', 0)
local timepush = os.time()
local timepushinit = storage.get('lastpush', 0)
delta = timepush - timepushinit
if delta > 60 then
pushcount = 0
storage.set('lastpush', timepush)
end
if pushcount == 0 then
-- do something
elseif pushcount == 1 and delta > 20 then
--do something
elseif pushcount == 2 and delta > 30 then
-- ...
else
-- do something
end
pushcount = pushcount+1
storage.set('pushcount', pushcount)