Fix flaky hotspot->home WiFi reconnect in netwatch

Real-hardware finding: netwatch repeatedly reported 'home WiFi not found'
4 times over 13min while sitting right next to the router. Root cause:
a plain 'nmcli con up home-wifi' straight out of AP mode relies on NM's
scan cache for wlan0, which is stale/empty coming out of AP mode (the
radio can't scan while acting as an AP). A single con-up attempt didn't
wait for a fresh scan to land before giving up.

Fix: explicitly drop the AP connection first to free the radio, force a
fresh scan with a settle delay, and retry the connect attempt (longer
30s timeout) up to 2 times before conceding and restoring the hotspot.
Bumped the systemd unit's TimeoutStartSec to 180s to give the retry loop
enough headroom (was defaulting to 90s).

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-09 15:44:19 -04:00
co-authored by Copilot
parent fc18f71cfe
commit 04cf74ccd3
2 changed files with 28 additions and 2 deletions
+3
View File
@@ -5,4 +5,7 @@ Wants=NetworkManager.service
[Service]
Type=oneshot
# Retry loop (down AP, rescan, retry connect up to 2x) can take ~80s worst
# case - default 90s systemd start timeout was too tight a margin.
TimeoutStartSec=180
ExecStart=/usr/local/bin/yaris-netwatch.sh