Sonoff Basic doesn't connect after flashing via USB

I have a Sonoff basic that if I flash via the USB works fine (can see logs and connects to HA). However, when I unplug it from the USB, it shows disconnected on the EspHome portal and does not connec to HA.
After a while I can see the Captive Portal for the device but I can’t connect to it. Any ideas?

Same problem I have

Poor wifi signal? USB cable can act like antenna (with it’s connected ground)… when you disconnect the cable wifi signal gets too low for reception…?

No, I don’t think that’s the problem. I tried next to the router, literally a few inches away.

I reflashed it with the latest version 1.18.0 and that solved the problem! I hope it solves yours as well.