Skip to main content

What deviceKey actually is

deviceKey is the device's id: a UUID the backend generates when the device is first registered (devices.id), for example 3f2504e0-4f89-41d3-9a0c-0305e82c3301. You get it from register_result and get_devices, and every device-addressed request names the device by it: watch, write, get_registers, update_device, delete_device, get_activity, get_alerts, get_analytics, get_param_history and the rest.

It never changes. Not across reconnects, restarts or network blips — and not when the device's logger is replaced: a completed logger swap (update_device) changes the device's loggerId, never its deviceKey, so the app keeps watching, writing to and charting the same device, with all of its history. It is safe to cache once you have it.

deviceKey is not the logger ID. The logger ID is the label printed on the WiFi logger's QR code. It is what register takes (as loggerId), and device messages also carry it as loggerId for display — but it identifies a piece of hardware, and a device can have several loggers over its life. A logger ID sent as deviceKey is refused (INVALID_REQUEST, or DEVICE_NOT_FOUND on watch) with a message saying to send the device id instead.

deviceKeyloggerId
What it isThe device (one inverter)The WiFi logger fitted to it now
FormatUUID, lowercaseThe QR label, e.g. i30000252761006466
Generated byThe backend, at registrationThe hardware maker
Changes whenNeverA logger swap completes
Use it toAddress every request; key your client stateShow which logger the device has; register

:::info Changed in the device-id release Before this release deviceKey was the logger ID the device was registered with, and get_devices showed the fitted logger separately as currentLoggerId. Both are gone: deviceKey is the device UUID, and loggerId is always the logger fitted now. A client from before this release must be updated together with it. :::

Where the device comes from. The hardware reports its own logger ID: tcpserver asks it with AT+DTUPN? on connect, and it answers with the same value printed on its QR label. Your register message tells the backend who owns that logger, and the backend creates the device and its id. The device and the app never talk to each other: they each tell the server, and the server matches the two. See Server behavior's connect flow for the full resolution order, including the cases where a connection is refused.

A connection whose logger nobody registered is not visible to clients at all. It has no device, so it has no deviceKey: tcpserver keys it internally on its IP:port, holds it open with heartbeats only, and never polls it — so it publishes no telemetry and no presence. Register it first.

Identifiers are normalised​

Before anything is looked up, the gateway normalises the identifiers you send:

  1. Surrounding whitespace is trimmed from deviceKey, loggerId, inverterSn, userId, plantId, activityId and confirmToken — a padded value could otherwise only ever fail, as a misleading no such device. Send them verbatim anyway: the gateway logs a warning once per connection when it has to trim. (cursor is deliberately not trimmed.)
  2. Identifiers are put into one canonical case: deviceKey and loggerId lowercase (a UUID is printed lowercase), inverterSn and plantId uppercase (a plantId of all is a keyword and stays all). Either spelling of a logger label works — I30000252761006466 and i30000252761006466 are the same logger. userId is not case-converted (ownership checks compare it case-insensitively anyway).

Every reply that echoes a device identifier — watch_ack, telemetry, presence, write_result, register_result, update_device_result, all_registers, the delete messages — carries the canonical spelling, and so does every reply that echoes a plantId (register_result, devices, the delete messages): it comes back uppercase. Key your client-side state on the deviceKey and plantId the server sends back, not on what you sent.