'Raspberry Pi not connecting to available WiFi
As this is my first question actively asked here on the platform please go easy on me ;-)
I'm using a Raspberry Pi Zero WH in my home network called "wocl". Here the RPi connects to my WiFi without any problems. In order to be able to use the RPi outside with Internet access I thought it'll be nice to have it connect to my Android Device which provides the hotspot "WordClock_Access".
When using iwlist wlan0 scan|grep -i ssid
on the RPi after it boots and is connected to my home WiFi I can see that the WiFi itself is visible:
ESSID:"WordClock_Access"
I have the following configuration of my wpa_supplicant.conf
file:
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WordClock_Access"
psk="a_password"
id_str="unterwegs"
priority=1
}
network={
ssid="wocl"
psk="another_password"
id_str="Zuhause"
priority=2
}
However when starting up the RPi again (with the hotspot running on my Android device) it automatically connects to my home WiFi instead of the hotspot.
In /var/log/syslog
I cannot see that the RPi recognizes the hotspot as available network.
Anybody have a clue why it keeps happening?
Solution 1:[1]
The issue is with how the RPi handles priority
. Numbers that are larger have a higher priority rather than how we think of 1=first, 2=second, etc.
So the solution would be to switch the numbers in your definitions:
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WordClock_Access"
psk="a_password"
id_str="unterwegs"
priority=2
}
network={
ssid="wocl"
psk="another_password"
id_str="Zuhause"
priority=1
}
This way, your RPi will prioritize the hotspot over your home network.
They describe this in more (and better) detail here which Maxim already pointed out.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Fruity Fritz |