The calculation of the signal energy in the time domain is okay.
The calculation in the frequency domain must performed as follows:
You have to summ the mean square value of every frequency component and multiply the summation by the time interval of the signal. The mean square value is Vp^2/2,
where Vp is the peak value of the frequency components.