ThinkLink Guides / Control & operations
Closed-loop subdevice control in ThinkLink: separating write acknowledgements from real state
Verify RS-485, M-Bus and serial subdevice control across platform acceptance, write replies, real running state, tklHelper V3 pairing and Class-aware timeouts.
When controlling a subdevice through a parent collector, end the waiting state only after a valid post-command device reply satisfies the operation's success condition. Platform acceptance, LoRaWAN ACK, protocol write replies, parameter readbacks and real running state are distinct stages; cached values, wrong-slave echoes or partial replies never confirm success.
Separate platform acceptance, write replies and live operating state
When ThinkLink controls a downstream RS-485, M-Bus or serial subdevice, the physical downlink travels through its parent collector (device.parent), whereas parameters and operating states belong to the target subdevice—never collapse child state onto the parent. An online parent collector also does not guarantee healthy serial communication with every child. Before sending a command, verify tenant, target EUI, parent collector, slave address or channel, mounted RPC and paired receiving thing model.
Parameter forms should display real observed values with their original timestamps, or a clear no-data message when empty, rather than treating form defaults as live hardware state. Neither platform acceptance nor a LoRaWAN ACK proves parameter application, and silence after timeout indicates an unconfirmed result rather than proof that the device did nothing.
What each feedback stage proves—and what it must never claim
GET readbacks, SET writes and state-changing actions (such as power or relay switching) require different completion criteria. A valid Modbus FC05/06 8-byte write echo with CRC proves only that the slave accepted the write command; for a power switch, the UI should show acknowledged-awaiting-state until a fresh, correctly typed status report (such as numeric power_switch) arrives after the command.
Similarly, an existing cached value that happens to match the target, an identical echo from a different slave address, a partial multi-parameter reply or a type mismatch (such as string "1" instead of numeric 1) must never confirm the current transaction. Stateless pulse or reset actions should report only protocol-supported stages without fabricating persistent values.
| Observed stage | What it actually proves | Required UI & model handling |
|---|---|---|
| Platform accepted / queued / LoRaWAN ACK | Request received or radio link acknowledged; business outcome unknown | Keep waiting for target subdevice protocol feedback without altering live state |
| GET parameter readback | Real current value, type, unit and observation time retrieved | Store real reading and timestamp; never display 'set succeeded' |
| Protocol write reply (Modbus FC05/06/10) | Slave accepted write command after address, function and CRC checks | Show acknowledged-awaiting-state for actions; keep telemetry_data: null |
| Post-command valid running state | Target subdevice reported matching state with exact declared type | Update target model, emit one correlated MQTT notice and end waiting |
| Timeout with no valid reply | Outcome unconfirmed (does not prove non-execution) | Mark unconfirmed; run one bounded read-only query if allowed, no blind write retry |
tklHelper V3 pairing and Class-aware timeout budgets
When adopting tklHelper V3 for bounded retries and feedback checks, migrate both the sending RPC (Utils.makeParaSetMSG with version: 3) and the receiving model (port 214 Utils.paraCheck with version: 3, or port 51 protocol filtering plus complete checkInfo) together rather than changing one side alone. Action write replies should set telemetry_data: null so attributes are never abused to fake real operating state. Because process_data slots are not atomic locks or durable ledgers, run commands sequentially on the same control slot instead of overlapping independent commands.
Size response budgets around device Class and bus latency: 10 seconds (10000 ms) is a practical starting point for RS-485 plus LoRaWAN, not a LoRaWAN guarantee. Class A waits for the next uplink receive window and must not fail mechanically at 10 seconds; non-idempotent actions default to maxRetries: 0; and Class C downBufferClear flushes the device queue rather than cancelling one specific transaction, cannot recall transmitted frames and is separate from UI expiry.
Closing the loop with model output, MQTT and acceptance tests
To let operators see verified outcomes without refreshing the browser, write confirmed values into the target model's telemetry_data (verifying shared_attrs compatibility only if legacy forms require it) and have a single owner emit one correlated MQTT notice along existing model or attribute forwarding paths. When using attribute forwarding, audit the minimal forward_fields whitelist—forward: true never bypasses the whitelist—and avoid sending parallel customMqtt duplicates.
Script unit tests alone cannot substitute for live acceptance. Verify normal GET/SET, target matching existing cache, partial replies, wrong slave or bad CRC rejection, late or duplicate reply deduplication, write ACK without state change, Class A window patience and bounded post-timeout read-only checks. If logging fails, execute the business action only once rather than retrying writes.
- Confirm subdevice EUI, parent device.parent, slave address, mounted RPC and paired receiving model version.
- Test normal SET/GET plus same-as-cache values, verifying cached data and wrong-slave or bad-CRC frames are rejected.
- Confirm power or relay actions keep waiting after write ACK without fabricating power_switch or timestamps.
- Verify model update, forward_fields MQTT delivery, automatic UI completion and bounded read-only timeout checks.
Troubleshooting sequence and protocol correlation limits
Troubleshoot in a strict order: missing replies point to parent-child routing and serial framing; received but unconfirmed replies point to transaction matching, types and timestamps; confirmed model updates missing in the UI point to output structure, forwarding whitelists and subscriptions; and write ACKs without state change point to status polling and equipment interlocks. Never hide missing feedback by raising retry counts.
Where an industrial bus protocol carries no request sequence number, internal transaction IDs and arrival timestamps cannot eliminate every theoretical ambiguity between two identical back-to-back commands. Document sequential execution rules and remaining correlation limits honestly, archiving bench, script, live device, MQTT and physical-effect evidence separately.
Frequently asked questions
If a Modbus write reply passes CRC checks, why shouldn't the UI mark a switch as turned on immediately?
A write reply proves only that the subdevice accepted the command, not that the motor, relay or valve reached the target state. Wait for a valid post-command running-state report.
Should the platform automatically resend a write command when no reply arrives before timeout?
No—especially for non-idempotent actions where maxRetries defaults to 0. Mark the result unconfirmed and perform a bounded read-only query or site check instead.
If the cached parameter is already 25, can a new SET 25 finish immediately?
No. Stale cached values cannot confirm a new write; even an unchanged target value requires a valid post-command readback from the target slave.
References and further reading
This guide uses the official sources below. Diagrams explain the approach; consult the documentation for your version for exact menus, fields and capabilities. Linked sources are in Chinese.