Let me give a general answer, because I don't work on Li batteries regarding details, on the example of hydrogen reaction the standard fuel for lectures. Start with the reversible case. Depending on the electrochemical reaction (charging, discharging in the case of battery) the energy balance shows that you have to supply or release the reaction enthalpy, but only the part associated to the reaction entropy as heat, the rest of energy is the free reaction enthalpy (reversible work). In the real case you have losses this means that the work you can receive from the system (decreasing potential: discharging battery) is less than the reversible work and you have to supply more work than the reversible work in the reverse reaction (increasing potential: charging of the battery). In the case of discharging the battery you can calculate the received work by multiplying the voltage (average V) with the measured As and you get the extraxted work from the battery. Because you know the As you know the mols that reacted (Faraday constant) and you can calculate with the reaction enthaly by multiplying with the mols the released energy. The difference between the released energy and the released work is the heat to be removed. If you charge the battery with supplied work only, then the waste heat is the difference between the needed energy supply expressed by reaction enthalpy and the real supplied energy represented by the voltage. Take care on the sign of the reaction entropy, but if you have a look in this chapter (principal theory) and in the conference paper (difference flow process (Fuel Cell) and batch process (battery)) you should solve the problem.
Best regards
Wolfgang Winkler
Chapter Thermodynamics of Fuel Cells
Conference Paper Fuel cells and flow batteries - Chances and challenges for s...
We have just submitted a paper that directly answers your question:
Preprint Heat Generation and a Conservation Law for Chemical Energy i...
Here we consistently derived an energy conservation law and all the heating terms from the (P2D) Newman model (a very well known and one of the most accurate electro-chemical models of Li-ion batteries).