g0hww I’m no expert, but If I drop wifi I see the plug wait for bit, reboot and then adopt the default state.
If you need to trigger something to happen on WiFi being available, or not, you could try something like the, untested, code below:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
on_connect:
logger.log: "WiFi has connected"
switch.turn_on: relay
on_disconnect:
logger.log: "WiFi has disconnected"
switch.turn_off: relay
73s