Motion Sensed During Lighting Scenario

I’m looking for help on how to set up an automation for when my Motion/Light sensor meets two variable requirements (possibly 3 at a later date) then a light switch is turned on.

Ideal Scenario:
IF Motion Sensed
AND Light level of same sensor is <500 (is about half sensible range on the device)

THEN Turn on light switch device

I assume since this is a multi-variable scenario this needs to be done with LUA but I have no idea what I’m doing in there. Please help Forums, you’re my only hope.

P.S. possible 3rd IF parameter would be after a certain time of day.

Have you seen the Conditional Scene Execution sticky? There are examples of each type of condition and guidance on combining them.

Otherwise, you could use PLEG. See PLEG Basics for an introduction.