WiFi Logic

This page explains how the device decides between running its own Access Point and connecting to your WiFi network, and how it behaves over time.

Terminology: STA mode (Station) is sometimes also called Client mode. Both terms describe the same role: the device joining your existing WiFi network. AP mode means the device runs its own WiFi Access Point that you connect to directly.


WiFi States

The device can be in one of the following states:


How It Works

Starting up

The length of the initial STA-only window is set by Initial WiFi client connection attempt (seconds) in the configuration.

Fallback (AP_STA)

Losing the connection

Turning WiFi off

Low power mode: In paths where WiFi would normally transition to OFF, the device sends a status packet and restarts instead.


State Transitions

From To When
BOOT AP No WiFi client credentials are configured.
BOOT STA_CONNECTING WiFi client credentials are configured.
STA_CONNECTING STA Device gets an IP address before the initial timeout expires.
STA_CONNECTING AP_STA Initial STA-only timeout expires without a successful connection.
AP_STA STA STA connection succeeds; the fallback AP is no longer needed.
STA STA_CONNECTING An existing STA connection is lost.
AP OFF AP-only timeout is enabled and the AP stays unused long enough.
AP_STA OFF AP+Client timeout is enabled and the AP stays unused long enough.
OFF STA_CONNECTING WiFi credentials exist and retry after OFF is enabled.
OFF OFF (terminal) No WiFi credentials exist, or retry after OFF is disabled.

Scenarios

1. No WiFi credentials

2. WiFi available at boot

3. WiFi unavailable at boot, fallback AP allowed forever

4. WiFi unavailable at boot, fallback AP has timeout

5. AP is actively used during fallback

6. STA drops after it was working

7. Retry after OFF disabled

8. Low power mode