We discuss the transient and steady state fluctuation relation for a mechanical system in contact with two deterministic thermostats at different temperatures. The system is a modified Lorentz gas in which the fixed scatterers exchange energy with the gas of particles, and the thermostats are modelled by two Nosé-Hoover thermostats applied at the boundaries of the system. The transient fluctuation relation, which holds only for a precise choice of the initial ensemble, is verified at all times, as expected. Times longer than the mesoscopic scale, needed for local equilibrium to be settled, are required if a different initial ensemble is considered. This shows how the transient fluctuation relation asymptotically leads to the steady state relation when, as explicitly checked in our systems, the condition found in [D.J. Searles, et al., J. Stat. Phys. 128, 1337(2007], for the validity of the steady state fluctuation relation, is verified. For the steady state fluctuations of the phase space contraction rate Λ and of the dissipation function Ω, a similar relaxation regime at shorter averaging times is found. The quantity Ω satisfies with good accuracy the fluctuation relation for times larger than the mesoscopic time scale; the quantity Λ appears to begin a monotonic convergence after such times. This is consistent with the fact that Ω and Λ differ by a total time derivative, and that the tails of the probability distribution function of Λ are Gaussian.