08.10.2018, 07:01
Use this script (resident, sleep time = 5 seconds) to convert 0..100% value to slow PWM (proportional on/off). Change input/output objects and period time as needed.
Code:
input = '1/1/1' -- proportional value input (0..100%) object
output = '1/1/2' -- on/off output object
period = 10 * 60 -- 10 minutes in seconds
date = os.date('*t')
seconds = date.hour * 3600 + date.min * 60 + date.sec
curr = seconds % period
perc = math.floor(curr / period * 100)
state = grp.getvalue(input) > perc
grp.checkwrite(output, state)