(I was trying and trying for hours to find a workaround, which proved much harder than initially expected.)
The problem itself is easy to understand, though. I recently installed a GUI-less Debian derivative on one of my machines and configured /etc/wpa_supplicant/wpa_supplicant.conf to access one of my access points and that worked out well.
Soon I took my machine with me out of home, so I added another network (which is my phone in hotspot mode this time) to wpa_supplicant.conf.
Sadly I noticed that it doesn't automatically connect to the phone's AP even after losing connection to the inital router, followed by wpa_cli --reconfigure.
Funny part: uncommenting the first network in the wpa_supplicant.conf makes my phone's AP work flawlessly. If both networks are kept uncommented, only the first one works.
I was reading the whole manual of wpa_supplicant.conf but the closest thing to what I needed was the BSSID option which didn't help in this situation.
So my question: how do I make the network controller change access points depending on availability of these?
Update:
I don't have /usr/share/doc/wpa_supplicant/README.modes, but only /usr/share/doc/wpa_supplicant/README.modes.gz which I am unable to extract because of too many symbolic links.
My /etc/wpa_supplicant/wpa_supplicant.conf:
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Klaus B. Schuldiger"
scan_ssid=1
psk="----"
}
#network={
#ssid="Xperia XZ_acd9"
#scan_ssid=1
#psk="----"
#}