Skip to main content

Updating a device: update_device

One request changes an existing device. You send the device as your screen currently shows it, plus a changes object naming only the fields to change:

// → client: move a device to another of the user's plants
{"type": "update_device",
"deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"userId": "17833b2e-a851-4a17-a764-62524d667959",
"plantId": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"changes": {"plantId": "01JZYXWVTSRQPNMKJHGFEDCBA9"}}
// ← server
{"type": "update_device_result", "ok": true,
"deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"plantId": "01JZYXWVTSRQPNMKJHGFEDCBA9",
"loggerId": "i30000252760985713",
"changes": {"plantId": {"status": "applied",
"from": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"to": "01JZYXWVTSRQPNMKJHGFEDCBA9"}}}
FieldMeaning
deviceKeyThe device's id, as get_devices returned it (not its logger ID). Required.
userIdThe device's owner. Required: only the owner can update a device.
plantIdThe plant the device is in now, as your screen shows it. Required, and must be one plant, not "all".
changesThe fields to change and their new values. At least one.
parallelOptional boolean, default false, with changes.plantId only. Confirms the device is wired in parallel with the inverter already in the target plant — see Moving a device to another plant.

Supported changes:

changes keyValueEffect
plantIdAnother plant's id (string)Moves the device to that plant. Applied immediately.
loggerIdA logger ID (string, from the new logger's QR label)Replaces the device's logger. Applied when the new logger connects — see Changing the logger.
ratedPowerKwThe inverter's nameplate rating in kW (number), or null to clear itSets the rating the app shows and plant totals add up. Applied immediately — see Setting the rated power.

Any of them can be sent in one request.

The reply​

update_device_result always carries the device as it is after the request: deviceKey and plantId are the values to key your UI on from now on. On success it also carries loggerId, the logger fitted to the device now, and pendingLoggerId while a logger swap is waiting (both as in get_devices). deviceKey never changes, not even when the logger does; loggerId changes only when a swap completes, never in this reply (a swap is only ever pending here). Each change has its own entry in changes:

statusMeaning
appliedThe change was made by this request.
unchangedThe device already had this value. Nothing was written. This is what a retry gets after a reply was lost, so retrying is always safe.
pendingloggerId only: the new logger is recorded and the swap happens when it connects. Also what a retry of the same request gets.
cancelledloggerId only: you sent the device's current logger while a swap was pending, which cancels that swap.

On failure, ok is false and there is a code to branch on and an error to log:

codeMeaning
INVALID_REQUESTA required field is missing or malformed (including a deviceKey that is a logger ID rather than the device's id), changes is empty, "all" was used as a plant, or a change names the value the device already has according to your own request.
UNSUPPORTED_CHANGEchanges names a field this server does not support yet. Nothing was changed, including the supported fields in the same request: an update is applied completely or not at all.
DEVICE_NOT_FOUNDNo such device, or userId does not own it. The two are deliberately indistinguishable.
STALE_DEVICEThe device is no longer in the plantId you sent (checked for every change, including a logger-only one): it was moved from another screen or phone. Refresh the device list and ask the user again.
DEVICE_REVOKEDThe device has been taken out of service, or is being deleted.
LOGGER_IN_USEloggerId is already the logger of another device, or another device is already waiting for it.
RATED_POWER_NOT_ALLOWEDratedPowerKw is not one of the device's model's ratings (ratedPowersKw in get_modbus_specs), or the model reports its own rating and takes none (Nexus). Nothing was changed.
MODEL_UNKNOWNratedPowerKw was sent for a device that has never connected, so its model, and with it the allowed ratings, is not known yet. Let it connect once first. Clearing (null) is always allowed.
INVERTER_UNKNOWNloggerId was sent for a device whose inverter serial the hardware has never reported (snVerification is not "verified" in get_devices): it has not connected since registration, its serial was only typed in from the label, or its inverter reports no serial of its own (the IP20 3K6/5K's factory placeholder). The new logger could never be checked against it. Let the device connect once first; a device whose inverter reports no serial cannot change logger — delete and re-register it instead.
PLANT_FULLA plant move into a plant that already has the most inverters a plant may have (GROUP_MAX_INVERTERS, default 50 — see Parallel inverters). Nothing was changed.
PLANT_NOT_BINDABLEA plant move into a plant that is archived (or being deleted) on the HTTP Server. Nothing was changed.
PARALLEL_CONFIRMATION_REQUIREDA plant move into a plant that already has an inverter, without parallel: true. Comes with inverter and plantInverters. Ask "parallel, or a separate plant?" and resend with parallel: true only for parallel. Nothing was changed.
PARALLEL_NOT_SUPPORTEDparallel: true, but this device or one in the target plant is not a Nexus. Only Nexus inverters can share a plant. Nothing was changed.
PARALLEL_SPEC_UNKNOWNparallel: true, but this device's or a target plant inverter's model or model code is not known yet (never polled). Nothing was changed.
PARALLEL_SPEC_MISMATCHparallel: true, but the model codes or rated kW differ: parallel units must be identical. Nothing was changed.
NOT_AUTHORIZEDA plant move into a plant of another Business: the device's current plant and the new one are operated by different Businesses. Nothing was changed. A device moves between Businesses only by a transfer from the web console.
UPDATE_FAILEDA server-side failure. Safe to retry.

One update_device can be in flight per connection; a second one sent before the first is answered gets INVALID_REQUEST with an already in progress error.

Moving a device to another plant​

Build the "Move to another plant" picker from the user's own plants, from the HTTP server's owned-plants API, leaving out the plant the device is in now. This server does not check that the user is a member of the plant: plants live in the HTTP server, and the TCP server only checks that userId owns the device. Offering only the user's own plants is the app's responsibility.

The target plant's inverters are checked, exactly as on register (owner decision 2026-11-23). A plant with no inverter takes the device. A plant that already has one takes it only when the request sends top-level "parallel": true, and only when both are Nexus inverters with the same model code and rated kW; otherwise the move is refused with a PARALLEL_* code and nothing changes. The refusal carries inverter (this device) and plantInverters (the target plant's inverters), each with optional model, modelCode and ratedPowerKw and never a deviceKey:

{"type": "update_device", "deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"userId": "17833b2e-a851-4a17-a764-62524d667959",
"plantId": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"changes": {"plantId": "01JZYXWVTSRQPNMKJHGFEDCBA9"}, "parallel": true}

One check does apply: a move stays inside the device's Business. A plant operated by another Business is refused with NOT_AUTHORIZED. The server can only check this when it has a record of both plants; a move between plants it has no record of is not refused.

What moves with the device:

  • Its history and analytics. Telemetry, energy history and Analytics are stored per device, so the device's whole history shows under the new plant from now on, and the old plant's totals no longer include it.
  • Its open alerts. Alerts that are still active move to the new plant.
  • Its write history in the Activity Trail. A plant-filtered get_activity shows a device's register writes under the plant the device is in now.

What stays where it was:

  • Resolved alerts. Each resolved alert keeps the plant it was raised in.

What the move records — one entry on each side, with no push notification and no live alerts_changed:

WhereActivity Trail entryInfo alert
The plant the device leftkind: "device_update", title "Device moved to another plant", details.action: "moved_out"device.MOVED_OUT
The plant the device joinedkind: "device_update", title "Device added to this plant", details.action: "moved_in"device.MOVED_IN

Both entries' details carry fromPlantId and toPlantId, so the app can name the other plant. They appear the next time the app loads the Activity Trail (get_activity) or alerts (get_alerts with state: "resolved" or "all"). See Activity Trail and Device Alerts.

A live watch on the device is not interrupted by a move.

Changing the logger​

Use this when a device's WiFi logger is replaced: it failed, or is being swapped for another unit. The device stays the same device — same deviceKey, same plant, same history, alerts and Activity Trail — and only its loggerId changes. History is stored under the device's id, so nothing is moved or copied: older alerts and Activity Trail entries keep naming the logger that was fitted when they were recorded.

// → client
{"type": "update_device",
"deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"userId": "17833b2e-a851-4a17-a764-62524d667959",
"plantId": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"changes": {"loggerId": "i20000282445530581"}}
// ← server
{"type": "update_device_result", "ok": true,
"deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"plantId": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"loggerId": "i30000252760985713",
"pendingLoggerId": "i20000282445530581",
"changes": {"loggerId": {"status": "pending",
"from": "i30000252760985713",
"to": "i20000282445530581"}}}

pending is not done. The swap needs no approval, but it completes only when the new logger connects and reports this device's inverter serial. That serial is what proves the new logger is fitted to this device's inverter, so a mistyped or wrong logger ID can never take over the device.

An IP20 3K6/5K (Yorker 3.6 kW) whose factory never programmed a serial cannot change logger this way: it answers with a placeholder, which the server treats as no serial, so the request is refused with INVERTER_UNKNOWN. See IP20 3K6/5K.

The usual order:

  1. Fit the new logger to the inverter and provision it over BLE, as for a new device. (Registering it instead also works once it has dialled in: a logger plugged into an inverter that is already your device in the same plant is fitted to that device — see Reusing a logger. update_device is the explicit route.)
  2. Send update_device with changes.loggerId. If the new logger is already connected, the server tells it to reconnect, and the swap normally completes within seconds. Otherwise it completes on the logger's first connection.
  3. Poll get_devices (or wait for telemetry on the device's unchanged deviceKey, whose record now carries the new loggerId). When the device's loggerId is the new logger and pendingLoggerId is gone, the swap is done.

While the swap is pending, the device keeps working through its old logger if that one is still connected. Once the swap completes:

  • The device is served through the new logger, under the same deviceKey. A client watching it keeps receiving telemetry without re-subscribing.
  • The device's loggerId is the new logger.
  • The old logger belongs to nothing. If it connects again it is treated as an unregistered logger. It is free hardware: it can be registered as a new device (a new deviceKey, none of this device's history), or fitted to another device as that device's new logger.
  • An Activity Trail entry and an info alert device.LOGGER_REPLACED are recorded in the device's plant, with details/context {"action": "logger_replaced", "fromLoggerId", "toLoggerId"}. There is no push notification, and no device_updated push (the swap happens when the logger connects, not on a request); refresh get_devices to see it.

If the new logger connects on a different inverter, or its inverter serial cannot be read, it is refused and the swap stays pending. A pending swap that has not completed within 7 days expires: it no longer matches, and no longer reserves the logger. To cancel one sooner, send update_device with the device's current loggerId as changes.loggerId (status cancelled). To swap back to the original logger later, send its ID like any other.

Setting the rated power​

Some inverters cannot say what size they are. The Yorker 5 kW, 6 kW and 6.5 kW all report the same model code, so the server publishes no rated_power for them on its own. Set the nameplate rating from the label instead:

// → client
{"type": "update_device",
"deviceKey": "0e764536-c32f-4ec6-b663-30caccaaf4a0",
"userId": "17833b2e-a851-4a17-a764-62524d667959",
"plantId": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"changes": {"ratedPowerKw": 6.5}}
// ← server
{"type": "update_device_result", "ok": true,
"deviceKey": "0e764536-c32f-4ec6-b663-30caccaaf4a0",
"plantId": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"loggerId": "i20000283706115811",
"changes": {"ratedPowerKw": {"status": "applied", "from": "", "to": "6.5"}}}
  • Pick from a list, don't take free text. Each model's allowed ratings are in ratedPowersKw on its get_modbus_specs reply: Yorker [1.2, 2, 3, 5, 6, 6.5, 12], IP20 3K6/5K [3.6, 5]. Anything else is refused with RATED_POWER_NOT_ALLOWED, so a typo such as 65 can't inflate a plant's capacity tenfold. Nexus has no list: it reports its own rating.
  • The device must have connected once (MODEL_UNKNOWN before that): the allowed ratings depend on the model, which is recorded on the first connection. A rating can't be sent with register.
  • from and to are strings in kW ("6.5"), "" for none set.
  • Where it shows up. get_devices returns it at once as ratedPowerKw. From the device's next telemetry cycle (at most one poll interval if it is online, otherwise its next connection), rated_power in its readings carries the same value, ahead of anything decoded from registers. History (rated_power_w), plant totals (combined.rated_power) and fleet capacity all follow from that.
  • Clearing (null) goes back to whatever the registers say, which for the Yorker 5, 6 and 6.5 kW is nothing.
  • It is recorded on the Activity Trail (details.action: "rated_power_changed", with fromRatedPowerKw/toRatedPowerKw). There is no info alert and no push notification.
  • An installer can set it from the web console with set_device_rated_power.

Keeping other screens in sync​

When a request changes something (a plant move applied, a logger swap requested or cancelled, or the rated power set or cleared), the user's other connections that have subscribed to alerts (subscribe_alerts) get a device_updated push:

{"type": "device_updated",
"deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"plantId": "01JZYXWVTSRQPNMKJHGFEDCBA9",
"loggerId": "i30000252760985713",
"changes": {"plantId": {"status": "applied",
"from": "01JABCDEFGHJKMNPQRSTVWXYZ0",
"to": "01JZYXWVTSRQPNMKJHGFEDCBA9"}}}

Remove the device from the old plant's list and add it to the new one, or just refresh get_devices. A connection served by another gateway instance does not get this push; it sees the change on its next get_devices.