We consider energy storage systems having nonlinear efficiency functions, which are becoming increasingly important as shown in several recent works, and propose an optimal solution based on Pontryagin's minimum principle. A central challenge in such problems is the hard limits on the state variable, which restrict the use of the minimum principle. To address this challenge, we propose to include the capacity constraints in the objective function with a proper weighting constant. We show that this approach allows formulation of the problem based on the classical minimum principle, and eventually leads to an efficient optimal control strategy. The proposed solution is compared to a dynamic programming algorithm. Numeric experiments reveal that for lossless storage devices dynamic programming is beneficial, since it enables fast and accurate solutions when a low number of samples is used. However, for lossy storage devices the situation is the opposite, and the minimum principle provides faster and more accurate solutions, since its computational complexity is almost unaffected by changes in the system parameters.