writeEnergy and writeTemprature working