Calculate energy consumption of each discharge event

Hello @ThiloWenzel,
You could try following logic similar to this:

But that could be overkill.
Perhaps you just want to just use the derivative function to identify periods of negative slope.