We study in this article how heat can be exchanged between two level systems (TLS) each of them being coupled to a thermal reservoir. Calculation are performed solving a master equation for the density matrix using the Born markov-approximation. We analyse the conditions for which a thermal diode and a thermal transistor can be obtained as well as their optimization.