Lights Off With Illumination

Hi, I am new to ST and this is my first post here.

I am trying to create a Wake Up automation that involves several things including turning a hallway light on. Initially I did this using the ST Good Morning Routine. This worked fine, but now I want to add a condition to the Routine that only turns the light on if the illumination on my hallway sensor is less than 10 lux, for example. I don’t think the standard Good Morning Routine can handle this logic, so I recreated the entire Routine in webCoRE.

I have this working, but now I want to turn the light off too. Basically, I want the hallway light to turn on when my “Wake Up” piston activates at 05:30, but only if it is dark (say less than 10 lux). Then, if the light did turn on, I want it to turn off at some point after sunrise when the illumination sensor reads 15 lux or greater.

Can this be done within one piston, and if so how? Or, do I need to create a separate piston to turn the light off?

Thanks for the help.

There is a community just for WebCore. Lots of people that are real good with pistons there.