How to do this with Node Red?

I just added ESPresence to my HA. I’m NOT very versed in Node Red, but I prefer using it over the built-in automation script support in HA. So, I’m trying to find the best approach to this scenario:

In the bedroom, I want to turn on lights if the PIR attached to the ESPresence base station is triggered and turn them off after 1 minute. That part is easy enough and I do have that working.

So, on to the real how-to question: If presence is detected, I want to keep the lights on instead of turning them off after a minute, but only if the following conditions are met: 1) the time is between 7am and 11:30pm. 2) if the LUX in the room is above a set value. 3) turn the lights off at 11:30pm, regardless of presence or timer remaining. 4) turn the lights off if either of the two bed sensors is “occupied”.

I’m using a BigTimer to measure the time of day, and so far I’ve managed to get the “only on between 7am and 11:30pm” part working, but I can’t figure out how to bypass the timer if presence is detected either by espresence or via either bed sensor.

Any suggestions are welcome, and WILL be used as a learning experience!

Thanks in advance!