This is how I do something similar. The basis of the rule uses variable math to calculate the slope and value using basic algebra...
y=m*x+b and m = (y2-y1)/(x2-x1)
This rule is WAY more complicated than necessary, but i wanted it to be flexible so that I could change the duration, start values, or end values without having to rewrite the rule. So most of these values are local variables.
The 2 main things that apply to your scenario are the slope (ctSlope and levelSlope) calculations and then the final value calculations (ctValue and levelValue).
I can offer more details if you need, but it might be a few days.
OR i just saw this on another thread. Perhaps you could use this action in rule machine to set the color and level of a virtual bulb, then capture those settings into your variables.
