Thermoelasticity without energy dissipation of materials with microstructure