CLI command to reconnect WiFi

I’d love for my X750 to have a WiFi preference order, check every couple of minutes to see if a higher listed SSID is visible, and then try to connect to it.
Anybody know if that is already possible?
Otherwise I’m going to build some logic with iwinfo radio0 scan and a cronjob.

Currently it does not order the ssid by signal. It will find next available ssid and connect to it.

Maybe you need to write your own script.

Thanks, figured that might be the case. This is for a permanent always-on WiFi system in my vehicle.
After having Verizon problems with the X750 I switched to an Airlink which was worse than the Gl.Inet, going to sell it and have gone back to the X750 with original VZ-issued hostpot, X750 using WiFi as WAN. The one thing that the Airlink did right however was check the order of WiFi and reconnect as needed.

Order by signal is useful and I will let developer check if this can be done effectively.

2 Likes

Ok I have a working script but it only checks one SSID for now. I’ll update this post when I have the for loop working that checks a list of known good SSID’s to connect to.
Again for this to make sense to anyone reading, the X750 is providing WiFi in a vehicle, the backhaul Internet (right now anyway) is always WiFi, and the goal is to use non-cellular, unmetered WiFi as a preference over the Verizon hotspot.
This script is called by a Raspberry Pi 4 running raspbian (hence bash instead of sh). It can probably be adapted to work and live on the X750 natively.

#!/bin/bash

sshpass -p [redacted] ssh -o ConnectTimeout=5 -o ConnectionAttempts=1 -o StrictHostKeyChecking=no -o KexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.8.1 "iwinfo radio0 scan" > /tmp/wifi-seen-by-X750.txt
sshpass -p [redacted] ssh -o ConnectTimeout=5 -o ConnectionAttempts=1 -o StrictHostKeyChecking=no -o KexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.8.1 "iwinfo" > /tmp/wifi-connected-to

if grep -q HomeWiFiSSID /tmp/wifi-connected-to
 then
  echo I am already connected to HomeWiFiSSID
 elif grep -q HomeWiFiSSID /tmp/wifi-seen-by-X750.txt
 then
  echo HomeWiFiSSID is seen but I am not connected to it. Attempting reconnect.
  sleep 1
  sshpass -p [redacted] ssh -o ConnectTimeout=5 -o ConnectionAttempts=1 -o StrictHostKeyChecking=no -o KexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.8.1 "killall -HUP wpa_supplicant"
 else
  echo No unmetered WiFi networks seen. Staying on cellular backhaul.
fi
4 Likes

Turns out there is an OpenWRT package called Travelmate (and accompanying Luci package) that does exactly what I was looking for. You give it a list of wifi client / STA / wifi as wan connections, can put them in order of preference, and then it will scan and connect automatically. Works great with the X750 Spitz.

1 Like