How to dim Hue lights when switched on?

I’m trying to make a rule that triggers when I switch on a hue light using its physical switch. But I cannot get the rule to trigger.

My items look like this:
Switch KI_CeilingLamp “Kök - Taklampa” (Kitchen,Lights) { hue=“2” }
Dimmer KI_CeilingLamp_Dimmer “Kök - Taklampa, dimmer” (Kitchen,Lights) { hue=“2” }

The rule looks like this:

rule "Scene Hue feedback"
when
Item KI_CeilingLamp_Dimmer changed
then
if(KI_CeilingLamp_Dimmer.state == 100)
{
KI_CeilingLamp_Dimmer.sendCommand(50)
}
end

I also tried several variations, like triggering on the switch item of the light. It did trigger once or twice when I turned the light on, which makes me think this might be a timing issue. The refresh rate of the Hue binding is set to 2000msec.

Any suggestions on how to achieve this?

Maybe add some debugging ouputs to see what’s going on… E.q. outputting the state when rule is triggered