Edge detection with I2C buttons


I have 22 buttons attached to the GPIO pins on a raspberry pi. Using as input “edge detection” and function “trigger edge” I can successfully turn on and off LEDs and relays which are connected via I2C. The problem I have is that I get false triggers when quickly inserting and removing a empty extension power cord from the same socket which powers the raspberry pi.
Things I tried and didn’t helped: changing from pull down to a pull up configuration, reducing resistor value from 10k to 1k, installed EMI filter, installed isolation transformer, using an UPS, using shorter wires, bounce time 3000 ms in mycodo, detecting rising edge, falling edge, both.
I now think I can’t get rid of these false triggers and hope to solve this by using buttons connected somehow to I2C via some sort of IC. (since I2C doesn’t seem to be influenced by this issue)
Could someone please suggest which integrated circuit I could use to connect those 22 buttons via I2C to mycodo? Or is it possible another way to get rid of those false triggers? Maybe by modifying the code to ignore those trigger edges shorter than a specified amount of time?
I’ve attached a picture showing my setup.
Please let me know if you need more information.

Thank you very much.

Have you connected an oscilloscope to understand what’s happening?

Thanks for replying. Unfortunately I don’t have an oscilloscope…

Is there any way to solve this issue without an oscilloscope?
Can this be solved in software by waiting for 5mSec, and then reading the input again?
Thank you

You can copy the input, edit it to suit you needs, then import it on the Input Import page.