While loop within a dsl rule causes 100% cpu load

I found a solution. I set expiration timer on Moes1054_Switch1 to 5min with command OFF. Then I created a rule via UI: Trigger: When Bewegungsmelder_Bad changed to ON. Action: Send command ON to Moes1054_Switch1. Condition: Only when state of Moes1054_Switch1 = ON. Works as expected.

Thanks for your advice rlkoshak
Thanks to all for your help

This is the solution I would have recommended.

In a file based Rules DSL it would look like:

var Timer tBadLicht = null

rule "Licht Bad ausschalten, wenn keine Bewegung erkannt"
when
    Item Bewegungsmelder_Bad_IKEA_of_Sweden_Motion updated to ON
then
    if(Moes10504_Switch1.state == ON) Moes10504_Switch1.sendCommand(ON)
end

Yes, there was a missing detail, sorry for that.
I changed the code.