Check if sensor was in a specific state in the past X minutes

The scenario I’m trying to accomplish is to trigger lights in my living room to turn on if the brightness drops below a certain threshold AND there was motion detected in the room in the last 60 minutes.

I can’t seem to find a way in node-red to check if a certain sensor had a certain state in the past X minutes. Can someone point me in the right direction on this one?

A possible solution for you could be to use a trigger node to check for the brightness drop then use a get history need to check if there’s been movement in the past 60 minutes.