Where to put the Y capacitor?
This is not an answer to your question - merely some help in asking it properly.

There is a proper schematic editor built into the post editor toolbar. Here is a schematic that might be close to your setup.







simulate this circuit &ndash; Schematic created using CircuitLab

You can edit this post, edit the schematic, copy and paste it into a schematic in your question. Modify it to match your actual setup.