Skip to main content

set_wifi

ReferenceAudience: API consumerUse: create or modify a Wi-Fi profile on the reader

Overview​

set_wifi writes a Wi-Fi profile to the reader — it creates a new saved profile or modifies an existing one (selected by wifiConfig.operation = CREATE / MODIFY). One payload configures the interface, the access point (ESSID, preference), the security type and its credentials (WPA2/WPA3 Personal or Enterprise), and DHCP IPv4. It is a state-changing command on the device-management (MGMT) endpoint. The response is status-only — it echoes no configuration and no credentials; confirm the result with get_wifi.

set_wifi is state-changing: accessPoint.connect: true switches networks and can sever the MQTT control session. Use connect: false to save a profile without switching. See the warning callout in Notes and Caveats.

Details​

PropertyValue
Interaction PatternRequest / Response (app publishes a command; device publishes the correlated reply)
State ChangeSTATE-CHANGING (writes a saved profile; may switch the active connection)
ReversibilityREVERSIBLE (remove a created profile with delete_wifi_profile; re-send set_wifi MODIFY to change settings)
Supported OperationsCREATE (new profile), MODIFY (update existing, matched by essid)
Required Request Fieldscommand, requestId, wifiConfig (with operation and accessPoint; inside it, essid and isPreferred)
Applies ToEndpoint: Management (MGMT). Reader: RFD40 series, RFD90 series
API VersionV1.1 (API Version Reporting)
Relatedget_wifi, delete_wifi_profile, install_certificate

When to Use​

Use set_wifi to provision or update the reader's Wi-Fi — during onboarding, when a network changes, or to mark a profile preferred.

  • CREATE: first-time provisioning of a new ESSID. Fails with code 18 if the ESSID already exists.
  • MODIFY: update an existing profile (password, security, preference), matched by essid. Fails with code 15 if the ESSID is not found. A MODIFY can be a partial payload — e.g. just operation + accessPoint.{isPreferred, essid} to set the preferred flag.
  • Pre-provision safely: send connect: false to save a profile without switching the active connection — the recommended pattern when managing a reader over the same Wi-Fi that carries the MDM session.

Topic Mapping​

MessageDirectionTopicNote
RequestApp → Reader<tenantId>/MGMT/clients/cmnd/<serial>On the management endpoint.
ResponseReader → App<tenantId>/MGMT/clients/resp/<serial>Correlated reply to the request above; the in-payload requestId links the twin topics.

Topics follow the pattern <tenantId>/<topic>/<serial> — the tenant id assigned to you at provisioning (a slot you fill in, never a literal), the base topic you configure on the endpoint, and the reader's serial number, which the reader appends itself in its model-prefixed form (for example RFD40-212735201D0053). App → Reader means your app publishes and the reader subscribes; Reader → App means the reader publishes and your app subscribes.

Credentials are presented once at CONNECT. The requestId you send is echoed in the response so you can pair reply to request. The endpoint's mqttParams govern QoS and retain, not this command.

See Topics and Channels.

Key Fields​

  • wifiConfig.operation (request) — CREATE or MODIFY; determines whether a new profile is added or an existing one (matched by essid) is updated.
  • wifiConfig.accessPoint.essid (request) — the network name; the create target / modify key (case-sensitive).
  • wifiConfig.accessPoint.connect (request) — ⚠️ true switches the active connection (can sever the MDM session); false just saves. See the notes below.
  • wifiConfig.accessPoint.security.securityType (request) — selects which securityDetails key you populate (WPA2/WPA3 Personal or Enterprise).
  • response.code (response) — read this to determine success vs failure (see Response Codes).

Request Payload​

The request envelope is command, requestId, and the wifiConfig payload. Use the Schema tab for the full field reference and the Example tab for a ready-to-send WPA2-Personal CREATE (enterprise variants are in Examples).

Credentials in the examples are the contract's sample values, not real secrets — passwords, passphrases, and identities are write-only (see Request Semantics).

Pick a profile scenario below; the Example and Schema update together. Use the Schema tab for the full field reference and the Example tab for the concrete payload.

Request payload
Example: WPA2-Personal CREATE
{
"command": "set_wifi",
"requestId": "abc123",
"wifiConfig": {
"interfaceName": "wlan0",
"enableInterface": true,
"operation": "CREATE",
"accessPoint": {
"connect": false,
"isPreferred": false,
"autoConn": true,
"essid": "TestAP1",
"enableSecurity": true,
"security": {
"securityType": "WPA2Personal",
"securityDetails": {
"WPA2Personal": {
"password": "test@123"
}
}
}
}
}
}

