Beobachtungen
In der Praxis sieht das dann so aus wie unten im Log bei Connect to WiFi twice zu sehen. Erst einmal schlägt die Verbindung fehl aber nachdem noch einmal nachgehakt wurde, klappt es erfolgreich. Alles andere als optimal, ist halt aber scheinbar so.
Connect to WiFi twice shmoo
=============================
Bee Observer Datalogger 0.5.1
=============================
CPU freq 160.0 MHz
Device id 807d3ac342bc
Python : 3.4.0
lorawan : 1.0.2
machine : FiPy with ESP32
nodename: FiPy
release : 1.20.0.rc12.1
sigfox : 1.0.1
sysname : FiPy
version : 6c0000f on 2019-08-01
23.7123 [terkin.device ] INFO : Starting networking
23.8151 [terkin.network.wifi ] INFO : WiFi STA: Networking address (MAC): {'ap_mac': '80:7d:3a:c3:42:bd', 'sta_mac': '80:7d:3a:c3:42:bc'}
23.8323 [terkin.network.wifi ] INFO : WiFi STA: Networking address (IP): ('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0')
23.8654 [terkin.network.wifi ] INFO : WiFi STA+AP: Starting interface
23.8867 [terkin.network.wifi ] INFO : WiFi STA: Connecting to configured networks: ['GartenNetzwerk']. Attempt: #1
23.9091 [terkin.network.wifi ] INFO : WiFi STA: Prepare connecting to network "GartenNetzwerk"
23.9923 [terkin.network.wifi ] INFO : WiFi STA: Auth mode from NVRAM with key=wa.0a10c7c77510, value=3
24.0140 [terkin.network.wifi ] INFO : WiFi STA: Attempt connecting to network "GartenNetzwerk" with auth mode "3"
24.0376 [terkin.network.wifi ] INFO : WiFi STA: Starting connection to "GartenNetzwerk" with timeout of 15.0 seconds
24.0640 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 17 retries left
24.8910 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 16 retries left
25.7192 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 15 retries left
26.5462 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 14 retries left
27.3736 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 13 retries left
28.2000 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 12 retries left
29.0255 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 11 retries left
29.8515 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 10 retries left
30.6755 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 9 retries left
31.4993 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 8 retries left
32.3224 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 7 retries left
33.1464 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 6 retries left
33.9704 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 5 retries left
34.7944 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 4 retries left
35.6183 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 3 retries left
36.4423 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 2 retries left
37.2665 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 1 retries left
38.0903 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 0 retries left
38.9280 [terkin.network.wifi ] ERROR : WiFi STA: Connecting to "GartenNetzwerk" failed
Traceback (most recent call last):
File "/flash/lib/terkin/network/wifi.py", line 128, in connect_stations
File "/flash/lib/terkin/network/wifi.py", line 203, in connect_station
WiFiException: WiFi STA: Unable to connect to "GartenNetzwerk"
38.9691 [terkin.network.wifi ] INFO : WiFi STA: Forgetting NVRAM data for network "GartenNetzwerk"
39.0721 [terkin.network.wifi ] ERROR : WiFi STA: Connecting to any network candidate failed. Please check your WiFi configuration for one of the station candidates 1.
39.0921 [terkin.network.wifi ] WARNING: Todo: We might want to buffer telemetry data to flash memory to be scheduled for transmission later.
39.1095 [terkin.network.wifi ] INFO : WiFi STA: Connecting to configured networks: ['GartenNetzwerk']. Attempt: #2
39.1325 [terkin.network.wifi ] INFO : WiFi STA: Prepare connecting to network "GartenNetzwerk"
39.2188 [terkin.network.wifi ] INFO : WiFi STA: Unknown auth mode for network "GartenNetzwerk", invoking WiFi scan
39.2358 [terkin.network.wifi ] INFO : WiFi STA: Scanning for networks
42.2570 [terkin.network.wifi ] INFO : WiFi STA: Networks available: ['REDACTED', 'REDACTED', 'YADDA', 'GartenNetzwerk', 'REDACTED', 'REDACTED']
42.3047 [terkin.network.wifi ] INFO : WiFi STA: Storing auth mode into NVRAM with key=wa.0a10c7c77510, value=3
42.3286 [terkin.network.wifi ] INFO : WiFi STA: Attempt connecting to network "GartenNetzwerk" with auth mode "3"
42.3546 [terkin.network.wifi ] INFO : WiFi STA: Starting connection to "GartenNetzwerk" with timeout of 15.0 seconds
42.3840 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 17 retries left
43.2122 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 16 retries left
44.0407 [terkin.network.wifi ] INFO : WiFi STA: Waiting for network "GartenNetzwerk" to come up, 15 retries left
44.8859 [terkin.network.wifi ] INFO : WiFi STA: Connected to "('GartenNetzwerk', 'fipy-wlan-42bc')" with IP address "192.168.178.21"
44.9752 [terkin.network.wifi ] INFO : WiFi STA: Networking address (MAC): {'ap_mac': '80:7d:3a:c3:42:bd', 'sta_mac': '80:7d:3a:c3:42:bc'}
44.9933 [terkin.network.wifi ] INFO : WiFi STA: Networking address (IP): ('192.168.178.21', '255.255.255.0', '192.168.178.1', '192.168.178.1')
45.0158 [terkin.network.core ] INFO : Network interface ready
45.0446 [terkin.device ] INFO : [LoRa] Disabling LoRa interface as no antenna has been attached. ATTENTION: Running LoRa without antenna will wreck your device.
45.0660 [terkin.device ] INFO : Starting telemetry
Weitere Nachforschungen
Für die Ursachenforschung könnte man noch ein paarmal den Mond umkreisen. Vermutlich ist es so, dass der halbgare Zustand durch den WiFi-Scan gerettet wird, der zwangsläufig beim zweiten Versuch folgt .
Einschätzung des Problems
Alles kein Drama. Dass die Verbindung mal nicht klappt, passierte innerhalb der letzten Testreihe nur zwei Mal innerhalb von 18 Stunden Laufzeit im Produktionsmodus (mit Deep Sleep, mit Watchdog, ohne LED-Heartbeat; dafür aber mit Logging und am Strom ohne Batterie) und wird ja nun durch den kleinen Workaround kompensiert.
root@kotori-one:~# cat /home/pi/sermon-workbench-fipy.log | grep Exception
WiFiException: WiFi STA: Unable to connect to "GartenNetzwerk"
WiFiException: WiFi STA: Unable to connect to "GartenNetzwerk"
P.S.: Wenn man das Log genau anschaut, entdeckt man so eine Versionsnummer:
Das kommt aus den ersten Versuchen zu Module freezing for Pycom MicroPython - #5 by Andreas.