Budgie
Posts: 62
Joined: Mon Jan 19, 2015 3:30 pm

How can I move between different hidden SSIDs.

Sat Sep 25, 2021 12:38 pm

I am using RPi3 with IQaudio DAC+ hat as an audio renderer with remote control point being an Android phone. The RPi is working as an headless box and I can only access it using ssh.
.
I wish to be able to move the RPi frequently between to two locations which are served by wifi but are "hidden."

In order to obtain a network connection until now I have set up my wpa_supplicant.conf as follows:-

wpa_supplicant.conf to include line 7, scan_ssid=1 in network={
ssid="insert_your_hidden_SSID_here"
scan_ssid=1
psk="insert_your_wifi_password_here"
key_mgmt=WPA-PSK
}

This works fine but I have no idea how I can have more than one SSID preconfigured so I can switch between the two automatically.
As corollary to this, what do I do if both SSIDs are avalable at the same time?

Grateful for some help please.
Budgie

Budgie
Posts: 62
Joined: Mon Jan 19, 2015 3:30 pm

Re: How can I move between different hidden SSIDs.

Sat Sep 25, 2021 1:48 pm

Further to this and from the RPi documentation what I have sued above is slightly different.
The documentation includes the following example:-
network={
ssid="HomeTwoSSID"
psk="passwordTwo"
priority=2
id_str="homeTwo"
}

I understand the priority setting but what does the id_str setting do. Where and how can I see this if I am working headlessly?
It is no good me setting priority, I need to be able to chose because location site has both SSIDs on different subnets.
I am using a control point app for playing but how may I control the choice of SSID?

jbudd
Posts: 1911
Joined: Mon Dec 16, 2013 10:23 am

Re: How can I move between different hidden SSIDs.

Mon Sep 27, 2021 1:25 am

Maybe this would work to choose the network:
Have two wpa_supplicant.conf files in your home directory, one for network0 and one for network1.
Each version also has a network= stanza for your mobile phone hotspot, with a higher priority (priority 2 is higher than priority 1 in this context)

To choose a different network:
Turn on your hotspot
Boot the Pi
Send the Pi a message (I'd use MQTT for this)
The program which receives the message does:
- sudo cp /home/pi/wpa_supplicant.conf.n /boot/wpa_supplicant.conf
- sudo reboot
Turn off your hotspot.

You could also do it with a physical switch on a GPIO pin.
Compare it's value with the network defined in /etc/wpa_supplicant.conf. If they don't match, copy the appropriate wpa_supplicant file to /boot/wpa_supplicant.conf and reboot.

Budgie
Posts: 62
Joined: Mon Jan 19, 2015 3:30 pm

Re: How can I move between different hidden SSIDs.

Mon Sep 27, 2021 8:46 am

Hi and many thanks for the suggestion.
I think I understand what you suggest but in our context it will be easier to do the swap using a laptop as required until the Pi is nailed to the one position. The swapping back and forth will only be in a transient phase while I sort out other stuff on the subnets and then hopefully it will be fit and forget. Thanks again for the idea and making me think harder.

Return to “Beginners”