Thermodynamics of Quantum Devices