Idle issues

Needs some help. I've got a e46 M3 03 that is idleing funny. It idles up and down for about 2 minutes several times a day. It has nothing to do with the temprature. It usually doesn't happen first thing in the morning but after I start driving around and turn it off and on it starts acting up. It's been doing it for the last few months.

I did put a AFE intake on the car but that was done 1 year ago. Any suggetions?