Dark & bright, suspend flow in node red for 5 minutes

I have an illumination sensor that gives me the reading in lux. With a function I define when it is dark / bright (e.g. when < 25 lux). As soon as the value is smaller as 25 lux the flow is started and the lights are switched on automatically. The function sets the msg.payload to true / false.

However, it can be the case that the value is < 25 lux for just a short time. I want to trigger the flow when the illumination is smaller < 25 for 5 minutes. But also 5 minutes delay when the sensor value is more than 25. I hope the payload can true / false. This will give some stability in switch on/off the lights.

Use an event state node