this is how easy it is to use node-red to write date to influxdb.
the inject node simulates the mqtt in and the debug node is where the influxdb node will be
in the inject node you will see the complex json that a ttn sends to you
[
{
"id": "e95f216c4a3174af",
"type": "inject",
"z": "55354f631a16938a",
"name": "this will be the mqtt in node",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"end_device_ids\":{\"device_id\":\"eui-thisIsTheEUI\",\"application_ids\":{\"application_id\":\"myApp\"},\"dev_eui\":\"eui-thisIsTheEUI\",\"join_eui\":\"eui-thisIsTheJoinEUI\",\"dev_addr\":\"260B090E\"},\"correlation_ids\":[\"gs:uplink:xxxxxxxxx\"],\"received_at\":\"2023-12-08T20:20:55.378199900Z\",\"uplink_message\":{\"session_key_id\":\"xxxxxxxxxx\",\"f_port\":85,\"f_cnt\":42932,\"frm_payload\":\"xxxxx\",\"decoded_payload\":{\"door\":0,\"humidity\":86,\"temperature\":20.4},\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"oneCloseToYou\",\"eui\":\"gatewayEUI\"},\"timestamp\":2686651371,\"rssi\":-92,\"channel_rssi\":-92,\"snr\":8.2,\"location\":{\"latitude\":1.10101,\"longitude\":2.20202,\"altitude\":615000,\"source\":\"SOURCE_REGISTRY\"},\"uplink_token\":\"xxxxxxxxxxx\",\"channel_index\":4,\"received_at\":\"2023-12-08T20:20:55.070893669Z\"},{\"gateway_ids\":{\"gateway_id\":\"packetbroker\"},\"packet_broker\":{\"message_id\":\"xxxxxxx\",\"forwarder_net_id\":\"000013\",\"forwarder_tenant_id\":\"xxxxxx\",\"forwarder_cluster_id\":\"eu1.cloud.thethings.industries\",\"forwarder_gateway_eui\":\"xxxxxxx\",\"forwarder_gateway_id\":\"xxxxxxxx\",\"home_network_net_id\":\"000013\",\"home_network_tenant_id\":\"ttn\",\"home_network_cluster_id\":\"eu1.cloud.thethings.network\"},\"time\":\"2023-12-08T20:20:55.061923Z\",\"rssi\":-115,\"channel_rssi\":-115,\"snr\":-2.25,\"location\":{\"latitude\":2.20202,\"longitude\":1.10101,\"altitude\":95000},\"uplink_token\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"received_at\":\"2023-12-08T20:20:55.168940077Z\"}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7,\"coding_rate\":\"4/5\"}},\"frequency\":\"867300000\",\"timestamp\":2686651371},\"received_at\":\"2023-12-08T20:20:55.169445657Z\",\"consumed_airtime\":\"0.061696s\",\"version_ids\":{\"brand_id\":\"xxxxx\",\"model_id\":\"xxxxxx\",\"hardware_version\":\"V3.0\",\"firmware_version\":\"1.2\",\"band_id\":\"EU_863_870\"},\"network_ids\":{\"net_id\":\"000013\",\"ns_id\":\"xxxxxxx\",\"tenant_id\":\"ttn\",\"cluster_id\":\"eu1\",\"cluster_address\":\"eu1.cloud.thethings.network\"}}}",
"payloadType": "json",
"x": 290,
"y": 1040,
"wires": [
[
"0f7519882a50eb93"
]
]
},
{
"id": "700eb8752c1c36cb",
"type": "debug",
"z": "55354f631a16938a",
"name": "debug - this will be to influxdb",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 1040,
"wires": []
},
{
"id": "0f7519882a50eb93",
"type": "change",
"z": "55354f631a16938a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload.dev_eui",
"pt": "msg",
"to": "payload.end_device_ids.dev_eui",
"tot": "msg"
},
{
"t": "set",
"p": "payload.battery",
"pt": "msg",
"to": "payload.uplink_message.decoded_payload.battery",
"tot": "msg"
},
{
"t": "set",
"p": "payload.humidity",
"pt": "msg",
"to": "payload.uplink_message.decoded_payload.humidity",
"tot": "msg"
},
{
"t": "set",
"p": "payload.temperature",
"pt": "msg",
"to": "payload.uplink_message.decoded_payload.temperature",
"tot": "msg"
},
{
"t": "delete",
"p": "payload.end_device_ids",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.correlation_ids",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.uplink_message",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 500,
"y": 1040,
"wires": [
[
"ae3ff2a21e492806"
]
]
},
{
"id": "ae3ff2a21e492806",
"type": "function",
"z": "55354f631a16938a",
"name": "dew point",
"func": "let h = msg.payload.humidity\nlet t = msg.payload.temperature\n\nlet dew = t - ((100 - h)/5)\n\nmsg.payload.dewPoint = dew\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 680,
"y": 1040,
"wires": [
[
"700eb8752c1c36cb"
]
]
}
]