Page 1 of 1
Automatic switching between wifi network
Posted: Thu Dec 29, 2016 10:32 am
by himkiet
I am using a raspberry pi.I want to automatically switch between two wifi networks if one network got unavailable But in my raspberry pi i have to enter wifi key again to connect to another network.Is there any way my pi remembers wifi key and switch automatically between different wifi network when one is unavailable
Re: Automatic switching between wifi network
Posted: Thu Dec 29, 2016 10:40 am
by DougieLawson
They go in /etc/wpa_supplicant/wpa_supplicant.conf and are remembered so automatic connection to a network in range is possible.
Code: Select all
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WiFiSSIDforNetworkNumber1goeshere"
priority=60
psk="passwordforonehere"
}
network={
ssid="WiFiSSIDforNetworkNumber2goeshere"
priority=80
psk="otherpasswordgoeshere"
}
the priority works that higher number connects first if both are in range.
Re: Automatic switching between wifi network
Posted: Fri Dec 30, 2016 3:39 pm
by himkiet
this works fine.. but I want to switch my wifi network to another network if one network doesn't receive data, I current case pi switch to the different network if one network is unavailable. I am working on a vehicle tracking system, my network doesn't receive data in certain areas, so i want my pi to switch to the different network and start transmitting data(whether another network present or not).
Re: Automatic switching between wifi network
Posted: Fri Dec 30, 2016 10:48 pm
by DougieLawson
Do a ping, when the ping fails rewrite the supplicant file and restart the wpa_supplicant task.
Re: Automatic switching between wifi network
Posted: Sat Jun 27, 2020 6:22 pm
by AGID
DougieLawson wrote: ↑Fri Dec 30, 2016 10:48 pm
Do a ping, when the ping fails rewrite the supplicant file and restart the wpa_supplicant task.
@DougieLawson is this still the best way to get connected to wifi with internet connection until now (Buster release)?
Also, Does priority works with buster as well?
Re: Automatic switching between wifi network
Posted: Sun Jun 28, 2020 1:02 pm
by AGID
Bump
Re: Automatic switching between wifi network
Posted: Sun Jun 28, 2020 1:07 pm
by epoch1970
Try "man wpa_supplicant" and see what "wpa_cli -a myscript" can do for you.
Re: Automatic switching between wifi network
Posted: Sun Jun 28, 2020 2:10 pm
by AGID
epoch1970 wrote: ↑Sun Jun 28, 2020 1:07 pm
Try "man wpa_supplicant" and see what "wpa_cli -a myscript" can do for you.
can you give me more details about wpa_cli?
Thanks
Re: Automatic switching between wifi network
Posted: Sun Jun 28, 2020 2:47 pm
by epoch1970
Considering the wpa_cli action script mechanism is 14 years old, I'm fairly convinced enough information is available already.
Re: Automatic switching between wifi network
Posted: Sun Jun 28, 2020 5:40 pm
by AGID
epoch1970 wrote: ↑Sun Jun 28, 2020 2:47 pm
Considering the wpa_cli action script mechanism is 14 years old, I'm fairly convinced enough information is available already.
Ok thanks
Re: Automatic switching between wifi network
Posted: Sun Jun 28, 2020 8:11 pm
by AGID
epoch1970 wrote: ↑Sun Jun 28, 2020 2:47 pm
Considering the wpa_cli action script mechanism is 14 years old, I'm fairly convinced enough information is available already.
It just provide limited access through Actionscript which wont be so much useful but thanks for the idea
