Hi everyone! I’ve been using some Raspberry Pi Zero 2s as IOT hosts for some simple devices. The issue I’m running into is, if a host loses its connection, that’s it. It won’t auto reconnect. I have to reboot the device, which does solve the issue. Checking the status LED when this happens, 4 blinks, network issue.
I set these devices up by first adding a debug network I use via mobile hotspot from my laptop. Then I log in via SSH through the Balena dashboard and add the final wifi credentials using this script:
#!/bin/bash
ssid=---REDACTED---
password=---REDACTED---
connections_temp=/etc/NetworkManager/system-connections/
connections_perm=/mnt/boot/system-connections/
wifi_adapter=wlan0
nmcli connection add type wifi ifname "$wifi_adapter" con-name "$ssid" ssid "$ssid"
nmcli connection modify "$ssid" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$password" wifi.hidden yes
cd $connections_temp
cp *.nmconnection $connections_perm
cd $connections_perm
chmod 600 *.nmconnection
Do I need to add some kind of parameter to my nmcli calls to tell the system to auto-reconnect?