... but the cut out is tripped during the night....
...I have replaced the master cut out 40 amp switch.
Is it the "master cut out 40 amp switch" that's tripping?
If so, is this an RCD/earth leakage circuit breaker/interrupteur différentiel ? (It will have a 'test' button on it.)