On the theory of thermocouples and thermocells