Loop Timer Issues in HASS: Seeking Solutions

Hi everyone, I’ve been trying to figure out how the loop timer works in HASS, but I’m running into some trouble. My setup involves two sensors in a room—a motion sensor and a door contact. The idea is to keep the lights on if the door is open, either until it closes or the timer (set to 5 minutes) runs out.

When the door is closed, everything works perfectly. But if the door is left open, my entire HASS setup freezes. I noticed that the debug logs show a flood of open messages every second instead of every 30 seconds as intended. I suspect this is causing HASS to run out of memory or something, but I can’t check because the GUI freezes up completely.

I’ve tried adjusting the timer settings and even resetting HASS, but nothing seems to help. Any guidance or suggestions would be greatly appreciated! I’m really stuck here and would love to get this working properly. Thanks in advance for your help!