16.10.2023, 05:52
Use an event script with execution mode set to "Last instance only".
What do you mean by everything gets slow? The script sends 5 telegrams per second which is not a high load. You can lower this by increasing the sleep time. You might need to adjust the step size to keep the dimming speed the same as before.
Code:
out = '32/0/25'
dimmer = event.getvalue()
step = bit.band(dimmer, 0x07)
if step == 0 then
return
end
up = bit.band(dimmer, 0x08) ~= 0
vstep = up and 5 or -5
value = grp.getvalue(out)
while true do
nvalue = value + vstep
nvalue = math.min(nvalue, 100)
nvalue = math.max(nvalue, 0)
if nvalue ~= value then
grp.write(out, nvalue)
value = nvalue
os.sleep(0.2)
else
break
end
end
What do you mean by everything gets slow? The script sends 5 telegrams per second which is not a high load. You can lower this by increasing the sleep time. You might need to adjust the step size to keep the dimming speed the same as before.