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
| Property | Value |
|---|---|
| Interaction Pattern | Request / Response (app publishes a command; device publishes the correlated reply) |
| State Change | STATE-CHANGING (writes a saved profile; may switch the active connection) |
| Reversibility | REVERSIBLE (remove a created profile with delete_wifi_profile; re-send set_wifi MODIFY to change settings) |
| Supported Operations | CREATE (new profile), MODIFY (update existing, matched by essid) |
| Required Request Fields | command, requestId, wifiConfig (with operation and accessPoint; inside it, essid and isPreferred) |
| Applies To | Endpoint: Management (MGMT). Reader: RFD40 series, RFD90 series |
| API Version | V1.1 (API Version Reporting) |
| Related | get_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 code18if the ESSID already exists.MODIFY: update an existing profile (password, security, preference), matched byessid. Fails with code15if the ESSID is not found. AMODIFYcan be a partial payload — e.g. justoperation+accessPoint.{isPreferred, essid}to set the preferred flag.- Pre-provision safely: send
connect: falseto 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
| Message | Direction | Topic | Note |
|---|---|---|---|
| Request | App → Reader | <tenantId>/MGMT/clients/cmnd/<serial> | On the management endpoint. |
| Response | Reader → 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) —CREATEorMODIFY; determines whether a new profile is added or an existing one (matched byessid) is updated.wifiConfig.accessPoint.essid(request) — the network name; the create target / modify key (case-sensitive).wifiConfig.accessPoint.connect(request) — ⚠️trueswitches the active connection (can sever the MDM session);falsejust saves. See the notes below.wifiConfig.accessPoint.security.securityType(request) — selects whichsecurityDetailskey 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.
- Example
- Schema
| Field | Type | Enum / Units | Example | Description |
|---|---|---|---|---|
command* | string | — | set_wifi | Fixed command name. |
requestId* | string | — | abc123 | A unique identifier for the request; echoed back in the response. |
wifiConfig* | object | — | — | The Wi-Fi profile to configure. Required by the contract, so a request without it is invalid rather than merely useless. |
interfaceName, nesting level 2 | string | — | wlan0 | Wireless interface name (e.g. wlan0). Typically sent for CREATE. |
enableInterface, nesting level 2 | boolean | — | true | Whether to enable the interface. |
operation*, nesting level 2 | enum | CREATEMODIFY | CREATE | CREATE a new profile or MODIFY an existing one (matched by essid). Required within wifiConfig. |
accessPoint*, nesting level 2 | object | — | — | Access-point connection settings, security, and (DHCP) IP config. Required within wifiConfig. |
connect, nesting level 3 | boolean | — | false | ⚠️ If true, disconnect the current profile and connect to this one; if false (or omitted), just save it. See the connect caveat in Notes. |
isPreferred*, nesting level 3 | boolean | — | false | Mark this profile preferred (always connect when in range). Required within accessPoint. |
autoConn, nesting level 3 | boolean | — | true | Deprecated — reserved for backward compatibility; will be removed. |
essid*, nesting level 3 | string | — | ZWireless | The network name (ESSID). Case-sensitive. Required within accessPoint. |
enableSecurity, nesting level 3 | boolean | — | true | Whether to enable security for this access point. |
ipv4Configuration, nesting level 3 | object | — | — | IPv4 network configuration. Use DHCP (enableDhcp: true), the supported mode; static IP is not supported in the current API version. See Request Semantics. |
ipAddress, nesting level 4 | string | ipv4 | 192.168.1.81 | Static IPv4 address (modeled; not supported yet). |
subnetMask, nesting level 4 | string | ipv4 | 255.255.255.0 | Subnet mask (modeled; not supported yet). |
gateway, nesting level 4 | string | ipv4 | 192.168.1.144 | Gateway (modeled; not supported yet). |
enableDhcp, nesting level 4 | boolean | — | true | Use DHCP for automatic IPv4 assignment (the supported mode). |
dnsServer, nesting level 4 | string | ipv4 | 192.168.1.78 | DNS server (modeled; not supported yet). |
domainName, nesting level 4 | string | — | example.test.com | Domain name (modeled; not supported yet). |
security, nesting level 3 | object | — | — | Security type and credentials. Required keys: securityType, securityDetails. |
securityType*, nesting level 4 | enum | WPA2PersonalWPA3PersonalWPA2EnterpriseWPA3Enterprise | WPA2Personal | Selects which securityDetails key you must populate. |
securityDetails*, nesting level 4 | object | — | — | Credentials for the chosen securityType — populate only the matching key. |
WPA2Personal, nesting level 5 | object | — | — | WPA2-Personal credentials: the password. |
password*, nesting level 6 | string | — | test@123 | Pre-shared key (write-only). |
WPA3Personal, nesting level 5 | object | — | — | WPA3-Personal credentials: the password. |
password*, nesting level 6 | string | — | — | Pre-shared key (write-only). |
WPA2Enterprise, nesting level 5 | object | — | — | 802.1X credentials. Requires authentication. |
authentication*, nesting level 6 | enum | tlsttlspeap | peap | Outer EAP method. |
innerAuthentication, nesting level 6 | enum | nonemschapv2 | mschapv2 | Inner (phase-2) method. Omit it when authentication is tls; for ttls and peap it must be mschapv2, the default. |
identity, nesting level 6 | string | — | test | EAP identity / username (write-only). |
anonymousIdentity, nesting level 6 | string | — | test | Anonymous/outer identity (write-only). |
password, nesting level 6 | string | — | test@123 | EAP password (write-only). |
passphrase, nesting level 6 | string | — | test@123 | Passphrase (write-only). |
certificate, nesting level 6 | array | — | — | Certificate references as {key, value} — the certs must already be installed via install_certificate. |
key, nesting level 7 | enum | ca_certclient_keyclient_certcert_key_password | ca_cert | Certificate role. |
value, nesting level 7 | string | — | wifi_ca_cert | Installed certificate reference name. |
protocol, nesting level 6 | enum | WPA2_Enterprise_CCMP | WPA2_Enterprise_CCMP | WPA2-Enterprise protocol. |
WPA3Enterprise, nesting level 5 | object | — | — | 802.1X credentials for WPA3. Requires authentication. |
authentication*, nesting level 6 | enum | tlsttlspeap | peap | Outer EAP method. |
innerAuthentication, nesting level 6 | enum | nonemschapv2 | mschapv2 | Inner (phase-2) method. Omit it when authentication is tls; for ttls and peap it must be mschapv2, the default. |
identity, nesting level 6 | string | — | test | EAP identity / username (write-only). |
anonymousIdentity, nesting level 6 | string | — | test | Anonymous/outer identity (write-only). |
password, nesting level 6 | string | — | test@123 | EAP password (write-only). |
passphrase, nesting level 6 | string | — | test@123 | Passphrase (write-only). |
certificate, nesting level 6 | array | — | — | Certificate references as {key, value} — the certs must already be installed via install_certificate. |
key, nesting level 7 | enum | ca_certclient_keyclient_certcert_key_password | ca_cert | Certificate role. |
value, nesting level 7 | string | — | wifi_ca_cert | Installed certificate reference name. |
protocol, nesting level 6 | enum | WPA3_Enterprise_CCMPWPA3_Enterprise_CCMP_256WPA3_Enterprise_GCMP_128WPA3_Enterprise_GCMP_256_SHA256WPA3_Enterprise_GCMP_256_SUITEB_192 | WPA3_Enterprise_CCMP | WPA3-Enterprise protocol suite. |
Request Semantics
CREATEvsMODIFY.CREATEadds a new profile (fails18if theessidexists);MODIFYupdates an existing profile matched byessid(fails15if not found). The device enforces a maximum number of saved profiles — exceeding it returns19; delete unused profiles withdelete_wifi_profile. For Enterprise TLS, theca_cert/client_cert/client_keyreferenced incertificatemust already be installed viainstall_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, andget_wifireturns stored secrets masked. - Enterprise inner authentication. For
ttlsandpeap,innerAuthenticationmust bemschapv2and defaults tomschapv2when omitted; fortlsit is not applicable and can be omitted, as thetlsvariants on this page do. - IPv4 only, DHCP only. In the current API version,
set_wifisupports IPv4 with DHCP assignment only. Theipv4Configurationstatic fields (ipAddress/subnetMask/gateway/dnsServer) are modeled in the schema but not supported yet (planned for a future release), and IPv6 is not available. UseenableDhcp: 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.
- Example
- Schema
| Field | Type | Enum / Units | Example | Description |
|---|---|---|---|---|
command* | string | — | set_wifi | Echoes the executed command. |
requestId* | string | — | abc123 | Echoes the request's requestId — pairs reply to request. |
apiVersion* | enum | V1.0V1.1V1.2V1.21V1.22 | V1.1 | API version reported by this command. Emitted per-handler, not device-wide. |
response* | object | — | — | Status-only result — set_wifi echoes no configuration and no credentials. |
code*, nesting level 2 | integer | 0–101 | 0 | 0 = Success; non-zero = error. Required by the contract. See Response Codes below. |
description*, nesting level 2 | string | — | Success | Human-readable status. |
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.
| Code | Description |
|---|---|
0 | Success — the profile was created or modified. |
2 | Invalid payload (IOT_ERROR_INVALID_PAYLOAD) — the JSON is malformed or has invalid field values. Validate against the schema and correct. |
15 | WIFI 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. |
17 | WIFI Error - SSID missed (IOT_ERROR_SSID_MISSED) — the required essid field is missing from the payload. |
18 | WIFI 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. |
19 | WIFI Error - SSID count overflow (IOT_ERROR_SSID_LIMIT_OVERFLOW) — the saved-profile limit is reached. Delete an unused profile with delete_wifi_profile. |
20 | Wifi is not supported (IOT_ERROR_WIFI_INTER_NOT_SUPPORTED) — the device has no Wi-Fi interface; use Ethernet. |
23 | Invalid enum value (IOT_ERROR_INVALID_ENUM) — a field (e.g. operation, securityType, authentication) is outside its allowed set. |
101 | Default 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
MODIFYthat needs onlyoperationplusaccessPoint.{isPreferred, essid}. - Create WPA2 enterprise TLS / TTLS / PEAP and Create WPA3 enterprise TLS / TTLS / PEAP — installed certificates referenced as
{key, value}, an EAPauthenticationmethod and aprotocol; the TTLS and PEAP variants addinnerAuthentication.
Notes and Caveats
connect: true can sever the control sessionaccessPoint.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