Request Semantics​

  • CREATE vs MODIFY. CREATE adds a new profile (fails 18 if the essid exists); MODIFY updates an existing profile matched by essid (fails 15 if not found). The device enforces a maximum number of saved profiles — exceeding it returns 19; delete unused profiles with delete_wifi_profile. For Enterprise TLS, the ca_cert / client_cert / client_key referenced in certificate must already be installed via install_certificate.
  • Credentials are write-only — mask them. Supply passwords, passphrases, and identities in the request (the examples carry sample values); the device never echoes them — set_wifi's response carries no credentials, and get_wifi returns stored secrets masked.
  • Enterprise inner authentication. For ttls and peap, innerAuthentication must be mschapv2 and defaults to mschapv2 when omitted; for tls it is not applicable and can be omitted, as the tls variants on this page do.
  • IPv4 only, DHCP only. In the current API version, set_wifi supports IPv4 with DHCP assignment only. The ipv4Configuration static fields (ipAddress / subnetMask / gateway / dnsServer) are modeled in the schema but not supported yet (planned for a future release), and IPv6 is not available. Use enableDhcp: true.

Response Payload​

set_wifi returns a status-only envelope — command, requestId, apiVersion, and response. There is no configuration echo and no credential in the response; to confirm the saved profile, follow up with get_wifi.

Response payload
{
"command": "set_wifi",
"requestId": "abc123",
"apiVersion": "V1.1",
"response": {
"code": 0,
"description": "Success"
}
}

Response Codes​

set_wifi returns response.code. The codes applicable to this command are below; for the full table see the Response Codes and Correlation and Request/Response Pairing.

CodeDescription
0Success — the profile was created or modified.
2Invalid payload (IOT_ERROR_INVALID_PAYLOAD) — the JSON is malformed or has invalid field values. Validate against the schema and correct.
15WIFI Error - SSID not found (IOT_ERROR_SSID_NOT_FOUND) — a MODIFY targeted an essid that is not saved. Verify the name or CREATE it first.
17WIFI Error - SSID missed (IOT_ERROR_SSID_MISSED) — the required essid field is missing from the payload.
18WIFI Error - SSID already exist (IOT_ERROR_SSID_ALREADY_EXIST) — a CREATE used an essid that already exists. Use MODIFY, or delete the existing profile first.
19WIFI Error - SSID count overflow (IOT_ERROR_SSID_LIMIT_OVERFLOW) — the saved-profile limit is reached. Delete an unused profile with delete_wifi_profile.
20Wifi is not supported (IOT_ERROR_WIFI_INTER_NOT_SUPPORTED) — the device has no Wi-Fi interface; use Ethernet.
23Invalid enum value (IOT_ERROR_INVALID_ENUM) — a field (e.g. operation, securityType, authentication) is outside its allowed set.
101Default error — generic catch-all.

Examples​

Publish a set_wifi request; the device replies with the status-only envelope shown under Response Payload. Every contract example is in the Profile scenario dropdown under Request Payload:

  • Create WPA2 personal and Modify WPA2 personal — a pre-shared key.
  • Set preferred AP — a partial MODIFY that needs only operation plus accessPoint.{isPreferred, essid}.
  • Create WPA2 enterprise TLS / TTLS / PEAP and Create WPA3 enterprise TLS / TTLS / PEAP — installed certificates referenced as {key, value}, an EAP authentication method and a protocol; the TTLS and PEAP variants add innerAuthentication.

Notes and Caveats​

connect: true can sever the control session

accessPoint.connect: true disconnects the currently connected profile and connects to the target ESSID. If the reader manages itself over the same Wi-Fi that carries its MQTT/MDM session, switching to a different network drops the control channel and can strand the device. When managing a reader over Wi-Fi, use connect: false (save without switching), and undo an unwanted profile with delete_wifi_profile rather than connecting onto it.

Because the response is status-only, verify the result with get_wifi — check that the profile was saved (and its isPreferred / accessPoint.status). For the concept-level view, see Network Configuration.

Related: 📕 Network Configuration · 📕 get_wifi · 📕 delete_wifi_profile · 📕 install_certificate · 📕 Response Codes

Was this helpful?