Sonoff basic with tasmota 5.11.1 on latest Hass.io switches randomly

I am testing 2 Sonoff basic switches for stability in daily use.
If i find them safe to use then i want to use one for the opening and closing of my driveway gate.

To switch the gate i simply need to make a contact like a push-button.
in the userconfig.h i sett a value APP_PULSETIME 10.
And i modified the Sonoff to make an independent connection by removing a few connections to the relay and pin-out, and ad another connection.

I use another one in the same way, but this is for the reset button on a heater.
They are both on a different wifi access point.
I controll them with MQTT and it all seems to work great.

There is only one glitch.
If i look in the history of Hass.io then i notice that both Sonoffs so now and then switch randomly.
Once in a few days. I cant find what is causing this.

At first i thought it happened on reconnecting to a wifi network but that seems not the case.

I hope someone can point me in a direction where to look further.

I use the same switches and firmware and they are very stable. However I am not using them as push buttons. Are you sure the physical switches are actually switching randomly ? Perhaps HA is just not reporting the state correctly ? Perhaps there is an issue with firmware APP_PULSETIME command? Valid PULSETIME values are from 112 - 64900. You are using 10 ?

The switches actually switch. It has been a few days now and they did not act weird.
Sometimes they are good for a week and then suddenly one switch moment occurs.

I do use a pulsetime 10 for 10 miliseconds.
I read somewhere this should work.

I think this is a WIFI issue with Tasmota/Sonoff. The device will restart if it loses WIFI and changes relay states. There are settings to prevent this but mine are set correctly. I had this happen to me yesterday. Here is some info.

https://github.com/arendst/Sonoff-Tasmota/issues/1034

https://github.com/arendst/Sonoff-Tasmota/issues/878

I have mine set to wificonfig 4. Maybe i should try the wificonfig 5.

Do you have them set to wificonfig 5?

Where/how can I change this wificonfig? Looked around on the Tasmota github but can’t really find it.
Also looked around on the browser page of my flashed sonoff. Can’t find it there either.

You must type the commands in Tasmota Console page.

see: https://github.com/arendst/Sonoff-Tasmota/wiki/Commands

Could be ghost-switching. Perhaps this video could help https://youtu.be/aq8_os6g13s