Consensus in Smart Grids for Decentralized Energy Management