Skip to content

Remote commands and settings

On this page: the two ways the cloud can act on a box (signed commands and shadow settings), the rules the firmware enforces, the revision rule that makes "on site wins" work, and remote switching for switching builds. The portal side is described in Remote panel.

Principles

  • Remotely you can only read data, change a few settings and request an update.
  • Limits are compiled into the firmware. The server can only make them stricter.
  • The network, "changes from the cloud" (switching it on), output functions and calibration are only changed on site.
  • Every change is logged with old value, new value, who and the owner's consent ID, on the box and in the cloud.

Command list

Only these commands exist; the firmware refuses anything else.

Command Purpose Notes
get_diag Diagnosis Read only
get_logs Last log lines Optional lines 1 to 200 (default 50), level E, W, I, D or V (minimum level). Firmware 0.2.5 and later; the answer is at most 4096 characters, oldest lines dropped first (truncated)
busscan Scan the RS485 bus At most once per hour remotely
ota_check Fetch and install a signed update See Updates and channels
set_ph_setpoint pH target of the equipment Proposed limits 7.0 to 7.6, at most 0.2 per command
set_orp_setpoint ORP target Proposed 650 to 780 mV, at most 50 mV per command
set_ppm_setpoint Free chlorine target Proposed 0.5 to 2.0 ppm
set_production Cell production Proposed 10 to 100 %, at most 30 percentage points per command
revert_last Undo the last change
set_output Switch an output Switching build only; the read build always answers not_supported

To be confirmed

The limits of the write commands are proposals and must be fixed per setting and per brand. The read build answers not_supported to all write commands, so they have no effect today.

Rules enforced by the firmware

  1. Every command carries a command ID, a timestamp (at most 5 minutes old), the owner's consent ID and a signature of the Lutra command service (ECDSA P-256, key in AWS KMS). The box verifies it with the public key in its firmware. A repeated command is refused (replay), a tampered one is not executed.
  2. Write commands require "changes from the cloud" (remote_ok) to be on. It is switched on only on site; it can be switched off remotely.
  3. Rate limits on the box: at most 20 commands per hour in general, 40 per hour for set_output, and at most 4 changes per hour per setting.
  4. After a write the box reads the value back; a mismatch is reported as an error without a second attempt.

The API adds its own limits: at most 10 commands per box per hour, and 30 switching commands per box per hour.

Command statuses

Status Meaning
sent Published to the box
executed Done, with detail
rejected With the firmware's reason, for example not_allowed, stale, replay, signature, not_supported, limit:for_s
no_response No result within 60 seconds
failed Signing or publishing failed

Settings through the device shadow

Ordinary settings travel through the device shadow:

Setting Values Remote
interval_s 30 to 3600 seconds, default 300 Yes
remote_ok true or false Only to false
tz POSIX time zone string, for example CET-1CEST,M3.5.0,M10.5.0/3, IST-5:30, AST4; default UTC0 Yes, firmware 0.2.8 and later; the portal picks an IANA zone and the API converts it
Bus devices, network, input roles No: on site only (only on site)

The revision rule

Rule: the cloud may never change something on the box that was changed on site and that the cloud did not yet know. Settings are therefore only changed on the basis of current data.

  1. Each group of settings has a revision rev (a random start value, plus one for every change, on site or remote). The box reports it as "rev": {"cfg": N}.
  2. A wish in desired must carry "base_rev": {"cfg": N} equal to the current revision. Missing or different: the change is refused as stale and nothing is applied.
  3. A key with the same value as now is not a change and is never refused, so duplicate delivery is harmless.
  4. After every processed wish the box clears desired.
  5. A change on site clears pending wishes and raises the revision, so a wish that was still on its way becomes stale.

The API checks the same before writing: it reads the shadow fresh and refuses with 409 when the revision differs (stale), when the firmware reports no revision (no_rev; older firmware would apply a wish without checking), when the box has not reported recently (not_current: last telemetry older than 2 x interval_s + 60 s), when a wish is already pending (already_pending), or when the value is unchanged (no_change). A conflict between two portal users gives 409 conflict.

Switching outputs

set_output (switching build only):

Argument Value
fn pump, backwash, heat_enable, fill, light or aux
state on or off; for pump also 1, 2, 3
for_s Optional, 0 to 86400 seconds; omitted or 0 means the function's maximum
confirm Optional boolean; true is required to switch on pump, backwash or heat_enable
  • Off is always allowed, also without remote_ok. On requires remote_ok. fill can only be switched off.
  • The API offers switching only when the shadow reports "build": "switching" with a list of outputs.
  • ok means "request accepted"; whether the output really changes is decided by the interlocks in the next cycle and shown in reported.outputs. See Switching build.

Last reviewed: 2026-11-24. Applies to Lutra Lite 0.4.1.