29.08.2017, 13:40
1/1/1 = time object
1/1/2 = output object
delta / 10 controls how smooth the transition is, 10 means 10 * 100 seconds to get from 0% to 100%.
Note that this will not work correctly if alarm is set very close to after midnight.
This can either be a resident or a scheduled script, depending how long the final transition is.
1/1/2 = output object
delta / 10 controls how smooth the transition is, 10 means 10 * 100 seconds to get from 0% to 100%.
Note that this will not work correctly if alarm is set very close to after midnight.
This can either be a resident or a scheduled script, depending how long the final transition is.
Code:
function getoffset(t)
return t.hour * 3600 + t.min * 60 + t.sec
end
now = os.date('*t')
now = getoffset(now)
set = grp.getvalue('1/1/1')
set = getoffset(set)
if now <= set then
delta = set - now
val = math.floor(100 - delta / 10)
if val > 0 then
grp.write('1/1/2', val)
end
end