The principle of conservation of energy states that energy can neither be created nor destroyed but can be converted from one form to another. Hence, chemical energy in a battery can be converted to electrical energy.
Usually, the conversion of energy from one form to another is not 100% efficient according to the second law of thermodynamics. Some energy is wasted in the process, sometimes as heat.
Hence, in an ideal situation where no heat energy is produced; all the chemical energy is converted to electrical energy (100% energy conversion). There will be no energy loss if no heat is produced.
The ground state electron configuration is the arrangement of electrons around the nucleus of an atom with lower energy levels. The electrons occupying the orbitals of varying energy levels naturally falls towards the lowest energy state or ground state.