Sonoff for fountain - tripping RCD

Wondering if anyone has faced the same problem I am, or if any electrical experts can answer this one for me.

When we bought this house there was a fountain installed in the back garden. It’s powered via a mains cable that runs under the patio (I think) and into the cellar. It terminates in an RCD on a three pin plug. Plug it in and hit reset, and the pump runs.

I want to add the fountain into Home Assistant, so programmed a Sonoff Basic (it’s not a big fountain so expect current draw to be fairly minimal) with ESPHome and wired it in between between the RCD and the fountain. I split the cable and rejoined the earth wire around the Sonoff. Plan is to wrap it all in an extra 3D printed case for safety once it works.

But as soon as the Sonoff connects and turns the switch on, not only does the RCD at the plug trip, it takes out the one at the consumer unit as well. Not the fuse, just the ground fault device.

Am I missing something to do with the Sonoff and the way it switches, or can this only be an intermittent wiring fault that just happens to only appear when the Sonoff is in place?

(BTW I have already removed the Sonoff once and tested it, and without it, everything works fine).

Did you try to use the Sonoff to switch something else ?

Good thought - I haven’t actually. It was a new one but I’ll wire it up to something else later and check it.

Though that would still be baffling. Could see how I might create a short if I had really screwed up soldering on the header pins, but not a ground fault.

So, I tried replacing the Sonoff with just a simple switch and got the same result. I can’t pick up a ground fault with my multimeter but I can only think there must be a minor fault somewhere in the cable that is only tripped by the initial surge of a switch being thrown on the pump side of the RCD.