In this paper we derive a macroscopic model for thermoporoelasticity from the pore scale linearized fluid-structure and energy equations. We consider the continuum mechanics thermodynamically compatible pore scale equations corresponding to realistic rock mechanics parameters. They are upscaled using two-scale asymptotic expansions. For the upscaled equations a Lyapunov functional (a generalization of Biot's free energy) is constructed and the well-posedness of the model is discussed. Possible applications to large time numerical simulations are pointed out.