With the deep integration of energy internet and 5G, it further promotes the digital development of the grid and enhances the intelligence of the grid. To enhance the security of wireless communication in smart grid, a physical layer secure transmission scheme based on self-powered Intelligent Reflecting Surface (IRS) assistance is proposed, in which IRS is used to assist the transmission of information from the base station (BS) to the legitimate users in the smart grid system, while suppressing the signals transmitted to eavesdroppers, thus realizing the secure transmission of the system. To ensure that the IRS has enough energy to maintain its operation, a new transmission scheme is designed, and the transmission process is divided into an energy collection phase and an information reflection phase. They are used to collect energy and to assist in the transmission of information from the BS, respectively. To maximize the safe transmission rate of the system, a joint optimization problem on the beamforming vector of the base station, the time allocation and the IRS reflection phase is designed. Since the problem is a nonconvex optimization problem, an efficient algorithm is designed and suboptimal solutions are obtained by alternating optimization, Semi-Definite Relaxation (SDR), and Successive Convex Approximation (SCA) techniques. The simulation results show that the proposed scheme can effectively improve the secure transmission rate of the system.