Node-red time or lux trigger for indoor lights

I have a node-red flow that simply turns on/off a group of indoor lights at set times . I am now trying to layer on the use of a lux sensor to trigger the lights on earlier, in case it gets darker indoors before the set time to turn lights on.

How will you guys do it? Here is what I have now ( without the addition of the lux trigger ). I am not sure where / how to add the lux trigger. In a way, It's an override to the sunset time trigger.

fyi: @erktrek

If there is a difference between things getting dark like a storm or dark clouds vs sunset then you might want to separate your sequences into the 2 different types otherwise you could just stick with testing for illuminance.

I use a basic set of illuminance ranges with thresholds for high/medium and low and turn lights on when in the low range. Am considering adding a smoothing algorithm to further prevent spikes/rapid on/offs for things like dark clouds passing overhead.

Download the Hubitat app