Rehan

Rehan

Need help with assigning priority to wifi network

Hello Community,

I’m trying to configure multiple wifi networks to my wlan0 using vintage_net.
I want understand more about assigning priority to the networks. I was able to set priority and observed that network with higher priority is selected. Sharing an example i used

VintageNet.configure("wlan0", %{
  type: VintageNetWiFi,
  vintage_net_wifi: %{
    networks: [
      
      %{
        ssid: "TestWifi1",
        psk: "Test1234567",
        key_mgmt: :wpa_psk,
        priority: 2
      },
      %{
        ssid: "TestWifi2",
        psk: "Test1234567@sor",
        key_mgmt: :wpa_psk,
        priority: 1
      }
    ]
  },
  ipv4: %{method: :dhcp}
})

Referring to above example, I observed wlan0 get connected to TestWifi1
I do have few question related to this

  1. Is there any limit to priority
  2. Is there any other method to assign priority
  3. priority should always be integer? or it can be string?
  4. I was not able to find any documentation related to this, if someone can point me to any documentation

Thanks & Regards

Most Liked

fhunleth

fhunleth

Co-author of Nerves

VintageNetWiFi’s parameters translate pretty much verbatim to those used by wpa_supplicant, so the example wpa_supplicant.conf usually has the best information.

Here’s the relevant section about priority:

# priority: priority group (integer)
# By default, all networks will get same priority group (0). If some of the
# networks are more desirable, this field can be used to change the order in
# which wpa_supplicant goes through the networks when selecting a BSS. The
# priority groups will be iterated in decreasing priority (i.e., the larger the
# priority value, the sooner the network is matched against the scan results).
# Within each priority group, networks will be selected based on security
# policy, signal strength, etc.
# Please note that AP scanning with scan_ssid=1 and ap_scan=2 mode are not
# using this priority to select the order for scanning. Instead, they try the
# networks in the order that used in the configuration file.

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New

Other popular topics Top

ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement