Dim lights with a namron switch

I was able to help flipmoo with his blinds. He wanted to tap-and-hold and then release the button when the blinds reaches the desired position.

(I don’t have a sunshade so I dim my kitchen lamp as an example. I also only have one button that supports holding and letting go. Where I use ‘Dim level’, you have to use the position of the sunshade)

Suppose the sunshade goes from 0 (%) to 1(100%) in 25 seconds, then it takes from 0.35 (35%) open to 1 (100% ) so (1-0.35)*25 seconds. Instead of 100 steps (1-0.35)*100 steps are needed. I put these values in variable ‘runtime’ and ‘steps’

Each time the transition reaches a step, the transition value is therefore 0.01 higher and the sunshade is opened 1% further.