Erratic idle is sometimes due to a dirty SCV (could also be a faulty SCV). The usual signs of this are an idle that gently surges (a little) and settles, maybe every 2 seconds or so. First thing to try is a good injector cleaner, my preferred one is Liqui Moly Fuel System Treatment, but you could also go whole-hog and get their "Diesel Purge", follow the instructions (Youtube has vids on this too) and be done in no time.
If symptoms persist after the clean, you could try replacing the SCV. Don't get a second hand one, even though a car in a wrecking yard isn't going to be there because it had an erratic idle, you don't know how much longer that SCV will last or how long it's been sitting gunking up.