Reduction of energy consumption is important for reaching a sustainable future. This paper presents a novel method for optimizing the energy consumption of robotic manufacturing systems. The method embeds detailed evaluations of robots' energy consumptions into a scheduling model of the overall system. The energy consumption for each operation is modeled and parameterized as function of the operation execution time, and the energy-optimal schedule is derived by solving a mixed-integer nonlinear programming problem. The objective function for the optimization problem is then the total energy consumption for the overall system. A case study of a sample robotic manufacturing system and an experiment on an industrial robot are presented. They show that there exists a real possibility for a significant reduction of the energy consumption in comparison to state-of-the-art scheduling approaches.