Sonoff flickering with GPIO14 and GND connected

Hi,

I am new to HA and this is my first post. I have not done any electronic projects before so my knowledge is minimal. I have installed Hassio and connected a 3-way switch to Sonoff as described in this video. It works fine but there is random flickering on the Sonoff. The flickering goes away if I disconnect either GND or GPIO 14 and operate the Sonoff only using WiFi. I’ve read somewhere that this could be due to induction by the AC wires close by and could be avoided by adding a capacitor between GPIO14 and GND. Can anybody give me some details on how to go ahead with that? Or share another workaround that worked for you?
Thanks in advance.

(I wish I could remember who I stole this picture from to give them credit…)

33nf capacitor between GPIO14 & GND

4.7k ohm resistor between GPIO14 & 3.3v