Machine-to-machine (M2M) communications have emerged as a cutting edge technology for next-generation communications, and are undergoing rapid development and inspiring numerous applications. This article presents an investigation of the application of M2M communications in the smart grid. First, an overview of M2M communications is given. The enabling technologies and open research issues of M2M communications are also discussed. Then we address the network design issue of M2M communications for a home energy management system (HEMS) in the smart grid. The network architecture for HEMS to collect status and power consumption demand from home appliances is introduced. Then the optimal HEMS traffic concentration is presented and formulated as the optimal cluster formation. A dynamic programming algorithm is applied to obtain the optimal solution. The numerical results show that the proposed optimal traffic concentration can minimize the cost of HEMS.