The Fronius converter supplies the Energy values (E_*) in the unit Wh. Converting it to kWh is done by dividing it by 1000 (which is correct in your code). However, to get MWh you would have to divide the result again by 1000, not by 100 (as done in your code).