The previous article on project costs ended with a promise: come back to the developer's view and walk the end-to-end development workflow. This is that article.

First, the positioning: this series already has dedicated deep-dives for every link in the chain — network access (OTAA vs ABP), decoder scripts, alarm rules, the three-stage data pipeline. This article does not redo those. It covers the sequence. Most rework in LoRaWAN projects comes not from doing a step wrong, but from doing the steps in the wrong order: three days spent writing a decoder before anyone confirmed what the raw payload looks like; a pile of alarm rules configured while the thing-model attributes were never mapped.

Use this as a roadmap: for your first LoRaWAN project, follow the seven steps; when a step gets hard, go read its dedicated article.

Step 1: Work backwards from the endpoint — define data requirements first

The first move is not unboxing hardware. It is answering two questions: what should the dashboard show, and what happens when a value goes out of range?

From those answers, derive three things: which fields to collect, how often to report, and the alarm thresholds with their response actions. For battery-powered devices there is one more constraint — the reporting interval and battery life are coupled. Reporting every ten minutes versus every two hours is a completely different battery budget.

The deliverable is a one-page data requirements sheet: field names, units, precision, reporting interval, alarm conditions, and actions. Every later decision refers back to it. Work backwards from the endpoint, not forwards from the device — the same principle as budgeting from the field back to the bill of materials.

Common pitfall: the requirements live only in a chat thread. When decoder keys, thing-model names, and alarm texts drift apart later, the missing sheet is usually why.

Step 2: Join the network — OTAA first, credentials registered before flashing

Prefer OTAA: automatic rejoin after reboot, roaming across gateways. ABP is for special cases only (minimal devices without an MCU, quick tests). The selection details are in the access article.

Join the network the way you would at production scale, not just "get it online":

  • Register credentials (DevEUI, AppKey) in the ledger before flashing them onto devices — reversed order is where credential incidents start;
  • If batch preparation is already underway, use the platform's Excel bulk import: ABP entries take devAddr plus two keys, OTAA takes the AppKey — reconcile against the manifest instead of adding devices by hand;
  • Confirm the regional band (CN470/EU868/US915 and so on) and the LoRaWAN 1.0.x protocol version match on both sides.

Common pitfall: manually added test devices quietly become the habit for later batches. The ledger should be batch-shaped from day one.

Step 3: Do not write the decoder until you have seen the raw payload

This step does one thing: confirm the link works and look at the raw payload with your own eyes.

Check three things: RSSI and SNR are in a sane range; FCnt increments with each packet (confirming you are not seeing replays or misalignment); and you have the Base64 payload in hand. This is the "first crime scene" of the link — the decoder's input and the reference point when things go wrong later.

Common pitfall: skipping straight to the decoder. Byte misalignment and endianness mistakes are found in five minutes in front of the raw payload, and after a full day of "the data looks wrong".

Step 4: Decoder scripts — platform constraints first, field mapping second

ThinkLink runs decoder scripts in a vm2 sandbox with hard limits: a 1000 ms execution ceiling, no console calls, no async operations, and the payload taken as Base64 from msg.userdata.payload. Know these before writing the first line, or a script that runs perfectly locally will stall in production.

For a typical two-byte temperature/humidity payload, the logic reads line by line as:

take the first byte, multiply by the precision factor 0.1, that is the temperature;

take the second byte, multiply by the precision factor 0.1, that is the humidity;

return the fields as an object, with key names matching the requirements sheet.

Here is the most important sentence in this article: a script that exists is not the same as a mapping that is done. A passing decoder test only turns bytes into fields; the fields must then be mapped onto thing-model attributes one by one before the data actually lands in the platform. The test is simple: the attribute shows a latest value with unit and timestamp.

Common pitfall: assuming the decoder test passing means you are done — then the dashboard is empty because the attribute mapping was skipped.

Step 5: Data landing — verify history and the outbound boundary separately

Once data reaches the thing model, verify its two destinations:

History storage. The platform's built-in history is backed by TimescaleDB. Query the attribute's historical curve and confirm the time series is actually landing — whether the dashboard can draw lines depends on this.

The outbound boundary. If your business system takes the data itself, use the MQTT forwarder: forwardScript returns a topic, msg, and option triple; returning null drops the message. The forwarder does not buffer and does not resend — data generated while your consumer is offline is not kept for you. Architecturally, the outbound point is where responsibility transfers: past it, reliability is the business system's job. To push device online/offline state, notify_offline must be explicitly enabled in the forwarding configuration.

Common pitfall: assuming the forwarder retries. It is a pass-through pipe, not a message queue — reconnection and catch-up belong on the consumer side.

Step 6: Trigger rules and alarms — design deduplication before configuring actions

ThinkLink alarms have four severity levels; trigger rules can return delayms (debounce wait) and abort_previous_timer (cancel a pending older trigger), and one rule can dispatch to multiple actions. Built-in notification channels are email and WeCom; anything beyond goes through the forwarder.

Before configuring actions, understand deduplication: the system deduplicates when name, title, desc, and level are all identical. This means desc must not embed live values — if you concatenate the temperature into it, every alarm has a different desc, deduplication never hits, and one flapping sensor becomes an alarm storm. Put the value in the message body; keep desc as fixed text.

Offline alarms are configured here too: a device is declared lost when the last activity time plus twice heart_period is exceeded — the heart_period you set is exactly the offline-alarm delay you are choosing.

Common pitfall: declaring victory when the alarm fires once. Until a rule has been hit by a real over-limit simulation, it is "configured", not "verified".

Step 7: End-to-end verification, and freeze the evidence as a baseline

Finally, run the whole chain for real and keep the evidence. Verification follows the link: inject an over-limit test payload → decoder output correct → thing-model attribute updates → history curve appears → alarm triggers and deduplicates as expected → the business system receives the forwarded data.

Then freeze four baseline artifacts: a raw payload sample with its decoded result, one complete alarm firing record, the final rule configuration, and the updated ledger. These are the control group for every future incident — whenever any link changes later, regression against the baseline tells you what actually changed. This is also where collaboration starts: with a baseline, the second developer has an "originally correct" to compare against.

Common pitfall: verification as a one-time event. The output of this step should become policy — baselines live in the repository, and later script or rule changes go through regression, not memory.

The seven-step checklist

Step Key action Done means
1 Requirements Derive fields/interval/thresholds from dashboard and alarms One-page data requirements sheet
2 Join network OTAA first; credentials registered; batch-shaped import Device joined and in the ledger
3 Uplink check RSSI/SNR, FCnt, raw payload Raw payload sample in hand
4 Decode and map Sandbox constraints; script and attribute mapping as two tasks Latest value with unit visible in the thing model
5 Data landing History landing; outbound boundary explicit History queryable, forwarding reachable
6 Alarms Deduplication designed before actions; offline threshold parameterized Real over-limit simulation hits, no storm
7 E2E verification Full-chain simulation plus four baseline artifacts Baseline archived

Seven steps take a sensor from unboxed to a verified alarm. One person can walk this chain, but projects eventually belong to more people — the next article continues from Step 7's baseline: how to version decoder scripts and trigger rules across a team, so that "someone broke it and nobody knows" never happens.


Note: platform behaviors described here (vm2 sandbox limits, alarm levels and deduplication, forwarder semantics, TimescaleDB-backed history, Excel bulk import) follow the current ThinkLink documentation; see the ManThink resource center for details.