Please make sure
1) the devices are connected to the 2.4G wifi
If you are using dual-band (2.4G+5G) router, please disable the 5G network.
2) the WiFi connection is stable
Make sure your WiFi doesn’t have too many connections. Usually, one router can bear 15 connections, including cellphone, tablets, PC, and smarthome devices, etc.
3) the Sonoff model is near the router
Taking the device close to the router can ensure the WiFi signal is strong enough.
If you can't fix it after all the above requirements are meet, please set the DNS of your phoneor computer to 22.214.171.124 or 126.96.36.199 and retry.