Disconnect/reconnect to wifi with same SSID I'm playing with some more advanced things in Tasker, and I've set up an NFC tag to do various things when I return home from work each day. One of these is to connect to wifi and run an SSH command to wake up my computer.

I'm in a dorm at a university, so all of the wifi SSIDs are the same. Because of this, my phone (a Nexus 5 on stock/rooted 5.1) will latch onto one AP and hold on as long as possible, and eventually switch as I move further away. This means that when I arrive at my room and tap the tag, my phone is almost always in the process of reconnecting to the nearest/correct AP and my SSH command fails. Sometimes it's connected immediately, sometimes it doesn't connect for a few minutes, so a simple "wait 10 seconds" in Tasker doesn't cut it.

Is there a way to simply break the existing connection and reconnect to the same SSID (just reconnecting in general is fine, there's only one SSID)? I know that disabling wifi altogether, waiting a few seconds for the phone to do it, enabling it again, and waiting a few more seconds will do this, but it takes longer and I imagine there's a better solution.

TL;DR: How can I break a wifi connection then reconnect in Android 5.1 (stock/rooted) without actually disabling wifi? Terminal commands are fine.
Checking the Tasker manual for the &quot;WiFi Net&quot; action shows:

WiFi Net
Change the wifi network connection status.
Reassociate: reconnect even if already connected.

(emphasis mine)
That should be exactly what you're looking for – playing with Tasker anyway :)