Getting the register catalog
all_registers is not pushed automatically. Ask for it:
// → always by device. There is no "model" form.
{"type": "get_registers", "deviceKey": "7c9e6679-7425-40de-944b-e07fc1f90ae7"}
The request names a device, never a model. The server resolves which
model that device is — from the telemetry it is already relaying if the
device is being watched, otherwise from the devices table — so a client
can never pair a device with a catalog that merely looks like the right
one. It also means the catalog is available whether or not anyone is
watching the device, and immediately after watch_ack rather than only
once the first telemetry message has arrived.
:::warning Breaking change
get_registers no longer accepts model. A client still sending
{"type": "get_registers", "model": "..."} is refused with
get_registers requires deviceKey — unknown JSON fields are ignored, so
the request arrives naming no device at all. Send deviceKey instead.
The reply still carries model; it is simply no longer something you may
ask by.
:::
// ← server replies (a model with UI groups — see "Grouped replies" below)
{"type": "all_registers", "deviceKey": "...", "ok": true, "model": "Yorker",
"access": "writable", "registersVersion": "3f9a1c4e2b7d0a55",
"registers": [
{"group": "Battery Set", "children": [ /* register entries */ ]},
{"group": "Grid Set", "children": [ /* ... */ ]}
]}
Grouped replies
The shape of registers depends on the model. For a model that has a
server-side UI grouping — currently Nexus, IP20
2KW/6.5KW/12KW and, since 2026-11-23, IP20 3K6/5K — registers is an
array of {"group": string, "children": [register entries]}. For a model
without one (none today) it is a flat array of register entries. Every other field of the
reply, and every field on each register entry, is identical either way.
Detect the shape per reply (an element with a children array is a group)
rather than hard-coding it per model.
| Model | Groups, in the order the server sends them |
|---|---|
| Nexus | Basic Set, Advanced Set, Advanced Set 2, Battery Set, Gen Settings, Grid Set, More (writable entries privileged only), System set |
| Yorker | Battery Set, Dual output Set, Grid Set, Inverter Set, Load Set, System Set, More (writable entries privileged only) |
| IP20 3K6/5K | Battery Set, Dual output Set, Grid Set, Inverter Set, Load Set, System Set, More (writable entries privileged only) |
- Group names are display strings, sent verbatim (including their
inconsistent capitalisation and the double space in
Dual output Set). Render them as-is; don't match on them in code. - Groups keep the server's order; registers inside a group keep the catalog's order.
- A register the grouping doesn't name lands in
More(each model's fallback group) — including read-only registers when you ask for"access": "all"or"readable". Nothing is dropped, except that on every grouped model the writable registers inMoreare for a Crown Super Admin or Admin only (see Privileged settings); its read-only registers stay visible to everyone. - A group left with no members after filtering (
access,registers) is omitted, not sent with an emptychildren. - The group is unrelated to each entry's own
categoryfield (control/config/alarm/telemetry, from the vendor spec). The group is what the Activity Trail shows as an entry'scategory.
The access filter
get_registers returns only the writable registers by default — access
RW or W, everything a write request may legally target. That is what
a control or settings screen needs, and it is well under half the payload.
access | Returns | Nexus, privileged | Nexus, anyone else | Yorker, privileged | Yorker, anyone else |
|---|---|---|---|---|---|
omitted, or "writable" | access RW or W | 133, ~37 KB | 96, ~27 KB | 126, ~53 KB | 40, ~23 KB |
"all" | the whole catalog | 313, ~81 KB | 276, ~71 KB | 516, ~166 KB | 430, ~136 KB |
"readable" | access R or RW | 222, ~57 KB | 222, ~57 KB | 498, ~160 KB | 412, ~130 KB |
The counts differ by caller because of the privileged
filter, which removes the writable More registers
(37 on the Nexus, all W; 86 on the Yorker, which include RW ones and so
also leave the readable slice) and Nexus work_mode option 1 for anyone
but a Crown Super Admin or Admin. Read-only registers are never filtered.
Sizes are the uncompressed registers array as of 2026-11-05.
// the read-only registers too — for a register browser or a diagnostic export
{"type": "get_registers", "deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301", "access": "all"}
The value is case-insensitive, and the raw spec codes work as aliases
("rw"/"w" → writable, "r" → readable). An unrecognised value is
rejected with ok: false rather than quietly falling back to the full
catalog — a control screen must never be handed read-only registers it
would then offer the user as writable.
A register whose access the vendor spec never recorded (18 of the IP20
2KW/6.5KW/12KW profile's 530 entries) appears in neither filtered
slice, only in "all": its access is unknown, not readable and not
writable.
A model with nothing matching the filter replies ok: true with no
registers field at all (the server omits empty arrays) — "this model
exposes nothing writable" is a real answer, not a failure. Treat a missing
registers on ok: true as an empty list.
What each register carries
Every entry has name, address, dataType, length, scale, access,
functionCode and displayLabel; addressHex, description, unit and
category are present when the vendor spec records them. access is "R",
"W", "RW" — or "" for the few registers whose access the spec never
recorded.
All text fields (description, lowLimit/highLimit, options[].label)
are English-only, so you can render them as-is. The vendor sheets are
bilingual; the server drops the Chinese half, and
TestGetRegisters_CatalogCarriesNoChineseText fails if Chinese text comes
back. Before 2026-10-08 most Aotai descriptions read "直流电压1 | DC Voltage 1", and some IP20 2KW dropdown labels were Chinese (e.g.
bms_protocol_selection). If you strip that client-side, the workaround is
no longer needed. registersVersion changed with this fix, so cached
catalogs refetch.
Where the vendor documentation could be parsed, an entry additionally carries:
| Field | Meaning |
|---|---|
min / max | Inclusive bounds, copied from the vendor text without unit conversion (for a codec register or a datetime setting such as set_rtc_time, 20110101000000–20991231235959, they are the bounds of the value you send). Present only for free numeric settings. For most scaled registers they are in the displayed unit (Aotai voltage_protection_smartload, scale 0.1 V, is 40–60, meaning 40–60 V), and for a few they are raw. The server does not enforce the model's general bounds on write; it does enforce per-device limits (since 2026-11-10). See Settings reference for every register's bounds and how to treat them. |
options | The discrete values this register accepts: [{"value": 0, "label": "OFF"}, {"value": 1, "label": "ON", "default": true}]. Populate a dropdown from this. When min/max are present too, the options are special values outside that range, such as {"value": 65521, "label": "OFF (dual output off)"} beside a 5–900 minute range. Render a number input plus a choice for each option. |
fixed | true when this device does not let the setting change in its current configuration (a lead-acid battery's voltage points on a 6KU, say). Show the value read-only. Set only by per-device limits (see limitsVariant below). |
fixedReason | Why fixed is set, in words to show beside the read-only value: "fixed for lead-acid and flooded batteries; set Battery Type to lithium or custom to adjust it". Absent when the limit table gives none. Added 2026-11-10. |
multiple | true marks a bitmask register (a weekday schedule, say): the options are individually settable bits combined with OR, so render checkboxes, not a dropdown. |
lowLimit / highLimit | The raw vendor text the above was derived from. |
selfClearing | true for a one-shot command register the inverter resets to its idle value once the command starts (Nexus restore_factory_settings reads 0 after a reset). Its value is that idle state, not a setting: pre-select the option marked default rather than the one matching value, and expect no applied in its write_result. Absent otherwise. Added 2026-11-17 (cse-mobile issue #117). |
codec | Present when the value is not raw × scale, so format the number by it. "hhmm": a time of day, hour × 100 + minute (1800 is 18:00, 2359 is 23:59; min 0, max 2359, no options). Aotai start_time_1…6, end_time_1…6, and since 2026-11-11 charging_start_time, charging_end_time, discharging_start_time, discharging_end_time. "pf_aotai": a power factor, -1…-0.8 or 0.8…1 (min -1, max 1, scale 0.01). Aotai power_factor_regulation. value, write and read-back all use this form; the server does the vendor encoding, and write refuses a value the codec can't encode. Added 2026-11-05. |
scaleRule | Present when the device chooses this register's scale at run time: {"register": 90, "bit": 1, "scaleIfClear": 0.001, "scaleIfSet": 0.01}, i.e. 0.001 when bit 1 of register 90 is 0 and 0.01 when it is 1. scale is then only the bit = 0 default. The server reads the selector from the device and applies the right scale to every value, read_registers reply and write, and refuses a write it cannot scale with certainty. Don't do your own value / scale math for these registers; let the server validate. Aotai has 66 such registers (all kW/kVar power fields, battery_voltage, and the matching setpoints). |
{"address": 1147, "name": "work_mode", "dataType": "U16", "scale": 1,
"access": "RW", "category": "control", "displayLabel": "Work Mode",
"options": [{"value": 0, "label": "Anti-reflux to grid"},
{"value": 1, "label": "Anti-reflux to Meter"},
{"value": 2, "label": "Anti-reflux to CT"},
{"value": 3, "label": "Selling First"}]}
So the rule for rendering an input is: fixed → read-only;
options with min/max → bounded number input plus the options as
extra choices; options alone → dropdown (or checkboxes if multiple);
min/max alone → bounded number input; otherwise a free input, showing
lowLimit/highLimit as help text.
Per-device limits (limitsVariant)
Some settings have different valid ranges on different hardware of the same
model. For an Yorker device, get_registers reads the device's
model code (register 57) and battery type, and for a model with its own
limit table it replaces min/max/options/fixed on the affected
registers. The reply then carries "limitsVariant": "6KU" (the Yorker 5 kW 48 V,
6 kW and 6.5 kW all report this code), "5KU" (Yorker 5 kW 24 V, code 0x20) or "2KU" (Yorker 2 kW) and a registersVersion of its own, since
those limits belong to this device rather than to the model. Per-device
bounds are always in the displayed unit (volts, amps). The values are in
the Settings reference.
Some limits also depend on other settings' current values, which the
server reads in the same round trip: on a 6KU, 5KU or 2KU the Dual Output Cutoff
Voltage's max is the lower of the device's current constant voltage point and
its dual output enable voltage (16732, read but never listed), and its min
the device's current battery low voltage point; Switch to Battery SOC's min is
the current Switch to Grid SOC and Switch to Grid SOC's max the current Switch
to Battery SOC. A source setting that reads OFF (65521) sets no bound.
Since 2026-11-23 the IP20 3K6/5K does too: the server reads its battery
system (battery_system_voltage, from the F query) and the reply carries
"limitsVariant": "12V", "24V" or "48V", with that system's battery
voltage limits, plus the SOC and mains voltage limits every system shares
(see the Settings
reference).
Since 2026-11-11 the Nexus works the same way: the server reads its model
code (register 32), and the reply carries "limitsVariant": "1ph" or
"3ph". Some limits apply to every device of a model but depend on a
setting: the Yorker's grid voltage points follow its input mode
(operating_mode), and the Nexus's grid frequency limits follow
grid_frequency. A device whose model code matches no variant still gets
these, with "limitsVariant": "common". The full list is in Limits that
depend on other settings.
Settings a variant's firmware doesn't have are left out. On a 6KU (Yorker
5 kW and 6 kW) the reply has no entry for 37 settings the 2 kW has, because
the 6KU firmware refuses even to read them (exception 04, checked one
register at a time on the bench 6 kW, 2026-11-12 and 13):
- charge-priority and timed-output time slots 1–3 (start/end hour and minute)
battery_feed_in,disable_grid_charging_when_battery_feed_in_enabledenable_ct_not_connected_detection,ct_power_compensation,anti_backflow_anti_reverse_current,grid_side_monitoring_typebattery_not_connected_detection_enable,execute_not_connected_detection_immediately,low_soc_state_of_charge_alarm_soc_state_of_charge_settingwi_fi_ssid,wi_fi_password,sync_wi_fi_account_passwordclear_energy_statistics_data
Build the screen from the reply's registers, not from a fixed list, so these
rows don't appear empty. A write to one of them comes back ok: false,
saying this inverter model doesn't have the setting, and nothing is sent.
A device that can't be read (offline) gets the model's limits and no
limitsVariant. Changing battery_type, constant_voltage_point,
operating_mode or grid_frequency changes these limits, so fetch the
catalog again after writing one of them.
The server enforces a variant's own limits on write (since 2026-11-10): a
write to a fixed setting, or outside the device's min/max and not one
of its options, comes back ok: false with an error that says why,
and nothing is sent to the inverter. That covers the 6KU and 2KU tables and the
Nexus 1ph/3ph grid voltage limits. The model-wide limits that apply to
every device (the "common" ones) are not checked on write; the
inverter decides. See Writing to a
device.
:::caution Don't reuse a reply that carries limitsVariant
Such a reply belongs to one device as it is configured right now: its
battery type can also change at the inverter's own screen. Don't cache it
by model (or profile) + registersVersion or reuse it for another device. Request
get_registers each time the settings screen opens for that device. Its
registersVersion won't match the one in watch_ack, and that's
expected. The caching rule below
still applies to replies without limitsVariant.
The server reads the device for this only when the reply contains a
setting that has per-device limits, so a "readable" request or a
registers subset of other settings costs no extra round trip.
:::
displayLabel: one label per concept, across models
name is the register identifier you write and read_registers by, and
it is never the same across models for the same real-world setting —
the IP20 calls its battery-low-voltage cutoff battery_low_voltage_point;
the Aotai calls the same concept discharge_cut_off_voltage, at a
different address, with a different scale. displayLabel is a
server-resolved, human-readable string for exactly that: build one
settings screen from displayLabel, and never branch UI code on which
model — or which register name — is connected.
{"name": "battery_low_voltage_point", "value": 47.6, "displayLabel": "Battery Low Voltage"} // IP20
{"name": "discharge_cut_off_voltage", "value": 47.0, "displayLabel": "Battery Low Voltage"} // Aotai
Both entries render the same label; name (what you write to) stays
distinct and untouched either way.
Resolution is per model, from a small curated list built off the
CSE_UI_REGISTER_BACKEND_AUDIT.md field-by-field cross-reference (which
register names on which models are actually the same concept, address for
address — never assumed from similar-looking names alone). A register with
no curated label — a brand-new register the audit hasn't covered yet,
an unrecognised model, or a register deliberately left uncurated because
the evidence for a shared concept was inconclusive (e.g. the Aotai's
beep, which the audit could not confirm is the same control as the
IP20's Buzzer Mute — it never appears on the Aotai's own screen) — still
gets a displayLabel, just a mechanical humanization of its own name
(soc_set_1 → "SOC Set 1", with a handful of known acronyms such as
SOC, BMS, CT and PV uppercased), never a guessed shared one.
displayLabel is never absent and never empty. You can render it
unconditionally, with no per-model fallback logic of your own, and no need
to know which model a device is beforehand — that knowledge stays
server-side.
:::note Presentation only
displayLabel never changes name, value, scale, or any other field —
it is additive metadata, safe to ignore entirely if you don't need it. It
is also unrelated to the flat telemetry object's canonical fields (see
The telemetry record shape): this only
labels entries in the register catalog, and only for display.
:::
:::caution Coverage is partial, by design
These fields are parsed from prose transcribed out of vendor PDFs, in mixed
Chinese and English, in a different shape per spec. Where the text can't be
read confidently, min/max/options are absent rather than guessed —
a wrong bound silently pushes a bad write to real hardware. Current
coverage of writable registers in the per-model catalog: Nexus 126/133
(privileged view), Yorker (IP20 2KW/6.5KW/12KW) 73/126, IP20 3K6/5K
51/61 (the other ten are its nine battery voltage points, whose range
comes per device, and restore_factory_defaults, a command). Since 2026-11-11 the
catalog also carries ranges the vendor text states in a shape the parser
can't read, taken from a reviewed table in the spec file
(limit_variants.common). Ranges that depend on the device come per device
(see Per-device limits). With those, an
online Yorker 5 kW or 6 kW has a range, options or fixed on every setting
a device owner sees, and so does the Nexus. Always handle the absent case by falling back to
lowLimit/highLimit. The Settings reference
lists every writable register's title, unit, scale, bounds and options.
Two specific traps this avoids. In the IP20 2KW spec, low_limit and
high_limit are not a register's minimum and maximum — they are the same
setting documented for a 48 V and a 24 V hardware variant; where the two
disagree, no min/max is emitted. And Aotai's max_sell_power
documents a conditional scale rule ("bit1==0, the power ratio is 0.001")
in the same notation a bitmask uses — read literally that produced a
nonsense two-entry dropdown on what is really a free numeric input, so
bit-style lines whose label is a number are ignored.
:::
Privileged settings
Since 2026-11-05 (cse-mobile issue #98) some settings are shown and
writable only to a privileged caller: a Super Admin or an Admin of the
Crown platform org, i.e. a realtime ticket carrying the top-level claim
"sa": true or "pa": true (issued by the HTTP backend; see
Authentication). A ticketless
device-owner connection is never privileged.
| What | Models | For anyone else |
|---|---|---|
The writable registers of the More group (access W or RW) | Nexus, Yorker and IP20 3K6/5K | Left out of get_registers. A write to one of them is refused: settings in "More" can only be changed by a Crown Super Admin or Admin. Read-only registers that fall into More (under "all"/"readable") stay visible to everyone. |
work_mode option 1 (Anti-reflux to Meter) | Nexus | The option is left out of options. write of work_mode = 1 is refused: this option can only be chosen by a Crown Super Admin or Admin. |
The web console's send_command with kind: write_register applies the
same rule (see Commands). Refused writes are
audited as denied with denied_level SUPER_ADMIN. When
anything was left out for the caller, registersVersion is computed over
what that caller actually got, so a privileged caller's catalog and anyone
else's never share a version. Cache by the version in the reply, as below.
grid_frequency_setting (1165) is left out for everyone: it is the raw
numeric name for the address that Grid Set's grid_frequency (5000 =
50 Hz, 6000 = 60 Hz) presents better. Writing it by name still works.
One entry per name
The catalog carries one register per name, because that is how you
address one: write and read_registers both take a register name, not
an address.
Where a vendor spec documents the same name twice — Aotai's
"参数设置" and "参数设置new" sheets both cover the same addresses, giving
314 catalog entries out of 399 raw spec rows — the reply carries the
read-write (RW) definition when there is one, then a read-only one,
then a write-only one. That is the definition a write naming the
register resolves to, and the one read_registers reads, so what you
render, what you read and what the device is told always come from the
same definition.
On the Yorker this matters for settings the vendor documents
twice: once as a read-only status copy and once as the read-write setting
(battery_type at 336 and 16647, charging_priority, output_priority,
max_charging_current and nine others). The catalog lists the setting.
Rows the vendor marks reserved, or deleted, are not listed at all.
read_registers follows the same rule, so for these names it now returns
the setting rather than the status or measurement row it returned before
28 Oct 2026. Live values are unchanged in telemetry, which is keyed the
same way as before.
| Model | Name | read_registers now reads | Before |
|---|---|---|---|
| IP20 | battery_type, output_priority, charging_priority, operating_mode, parallel_mode, equalization_charge_time | the WF_UserSet setting | its read-only status copy |
| IP20 | max_charging_current, max_discharging_current | the setting's option code (16646, 16706) | the BMS limit in amps (411, 412) |
| IP20 | year, month, day, hour, minute | the clock-set registers (16693–16697) | the inverter's clock (864–868) |
| Aotai | grid_frequency | the 50/60 Hz setting (1165: 5000/6000) | the measured grid frequency (24) |
If a screen needs the measured value, read it from the telemetry record.
:::danger Two Aotai sheets disagree about energy_mode
At address 0x490, the older sheet records 0 = Batt First, 1 = Load First; the newer one records the reverse. Both describe the same
physical register, so one of them is simply wrong, and the vendor
documentation gives no way to tell which.
The catalog and the write path now agree with each other (both use the
newer RW definition: 1 = Batt First, 0 = Load First), so a user's
choice is at least sent as labelled. But if the newer sheet is the wrong
one, that label is inverted against the hardware. Verify against a real
inverter before exposing this control, and treat any other Aotai register
with two conflicting sheets the same way.
:::
Current values in the same call
Add includeValues: true with a deviceKey and each entry also carries
its live value, saving the separate read_registers round trip:
{"type": "get_registers", "deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301", "includeValues": true}
{"type": "all_registers", "deviceKey": "...", "ok": true, "model": "Nexus",
"access": "writable", "registersVersion": "…",
"registers": [{"group": "System set", "children": [
{"name": "work_mode", "dataType": "U16", "value": 3,
"displayLabel": "Work Mode", "options": [ /* ... */ ]}]}]}
value is in engineering units (scale already applied), the same units
write takes and read_registers returns. A text or date/time register (see Text
registers) carries text instead of value here,
e.g. {"name": "time", "dataType": "datetime", "text": "2026-09-29T13:22:10"}. Before
2026-09-30 it showed a misleading value: 0. A codec hhmm register
carries both: "value": 1800, "text": "18:00".
Add registers (with or without includeValues) to narrow the reply to the
named entries only, in the catalog's own order, not yours. Names that aren't
in the catalog, or don't match the access filter, are dropped silently.
{"type": "get_registers", "deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"registers": ["work_mode", "solar_sell", "charging_power"],
"includeValues": true}
Only the registers in the reply are read from the device. The access
filter is applied to the catalog first, and just those names are sent on to
be read — asking for writable does not read the whole device and discard
the rest.
Limits. The device read is chunked into batches of 64
(MaxRegistersPerReadRequest, which sizes one round trip so a read can't
monopolise the device's polling loop), with a ceiling of 192 registers
per request. The Aotai writable catalog (135) is three chunks, measured
end to end at ~2.5 s against the bench inverter, with its 30 s heartbeat
interval undisturbed. Above the ceiling — an "access": "all" catalog,
say — the catalog still returns, with valuesError explaining how to
narrow it.
Prefer narrowing anyway when you can. Each chunk is a real round trip over the device's WiFi-to-serial bridge, shared with its telemetry polling, and on a slower link than the bench one those seconds add up.
:::note What actually goes over the wire Modbus reads contiguous address spans, not individual registers, so the requested names are coalesced into the fewest spans that cover them. The 135 Aotai writable registers become 5 round trips covering 226 raw register addresses — more than 135, because a span also carries the read-only registers that happen to sit between two requested ones. Those in-between values are decoded and discarded; only the registers you asked for appear in the reply. :::
If the device drops partway through a chunked read, the values already
collected are kept and valuesError says how many of how many arrived —
a partly populated screen beats an empty one.
valuesError (with ok: true and a complete catalog) is also how an
offline device is reported. The catalog is the part you can't proceed
without, so it is never withheld because a read failed. A register that
fails individually — an illegal-address exception on a firmware revision
that doesn't implement it — simply has no value.
One group at a time
Add group to get one setting group only, for a screen that shows one
group. With includeValues, only that group's registers are read from the
device, so a group screen doesn't pay for reading every setting:
{"type": "get_registers", "deviceKey": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"group": "Grid Set", "includeValues": true}
The name must match a group exactly as the reply spells it ("System set",
not "System Set", on the Nexus). An unknown name is refused with ok: false and unknown group "…"; valid groups are [...], listing the model's
groups. A model without groups (none today) is refused with model … has no setting groups. "group": "More" from anyone but a privileged caller returns only
More's read-only registers, so with the default "writable" filter it
replies ok: true with no registers. group combines
with access and registers: the group is applied first.
A subset reply (registers or group) carries no registersVersion:
it isn't the catalog, and must not be cached as though it were.
Cache it, keyed by model + access + registersVersion, and reuse it
indefinitely. Use profile in place of model when the reply carries
one: the Yorker 3.6 kW shows model: "Yorker" like the 2–12 kW Yorkers but
has its own catalog, profile: "IP20 3K6/5K" (see Shown as
"Yorker"). The catalog is static: it comes from protocol data compiled
into the server binary, so it only changes when the backend is redeployed
with a changed spec. watch_ack tells you the current model and
registersVersion on every watch — request a new catalog only when that
version differs from the one you hold. Done properly this is one download
per model per deploy, not one per session.
Each access slice carries its own registersVersion, and the reply
echoes back the access it used — so include both in your cache key. The
registersVersion in watch_ack is always the full catalog's; if you only
ever fetch "writable", treat a change there as "re-request and compare",
since a deploy touching only read-only registers leaves your writable
catalog valid. watch_ack carries no registersVersion until the gateway
has relayed one telemetry record for the device; in that case just request
the catalog — get_registers resolves the model from the devices table
and does not need telemetry.
Why it isn't pushed: it's large — tens of KB for a writable slice and
far more for a full catalog (the Yorker profile has 530
entries), against ~11 KB for a telemetry record — identical for every
device of that model, and most sessions never need it (a live dashboard
needs telemetry; the catalog is for control/settings screens). Pushing it
on every watch re-sent hundreds of KB of unchanged data on every page
refresh. The connection negotiates permessage-deflate (browsers do this
automatically), which shrinks it considerably on the wire.
Failures are explicit rather than an empty list, so an error can never be cached as "this device has no registers":
{"type": "all_registers", "deviceKey": "...", "ok": false,
"error": "this device has not reported its model yet; it must connect once before its register catalog is known"}
error | Meaning |
|---|---|
get_registers requires deviceKey | No deviceKey (including an old client still sending model). |
unknown access filter "…"; … | access isn't one of the values above. |
unknown group "…"; valid groups are […] | group isn't one of this model's groups. |
model … has no setting groups | group sent for a model with a flat catalog. |
no such device; register it from the app first | No devices row for this logger. |
this device has not reported its model yet; … | Registered, but it has never connected, so its model is unknown. |
could not look up this device's model, try again | Database lookup failed. |
no register catalog is loaded for model … | The device reported a model this build has no profile for. |
a get_registers request is already in progress on this connection; … | See below. |
One get_registers may be in flight per connection; a second while the
first is still running is rejected with ok: false rather than queued.
Stop receiving updates for a device you no longer need:
{"type": "unwatch", "deviceKey": "7c9e6679-7425-40de-944b-e07fc1f90ae7"}
You do not have to send unwatch before disconnecting. Closing the
WebSocket — a page refresh, a tab close, a network drop, a killed app —
implicitly unwatches everything that connection was watching, and
reconnecting and re-watching works identically whether or not unwatch
was ever sent. Send it when you want to stop watching a device but keep the
connection open; don't rely on it firing during page unload, because
browsers don't guarantee it will.
A device doesn't actually revert to its slow default cadence the instant
its last watcher leaves. ws-gateway holds a short grace period (a few
seconds) before reverting cadence and dropping its per-device caches —
specifically so a browser refresh doesn't churn the device's subscriptions
and cadence for no reason. Re-watching within that window is cheaper (no
resubscribe), but you get the same messages in the same order either way.