Peer-to-Peer (P2P) overlay communications networks have emerged as a new paradigm for implementing distributed services in microgrids due to their potential benefits: they are robust, scalable, fault-tolerant, and they can route messages even when a large number of nodes are frequently entering or leaving the network. However, current P2P systems have been mainly developed for file sharing or cycle sharing applications where the processes of searching and managing resources are not optimized. Locality algorithms have gained a lot of attention due to their potential to provide an optimized path to groups with similar interests for routing messages in order to achieve better network performance. This paper develops a fully functional decentralized communication architecture with a new P2P locality algorithm and a specific protocol for monitoring and control of microgrids. Experimental results show that the proposed locality algorithm reduces the number of lookup messages and the lookup delay time. Moreover, the proposed communication architecture heavily depends of the lookup used algorithm as well as the placement of the communication layers within the architecture. Experimental results will show that the proposed techniques meet the network requirements of smart microgrids, even with a large number of nodes on stream.