Generic LoRaWAN
Any TTN device with a JSON payload
If your LoRaWAN device is not Efento and not on the OpenSense supported list, you can still route it through TTN. You need three things:
- The device has a payload decoder (or you write one) that produces JSON.
- TTN has an HTTP webhook integration pointed at OpenSense.
- OpenSense knows how to map the JSON to your sensor channels.
Step 1 — write the payload decoder
TTN runs a JavaScript function per uplink. The function gets the raw bytes, returns an object that OpenSense ingests.
Example for a Dragino LHT65 (T + ext probe T):
function decodeUplink(input) {
const b = input.bytes;
// Dragino LHT65 v1.x payload format
const battery = ((b0 << 8) | b1) / 1000.0; // V
const t_int = ((b2 << 8) | b3) / 100.0; // °C
const rh_int = ((b4 << 8) | b5) / 100.0; // %
const t_ext = ((b7 << 8) | b8) / 100.0; // °C (DS18B20)
return {
data: {
measurements:
{ type: 'temperature', value: t_int, label: 'internal' },
{ type: 'humidity', value: rh_int },
{ type: 'temperature', value: t_ext, label: 'probe' },
{ type: 'battery', value: battery, unit: 'V' }
}
};
}
The shape OpenSense expects:
{
"measurements": [
{ "type": "<kind>", "value": <number>, "label": "<optional>", "unit": "<optional>" }
]
}
type must be one of: temperature, humidity, pressure, co2,
voltage, current, power, leak, battery, signal. Unknown types
are ignored. label distinguishes multiple sensors of the same type on
one device (e.g. two probes).
Step 2 — webhook to OpenSense
Same as for Efento:
Application → Integrations → Webhooks → + Add → JSON.- Paste the OpenSense ingest URL from
+ ADD DEVICE → LORAWAN → Generic. - Enable
Uplink message.
OpenSense uses the DevEUI from the TTN payload metadata to identify
the device. If you have not registered the DevEUI in OpenSense yet, the
first uplink lands in the unassigned tray on the site page; click to
associate.
Step 3 — map channels
OpenSense auto-creates a channel per type + label combination on first
uplink. Initial thresholds are pulled from the vertical preset of the
site. For example, a HACCP site auto-creates a temperature channel with
[−2 °C, +8 °C] operating range. Edit per-channel afterwards.
A note on FPort
Some LoRaWAN devices send different payload shapes on different FPort
values. The payload decoder can switch on input.fPort to handle them:
function decodeUplink(input) {
if (input.fPort === 1) return decodeReadings(input.bytes);
if (input.fPort === 99) return decodeConfig(input.bytes);
return { errors: ['unknown fport'] };
}
OpenSense ignores anything that is not measurements. Config uplinks are
fine, they are simply dropped at the ingest.
Devices we have tested
| Vendor / model | Status |
|---|---|
| Efento NS-T-3, NX-T | First-class, see dedicated page |
| Dragino LHT65 / LHT65N | Works with decoder above |
| Milesight EM300-TH | Works with built-in TTN decoder |
| Milesight EM500-CO2 | Works, vertical = climate |
| Adeunis Field Test Device | Works, useful for survey only |
| Generic Decentlab DL-IAM | Works with vendor decoder |
If you get a device working that is not on the list, send the decoder via GitHub and we will add it.