Expand description
Reading what a ChirpStack network server publishes about the devices it hears.
A gateway hands packets to a network server, and the server hands what they carried to the
application: decrypted, deduplicated across gateways, and tagged with the device it came
from. ChirpStack publishes that on MQTT, one event per uplink, on
application/{application id}/device/{dev eui}/event/up, as the JSON form of its
integration.UplinkEvent message. UplinkEvent::from_json reads it into plain fields,
so a program that feeds a dashboard or a store needs to know nothing about the message
definitions.
Two things about the JSON are worth knowing, both from protobuf’s JSON mapping rather than
from ChirpStack. Every name is camelCase, so f_port arrives as fPort. And a field at its
default value is left out, so the first uplink after a join has no fCnt, and an uplink
without ADR has no adr; they read here as zero and false.
The layout follows ChirpStack v4’s api/proto/integration/integration.proto and the example
on its integration events documentation page, and the ChirpStack interop job reads a live
server’s events with it.
§Examples
A soil probe’s reading as ChirpStack publishes it, in the layout its integration events
documentation shows. The payload arrives decrypted and in base64, MjEuNQ== being the
text 21.5:
use pamoja_gateway::chirpstack::UplinkEvent;
let json = r#"{
"deduplicationId": "3ac7e3c4-4401-4b8d-9386-a5c902f9202d",
"time": "2026-07-18T09:34:15.775023242+00:00",
"deviceInfo": {
"applicationId": "17c82e96-be03-4f38-aef3-f83d48582d97",
"deviceName": "soil probe, north bed",
"devEui": "70b3d57ed0001234"
},
"devAddr": "26011bda",
"dr": 5,
"fPort": 2,
"data": "MjEuNQ==",
"rxInfo": [{ "gatewayId": "b827ebfffe010203", "rssi": -36, "snr": 10.5 }],
"txInfo": { "frequency": 868100000 }
}"#;
let event = UplinkEvent::from_json(json)?;
assert_eq!(event.dev_eui.to_hex(), "70b3d57ed0001234");
assert_eq!(event.fport, Some(2));
assert_eq!(event.data, b"21.5");
assert_eq!(event.fcnt, 0, "left out of the JSON because it is zero");
assert_eq!(event.best_reception().map(|heard| heard.rssi_dbm), Some(-36));Structs§
- Reception
- One gateway’s reception of an uplink.
- Uplink
Event - An uplink as a ChirpStack server published it.
Enums§
- Event
Error - Why a message is not an uplink event.
Constants§
- UPLINK_
TOPIC - The topic filter for every uplink event of every application on a server.
Functions§
- uplink_
topic - Returns the topic filter for one application’s uplink events.