Changing wifi connection on D1 mini after boot

I would like for a D1 mini to change wifi connection when api connection is lost.

I can not find any examples or documentation on controlling the wifi connection after boot. I am new to ESPHome so any pointers are appreciated.

Thanks

do you mean switching between different Wi-Fi access points?

wifi:
  networks:
  - ssid: FirstNetworkToConnectTo
    password: VerySafePassword
  - ssid: SecondNetworkToConnectTo
    password: VerySafePassword

here is the link

Yes… but I want to manually trigger the change. It seems this list is only for auto connection. “ESPHome will then attempt to connect to the one with the highest signal strength”