Commit to database only every 5 cycles.
If relais is on and return water temperature is above 48°C halve the diff temperature to not overheat