Need help on flow turning lights on based on lux & motion

Or just start here. Why reinvent the wheel again?