Rules with a wait for changing state back

Pay attention to hysteresis but for an example of how to do specifically what you are asking for see the antiflapping timer in Generic Presence Detection and Design Pattern: Motion Sensor Timer