Skip to main content
This guide shows you how to forward readings from a system that already holds them: a vendor’s cloud, a LoRaWAN network server or a datalogger. You need a claimed device and its key from the quickstart. The bridge is a script that pulls readings from the vendor’s cloud or network server, by polling or from a webhook, maps each one to a metric_id, and posts it to POST /api/metric-values, one request per reading. Copy the template below and replace fetchVendorReadings. The template’s API calls are verified against a live server.

Run The Template

The template needs Node 18 or later and uses the built-in fetch.

Adapt It

1

Bind each sensor to a device

DEVICES maps a vendor sensor id to one device and its key. Use one device and one key per physical sensor. A shared key loses per-device revocation and rate limiting.
2

Map vendor fields

METRIC_MAP maps vendor field names to metric ids. Map only the fields you’re sure about. An unmapped field is logged. A wrongly mapped one is stored and reaches the models.
METRIC_MAP includes ids 221, 222 and 223 (nitrogen, phosphorus and potassium). They exist in the catalogue but aren’t a supported reading. Leave those rows unused.
3

Replace fetchVendorReadings

This is the only vendor-specific code. Convert units here. Forward only readings you haven’t already sent: a reading re-posted every poll produces a flat series that hides an outage.
4

Handle the response

postMetric sends no timestamp. The server assigns one on arrival. A 201 means the reading is stored. On 429 the template sleeps for the server’s retry_after_seconds. A 401 means the key was revoked or rotated. Issue a new key in the app. Retrying won’t clear it.
5

Watch the log

Each poll logs how many readings were forwarded and which vendor fields were unmapped. Non-numeric values are skipped.
The limit is 120 requests per 60 seconds per device. The template posts one reading per request, so the poll interval and the number of metrics per sensor set your rate.

bridge-template.ts

bridge-template.ts
That’s it. You have a bridge forwarding vendor readings. Next: Map a LoRaWAN Uplink for probes on your own network server.