Esp32 disconnects from network after reconnecting power

I was trying to make an DIY 8 channel smart relay with ESPHome. I have set up all the YAML code and has successfully connected to network and done all set up. I can control all relays from dashboard. After disconnecting the power to ESP32 and reconnect the power it stoped working. I have tried every solution like setting up static ip on router, set static ip on YAML, tried ip outside the end ip of router after all these try I can’t connect to the WiFi . Is there any solution for this problem . Suggest any methods so that the ESP32 can connect to WiFi without any problem even after power cuts

How you know that wifi is the problem?
Connect your Esp with usb-cable and observe what you get on logs on boot.

Sounds like you used a strapping pin for one or more relays. That's a more likely explanation than a WiFi issue

Posting a wiring diagram and yaml code [formatted using </> for forum readability] would be useful if you want help to get it going, rather than just commiserations and guesses.