We are just self replicating, self preserving processes. The main function is to maintain equilibrium in the face of entropy. We need food, water, shelter and companionship to survive. In order to get those, we need to learn to operate in the world and reason about it. It's nothing magical, just reinforcement learning and other kinds of learning - a little semi-supervised learning, for example, and a lot of unsupervised learning.
All this grand system exists for the sole purpose of protecting its existence. It protects its own life and self replicates, which is another kind of survival. Consciousness is that which protects the body, that is its sole purpose.
If you are not conscious in the morning, you don't drink and eat, and in 3 days you're dead. That's why you need to be conscious every day. That's the greatest miracle of consciousness. Our species would not exist without it. But it's better to work with clear cut notions, like perception, action and reward.