# Factory CLI Wi-Fi Commands The Factory CLI accepts commands terminated by CR, LF, or CRLF on UART0. A successful command returns `OK`. Commands that return data emit one JSON line before `OK`. Failures return `ERROR `. ## Read Saved Networks ```text get_wifi ``` The response lists saved SSIDs in connection-priority order. Passwords are never returned. Up to 10 networks can be stored. ```text {"count":2,"networks":[{"priority":0,"ssid":"Office WiFi"},{"priority":1,"ssid":"Backup"}]} OK ``` An empty list is returned as: ```text {"count":0,"networks":[]} OK ``` ## Save a Network ```text set_wifi "Office WiFi" "network-password" ``` The SSID is required and may contain up to 32 bytes. The password may contain up to 64 bytes. Quote arguments that contain spaces. A missing or explicitly empty password saves an open network: ```text set_wifi "Guest Network" set_wifi "Guest Network" "" ``` Backslash escapes the following character inside or outside quoted arguments. To include a literal backslash, enter it twice. Saving a new SSID inserts it at priority 0. Saving an existing SSID replaces its password and moves it to priority 0. If 10 networks are already saved, adding a new SSID removes the lowest-priority entry. This command only updates persistent credentials; it does not disconnect or immediately reconnect the current station. ## Clear Saved Networks ```text reset_wifi ``` This command clears all saved Wi-Fi credentials, returns `OK`, allows 100 ms for the UART reply to be transmitted, and restarts the device. It has the same persistence effect as the physical Wi-Fi reset action. ## Error Responses | Response | Meaning | | --- | --- | | `ERROR invalid_command_syntax` | An argument quote was not closed or the command contains too many arguments. | | `ERROR wifi_read_failed` | Saved networks could not be read. | | `ERROR wifi_response_too_large` | The saved network response exceeded the internal reply buffer. | | `ERROR missing_wifi_ssid` | `set_wifi` did not receive a non-empty SSID. | | `ERROR invalid_wifi_arguments` | `set_wifi` received more than an SSID and password. | | `ERROR invalid_wifi_credentials` | The SSID or password exceeded its supported length. | | `ERROR wifi_save_failed` | Credentials could not be saved. | | `ERROR wifi_reset_failed` | Saved credentials could not be cleared. |