[SOLVED] Dimming of lights over time

Hi,

I am trying to make a rule that dims the light at a specific time over a specified time (i.e dim to value x over y time), but if lights is already lower or off than the value x specified, it will exit the rule.

Can anyone point me in the right direction here ? I have searched and tried some solutions without luck. Im pretty new to OH, so please be specific :slight_smile:

Thank you so much!

Welcome to openHAB.

Take a look at:

1 Like

Or:

Thanks! Strange I didnt find that post! That did the trick, one thing though; if the dimmer is set to a lower value when the rule is, I want it to exit instead of dimming up to that value. I guess

} else {

    rescheduleTime = Math::round(fadeTime * stepSize / (targetValue - (brightness + stepSize)))

}

is the right code to change? But how do I exit the rule?

Thanks again! :slight_smile:

That would be an early return
See here:

Example:

if (Temperature.state > 20) {
	return;
}

Don’t forget the semicolon after return

Thanx! That did the trick! :slight_smile: