Hello,
sorry for late reply. Here is full packet from TTN:
{
"name": "as.up.data.forward",
"time": "2023-06-21T09:54:46.477384640Z",
"identifiers": [
{
"device_ids": {
"device_id": "eui-",
"application_ids": {
"application_id": "demo-rh-t-sensors"
},
"dev_eui": "redacted",
"join_eui": "0000000000000000",
"dev_addr": "redacted"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.ApplicationUp",
"end_device_ids": {
"device_id": "eui-redacted",
"application_ids": {
"application_id": "demo-rh-t-sensors"
},
"dev_eui": "redacted",
"join_eui": "redacted",
"dev_addr": "redacted"
},
"correlation_ids": [
"as:up:redacted",
"gs:conn:redacted",
"gs:up:host:redacted",
"gs:uplink:redacted",
"ns:uplink:redacted",
"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:redacted",
"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:redacted"
],
"received_at": "2023-06-21T09:54:46.472549279Z",
"uplink_message": {
"session_key_id": "redacted",
"f_port": 1,
"f_cnt": 468,
"frm_payload": "uAs0QsKh4kF+AQ==",
"decoded_payload": {
"battery": 2.9458115183246076,
"humidity": 28.328983306884766,
"temperature": 45.011444091796875
},
"rx_metadata": [
{
"gateway_ids": {
"gateway_id": "redacted",
"eui": "redacted"
},
"timestamp": 424792863,
"rssi": -102,
"channel_rssi": -102,
"snr": -7,
"frequency_offset": "2457",
"uplink_token": "redacted",
"channel_index": 5,
"received_at": "2023-06-21T09:54:46.266642855Z"
},
{
"gateway_ids": {
"gateway_id": "redacted",
"eui": "redacted"
},
"time": "2023-06-21T09:54:46.246729Z",
"timestamp": 2894703827,
"rssi": -112,
"channel_rssi": -112,
"snr": -1.2,
"location": {
"latitude": 45.99987403687367,
"longitude": 14.393074214458467,
"altitude": 365,
"source": "SOURCE_REGISTRY"
},
"uplink_token": "redacted",
"received_at": "2023-06-21T09:54:46.286691156Z"
}
],
"settings": {
"data_rate": {
"lora": {
"bandwidth": 125000,
"spreading_factor": 7,
"coding_rate": "4/5"
}
},
"frequency": "868100000",
"timestamp": 424792863
},
"received_at": "2023-06-21T09:54:46.268288992Z",
"consumed_airtime": "0.061696s",
"network_ids": {
"net_id": "000013",
"tenant_id": "ttn",
"cluster_id": "eu1",
"cluster_address": "eu1.cloud.thethings.network"
}
}
},
"correlation_ids": [
"as:up:redacted",
"gs:conn:redacted",
"gs:up:host:redacted",
"gs:uplink:redacted",
"ns:uplink:redacted",
"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:redacted",
"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:redacted"
],
"origin": "ip-10-100-13-125.eu-west-1.compute.internal",
"context": {
"tenant-id": "redacted"
},
"visibility": {
"rights": [
"RIGHT_APPLICATION_TRAFFIC_READ"
]
},
"unique_id": "redacted"
}
Let me fetch also Losant packet…
{
"applicationId": "redacted",
"applicationName": "redacted",
"data": {
"body": {
"correlation_ids": [
"as:up:redacted",
"gs:conn:redacted",
"gs:up:host:redacted",
"gs:uplink:redacted",
"ns:uplink:redacted",
"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:redacted",
"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:redacted"
],
"end_device_ids": {
"application_ids": {
"application_id": "demo-rh-t-sensors"
},
"dev_addr": "redacted",
"dev_eui": "redacted",
"device_id": "eui-redacted",
"join_eui": "redacted"
},
"received_at": "2023-06-21T10:13:49.507751820Z",
"uplink_message": {
"consumed_airtime": "0.061696s",
"decoded_payload": {
"battery": 2.9458115183246076,
"humidity": 27.316165924072266,
"temperature": 46.13832092285156
},
"f_cnt": 470,
"f_port": 1,
"frm_payload": "pI04QoKH2kF+AQ==",
"network_ids": {
"cluster_address": "eu1.cloud.thethings.network",
"cluster_id": "eu1",
"net_id": "000013",
"tenant_id": "ttn"
},
"received_at": "2023-06-21T10:13:49.300129455Z",
"rx_metadata": [
{
"channel_index": 6,
"channel_rssi": -101,
"frequency_offset": "2484",
"gateway_ids": {
"eui": "redacted",
"gateway_id": "redacted"
},
"received_at": "2023-06-21T10:13:49.299051910Z",
"rssi": -101,
"snr": -4,
"timestamp": 1567832571,
"uplink_token": "*****REDACTED*****"
},
{
"channel_index": 1,
"channel_rssi": -110,
"gateway_ids": {
"eui": "redacted",
"gateway_id": "redacted"
},
"location": {
"altitude": 365,
"latitude": redacted,
"longitude": redacted,
"source": "SOURCE_REGISTRY"
},
"received_at": "2023-06-21T10:13:49.319715386Z",
"rssi": -110,
"snr": -1.2,
"time": "2023-06-21T10:13:49.287310Z",
"timestamp": 4037743027,
"uplink_token": "*****REDACTED*****"
}
],
"session_key_id": "redacted",
"settings": {
"data_rate": {
"lora": {
"bandwidth": 125000,
"coding_rate": "4/5",
"spreading_factor": 7
}
},
"frequency": "868300000",
"timestamp": 1567832571
}
}
},
"headers": {
"accept-encoding": "gzip",
"content-length": "1949",
"content-type": "application/json",
"user-agent": "TheThingsStack/3.26.1-rc0-SNAPSHOT-71f92a964 (linux/arm64)",
"x-forwarded-for": "34.255.49.188",
"x-forwarded-proto": "https",
"x-real-ip": "34.255.49.188",
"x-ssl-proto": "TLSv1.3",
"x-tts-domain": "eu1.cloud.thethings.network"
},
"method": "post",
"path": "/uplink",
"query": {
}
},
"flowId": "redacted",
"flowName": "TTN Receiver",
"flowVersion": "develop",
"globals": {
"LORA_NETWORK_SERVER_AUTH_TOKEN": "*****REDACTED*****"
},
"relayId": "000000000000000000000000",
"relayType": "public",
"time": "2023-06-21T10:13:49.569Z",
"triggerId": "redacted",
"triggerType": "webhook"
}
And here is what I have implemented into “Function” block:
payload.data.battery = payload.data.body.uplink_message.decoded_payload.battery;
payload.data.temperature = payload.data.body.uplink_message.decoded_payload.temperature;
payload.data.humidity = payload.data.body.uplink_message.decoded_payload.humidity;
payload.data.rssi = -37;
payload.data.snr = 10;
//payload.data.rssi = payload.data.body.uplink_message.rx_metadata.0.rssi;
payload.data.rssi = payload.data.body.uplink_message.rx_metadata[0].rssi;
payload.data.snr = payload.data.body.uplink_message.rx_metadata[0].snr;