Have you manage to figure it out? I bought a few of those and I am getting ahead by coding it before it arrives. Have you checked Tasmota?
It states:
This device uses AC frequency detection circuits on switch inputs supported since Tasmota 8.4.
My understanding is that your input will go from 1 to 0 together with your AC frequency, meaning 60hz would get you 60 up and 60 down signals per second.
I believe @nickrout’s suggestion would anyhow help, a debounce would do the trick. Please check this post for something more specific. Let me know how it goes.