Commands -- Wi-Fi
POST /api/cmd.wifi.connect
Connect to a Wi-Fi network with the provided SSID if a profile is defined.
If the SSID profile is not defined, the connection requires additional information:
- WEP or WPA-PSK connections require
key - WPA-EAP and 802.1x connections require Extensible Authentication Protocol (EAP) related information
When credentials cannot be obtained from an existing SSID profile or supplied parameters, the connection cannot be completed.
Available in 7.1.1 or later
Input Parameters
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | Wi-Fi WAN connection ID |
ssid | string | ✅ | SSID to connect to |
security | object | ✅ | Security information (fw 8.2.0+) |
securityPolicy | string | ✅ | open, wep, wpa-eap, wpa-psk, 8021x (deprecated in fw 8.2.0, use security) |
key | string | optional | Key for WEP and WPA-PSK (deprecated in fw 8.2.0, use security) |
preferredBssid | string (MAC) | optional | Preferred BSSID |
Security Object:
| Field | Type | Required | Description |
|---|---|---|---|
policy | object | ✅ | Security policy object |
Security_Policy Object:
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | One of: WPA3-Personal, WPA2/WPA3-Personal, 802.1x with dynamic WEP key, WPA/WPA2-Personal, WPA/WPA2-Enterprise, Open, WEP |
detail | object | ✅ | Security policy detail |
Security_Policy_Detail Object:
| Field | Type | Required | Description |
|---|---|---|---|
key | string | optional | Pre-shared Key (PSK). Only for WPA3-Personal, WPA2/WPA3-Personal, WPA/WPA2-Personal, or WEP policy types. |
cURL Example
curl -b cookies.txt -H "Content-Type: application/json" \
-X POST -d '{"connId":1,"ssid":"Main SSID"}' \
http://192.168.1.1/api/cmd.wifi.connect
{
"stat": "ok"
}
POST /api/cmd.wifi.disconnect
Disconnect from the current Wi-Fi network.
Available in 7.1.1 or later
Input Parameters
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | Wi-Fi WAN connection ID |
ssid | string | optional | SSID to disconnect. When omitted, the currently connected SSID will be disconnected. |
cURL Example
curl -b cookies.txt -H "Content-Type: application/json" \
-X POST -d '{"connId":1,"ssid":"Main SSID"}' \
http://192.168.1.1/api/cmd.wifi.disconnect
{
"stat": "ok"
}
POST /api/cmd.wifi.forget
Remove an existing SSID profile by giving the SSID and authentication method. Wi-Fi will also disconnect if it is currently using this SSID.
Available in 7.1.1 or later
Input Parameters
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | Wi-Fi WAN connection ID |
ssid | string | ✅ | SSID to forget |
securityPolicy | string | ✅ | open, wep, wpa-eap, wpa-psk, 8021x |
cURL Example
curl -b cookies.txt -H "Content-Type: application/json" \
-X POST -d '{"connId":1,"ssid":"Main SSID","securityPolicy":"wpa-psk"}' \
http://192.168.1.1/api/cmd.wifi.forget
{
"stat": "ok"
}
GET /api/cmd.wifi.result
Obtain the last known result of a Wi-Fi WAN connection.
Available in 7.1.1 or later
Input Parameters
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | Wi-Fi WAN connection ID |
Response
| Field | Type | Description |
|---|---|---|
timestamp | integer | Timestamp of the last known result |
result | string | CONNECTED, TIMEOUT, PSK_AUTH_FAIL, EAP_AUTH_FAIL, AP_NOT_FOUND, or UNKNOWN_FAIL |
bssid | string (MAC) | BSSID of the connected AP |
ssid | string | SSID of the connected AP |
securityPolicy | string | open, wep, wpa-eap, wpa-psk, 8021x |
message | string | Additional information |
Result Values:
| Value | Description |
|---|---|
CONNECTED | Wi-Fi successfully connected |
TIMEOUT | Wi-Fi connect timeout |
AP_NOT_FOUND | Cannot find the AP |
PSK_AUTH_FAIL | PSK does not match |
EAP_AUTH_FAIL | EAP username/password mismatch |
UNKNOWN_FAIL | Unclassified failure |
cURL Example
curl -b cookies.txt \
"http://192.168.1.1/api/cmd.wifi.result?connId=1"
{
"stat": "ok",
"response": {
"result": "CONNECTED",
"timestamp": 1529899328,
"ssid": "Main SSID",
"bssid": "A2:E5:B8:55:89:DF",
"securityPolicy": "wpa-psk",
"message": "connected to Main SSID (A2:E5:B8:55:89:DF)"
}
}
GET /api/cmd.wifi.scan
Discover nearby Wi-Fi access points.
Available in 7.1.1 or later
Input Parameters
| Field | Type | Required | Description |
|---|---|---|---|
connId | number | ✅ | Wi-Fi WAN connection ID |
infoType | string | optional | status (connection status) or config (profile info) |
sortBy | string | optional | name, security, signal, or channel |
sortOrder | string | optional | asc or desc |
Response
Returns an array of Wifi objects:
| Field | Type | Description |
|---|---|---|
ssid | string | Service Set Identifier (SSID) |
bssid | string (MAC) | Basic Service Set Identifier (BSSID) |
signal | number | Signal in dBm (deprecated in fw 8.1.0) |
signalStrength | number | Signal in dBm (fw 8.1.0+) |
signalLevel | number | Signal level 0--5 (fw 8.1.0+) |
channel | number | Channel number |
securityPolicy | string | open, wep, wpa-eap, wpa-psk, 8021x |
status | object | Status info (when infoType=status) |
config | object | Config info (when infoType=config) |
Status Object:
| Field | Type | Description |
|---|---|---|
inUse | boolean | SSID profile is targeted for connection |
connected | boolean | Wi-Fi is currently connected to this SSID |
Config Object:
| Field | Type | Description |
|---|---|---|
profileId | integer | ID of the connect profile |
automatic | boolean | Wi-Fi is configured to connect automatically |
cURL Example
curl -b cookies.txt \
"http://192.168.1.1/api/cmd.wifi.scan?connId=1&infoType=status"
{
"stat": "ok",
"response": [
{
"ssid": "Main SSID",
"bssid": "A2:E5:B8:55:89:DF",
"signal": -68,
"channel": 10,
"securityPolicy": "wpa-psk",
"status": {
"inUse": true,
"connected": true
}
}
]
}