TTN Decoder - Help

Hi,

In TTN they are no longer supporting large decoders.

ttndecoder.txt (27.5 KB)

I know what the decoder needs to be in TTN, it is in my DECODER function.

If you use inject Payload [1,2,3] RAW, it injects the raw payload that is msg.payload.payload.uplink_message.frm_payload into the decoder.

The DECODER needs to decode the raw payload and output it in msg.payload.uplink_message.decoded_payload

If you use inject Payload [1,2,3] Decoded in the flow you see how the end result needs to look like and the decoded msg.payload.uplink_message.decoded_payload

The solution.

[{"id":"c25b4176.1ca91","type":"tab","label":"TTN Decoder","disabled":false,"info":""},{"id":"647c5400.63d3fc","type":"inject","z":"c25b4176.1ca91","name":"Payload 1 RAW","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"v3/abeeway-sotracker@ttn/devices/micro-t1-20635f01080022c6/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"micro-t1-20635f01080022c6\",\"application_ids\":{\"application_id\":\"abeeway-sotracker\"},\"dev_eui\":\"20635F01080022C6\",\"join_eui\":\"20635F0001000013\",\"dev_addr\":\"260BABFF\"},\"correlation_ids\":[\"as:up:01F7CAV78YACQ40ATT0CQQ07BC\",\"gs:conn:01F7B8TDXH4VC1JVA13M0NKZ4T\",\"gs:up:host:01F7B8TDXQ1Z4Y8BNQZK8ME9DC\",\"gs:uplink:01F7CAV72BZA6SP9V34FXG1TRH\",\"ns:uplink:01F7CAV72FF2CBSNZT089TT44D\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F7CAV72FNN655E6Y78T4PKGR\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01F7CAV78XM0ZJVSAKTK0DCAE6\"],\"received_at\":\"2021-06-04T20:18:47.198927761Z\",\"uplink_message\":{\"session_key_id\":\"AXnOdrdVT43saIPKQWgElQ==\",\"f_port\":17,\"f_cnt\":318,\"frm_payload\":\"CiyzejAB\",\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"on-the-hill-01\",\"eui\":\"00800000A000104F\"},\"timestamp\":1320097987,\"rssi\":-75,\"channel_rssi\":-75,\"snr\":9.5,\"uplink_token\":\"ChwKGgoOb24tdGhlLWhpbGwtMDESCACAAACgABBPEMOxvPUEGgwIppXqhQYQiN7M1gMguPPi37WOCA==\"}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7}},\"data_rate_index\":5,\"coding_rate\":\"4/5\",\"frequency\":\"868100000\",\"timestamp\":1320097987},\"received_at\":\"2021-06-04T20:18:46.991259908Z\",\"consumed_airtime\":\"0.051456s\",\"version_ids\":{\"brand_id\":\"abeeway\",\"model_id\":\"abeeway-micro-tracker\",\"hardware_version\":\"3.0\",\"firmware_version\":\"2.1\",\"band_id\":\"EU_863_870\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"5c67abb7.1c8d14\",\"_event\":\"node:5328b1c5.bdf71\"}","payloadType":"json","x":140,"y":140,"wires":[["4df601d8.548aa"]]},{"id":"4df601d8.548aa","type":"change","z":"c25b4176.1ca91","name":"Payload Switch","rules":[{"t":"move","p":"payload.topic","pt":"msg","to":"topic","tot":"msg"},{"t":"move","p":"payload.payload","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":220,"wires":[["b179d132.35b5c","a246a1.6493996"]]},{"id":"b179d132.35b5c","type":"function","z":"c25b4176.1ca91","name":"DECODER","func":"let data = msg.payload.uplink_message.frm_payload;\n    bytes = new Buffer(data,'Base64');\n\nlet decoded = context.Decoder(bytes, msg.payload.uplink_message.f_port);\nmsg.payload.uplink_message.decoded_payload = decoded;\nreturn msg;","outputs":1,"noerr":0,"initialize":"context.Decoder = function(bytes, port) {\n\n  // nbits: number of bits used to encode\n  // lo: min value that can be encoded\n  // hi: max value that can be encoded\n  // nresv: number of reserved values, not used for the encoding\n  function step_size(lo, hi, nbits, nresv) {\n    return 1.0 / ((((1<<nbits) - 1) - nresv) / (hi - lo));\n  }\n\n  function mt_value_decode(value, lo, hi, nbits, nresv) {\n    return (value - nresv / 2) * step_size(lo, hi, nbits, nresv) + lo;\n  }\n\n  // Gets the zero-based unsigned numeric value of the given bit(s)\n  function bits(value, lsb, msb) {\n    var len = msb - lsb + 1;\n    var mask = (1<<len) - 1;\n    return value>>lsb & mask;\n  }\n\n  // Gets the boolean value of the given bit\n  function bit(value, bit) {\n    return (value & (1<<bit)) > 0;\n  }\n\n  // Gets a hexadecimal representation ensuring a leading zero for each byte\n  function hex(bytes, separator) {\n    return bytes.map(function (b) {\n      return (\"0\" + b.toString(16)).substr(-2);\n    }).join(separator || \"\");\n  }\n\n  // Decodes 4 bytes into a signed integer, MSB\n  function int32(bytes) {\n    // JavaScript bitwise operators always work with 32 bits signed integers\n    return bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3];\n  }\n\n  // Decodes 4 bytes into an unsigned integer, MSB\n  function uint32(bytes) {\n    // Or, same result:\n    //   return bytes[0] * 0x1000000 + bytes[1] * 0x10000 + bytes[2] * 0x100 + bytes[3];\n    //   return bytes[0] * 0x1000000 + (bytes[1]<<16 | bytes[2]<<8 | bytes[3]);\n    //   return bytes[0] * (1<<24) + (bytes[1]<<16 | bytes[2]<<8 | bytes[3]);\n    //   return int32(bytes)>>>0;\n\n    // JavaScript bitwise operators always work with 32 bits signed integers;\n    // force conversion to unsigned 32 bits value using zero-fill right shift\n    return (bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3])>>>0;    \n  }\n\n  // Decodes 1 to 4 MAC addresses and their RSSI\n  function mac_rssi(bytes) {\n    var items = [];\n    for (var offset = 0; offset < bytes.length; offset += 7) {\n      items.push({\n        mac_address: hex(bytes.slice(offset, offset + 6), \":\"),\n        // Sign-extend to 32 bits to support negative values; dBm\n        rssi: bytes[offset + 6]<<24>>24,\n      });\n    }\n    return items;\n  }\n\n  function message(code, descriptions) {\n    return {\n      code: code,\n      description: code < 0 || code >= descriptions.length ? \"UNKNOWN\" : descriptions[code]\n    };\n  }\n\n  var decoded = {};\n  var i;\n\n  var type = bytes[0];\n\n  // All message types, except for Frame pending messages, share the same header\n  if (type !== 0x00) {\n    // Note: the Data Storage Integration stores nested objects as text\n    decoded.status = {\n      mode: message(bits(bytes[1], 5, 7), [\"Standby\", \"Motion tracking\", \"Permanent tracking\",\n        \"Motion start/end tracking\", \"Activity tracking\", \"OFF\"]),\n      sos: bit(bytes[1], 4),\n      tracking: bit(bytes[1], 3),\n      moving: bit(bytes[1], 2),\n      periodic: bit(bytes[1], 1),\n      on_demand: bit(bytes[1], 0)\n    };\n\n    // Trackers with a rechargeable battery:the percentage reflects the actual value\n    decoded.batteryPersentage = bytes[2];\n    \n    decoded.temperature = Math.round(100 * mt_value_decode(bytes[3], -44, 85, 8, 0)) / 100;\n    \n    decoded.ack = bits(bytes[4], 4, 7);\n    \n    decoded.data = bits(bytes[4], 0, 3);\n    \n    decoded.lastResetCause = \"lastResetCause: \" + bytes[5];\n\n\n  }\n\n  switch (type) {\n    case 0x00:\n      decoded.type = \"FRAME PENDING\";\n      decoded.token = bytes[1];\n      break;\n\n    case 0x03:\n      decoded.type = \"POSITION\";\n      switch (decoded.data) {\n        case 0:\n          decoded.position_type = \"GPS fix\";\n          decoded.age = mt_value_decode(bytes[5], 0, 2040, 8, 0);\n          // Signed 32 bits integers; LSB is always zero\n          decoded.latitude = (bytes[6]<<24 | bytes[7]<<16 | bytes[8]<<8) / 1e7;\n          decoded.longitude = (bytes[9]<<24 | bytes[10]<<16 | bytes[11]<<8) / 1e7;\n          // Estimated Horizontal Position Error\n          decoded.ehpe = mt_value_decode(bytes[12], 0, 1000, 8, 0);\n          break;\n\n        case 1:\n          decoded.position_type = \"GPS timeout\";\n          decoded.timeout_cause = message(bytes[5], [\"User timeout cause\"]);\n          for (i = 0; i < 4; i++) {\n            // Carrier over noise (dBm) for the i-th satellite seen\n            decoded[\"cn\" + i] = mt_value_decode(bytes[6 + i], 0, 2040, 8, 0);\n          }\n          break;\n\n        case 2:\n          // Documented as obsolete\n          decoded.error = message(0, [\"UNSUPPORTED POSITION TYPE \" + decoded.data]);\n          break;\n\n        case 3:\n          decoded.position_type = \"WIFI timeout\";\n          for (i = 0; i < 6; i++) {\n            decoded[\"v_bat\" + (i + 1)] = mt_value_decode(bytes[5 + i], 2.8, 4.2, 8, 2);\n          }\n          break;\n\n        case 4:\n          decoded.position_type = \"WIFI failure\";\n          for (i = 0; i < 6; i++) {\n            // Most of time a WIFI timeout occurs due to a low battery condition\n            decoded[\"v_bat\" + (i + 1)] = mt_value_decode(bytes[5 + i], 2.8, 4.2, 8, 2);\n          }\n          decoded.error = message(bytes[11], [\"WIFI connection failure\", \"Scan failure\",\n            \"Antenna unavailable\", \"WIFI not supported on this device\"]);\n          break;\n\n        case 5:\n        case 6:\n          decoded.position_type = \"LP-GPS data\";\n          // Encrypted; not described in the documentation\n          decoded.error = message(0, [\"UNSUPPORTED POSITION TYPE \" + decoded.data]);\n          break;\n\n        case 7:\n          decoded.position_type = \"BLE beacon scan\";\n          decoded.age = mt_value_decode(bytes[5], 0, 2040, 8, 0);\n          // Remaining data: up to 4 beacons\n          decoded.beacons = mac_rssi(bytes.slice(6));\n          break;\n\n        case 8:\n          decoded.position_type = \"BLE beacon failure\";\n          decoded.error = message(bytes[5], [\"BLE is not responding\", \"Internal error\", \"Shared antenna not available\",\n            \"Scan already on going\", \"No beacon detected\", \"Hardware incompatibility\"]);\n          break;\n\n        // Test with: 0358D895090EC46E1FF44B9EB76466B3B87454AD500959CA1ED4AD525E67DA14A1AC\n        // or 032CD1890900C46E1FF44B9EC5C83A355A3898A6\n        case 9:\n          decoded.position_type = \"WIFI BSSIDs\";\n          decoded.age = mt_value_decode(bytes[5], 0, 2040, 8, 0);\n          // Remaining data: up to 4 WiFi BSSIDs\n          decoded.stations = mac_rssi(bytes.slice(6));\n          break;\n\n        default:\n          decoded.error = message(0, [\"UNSUPPORTED POSITION TYPE \" + decoded.data]);\n      }\n      break;\n\n    case 0x04:\n      decoded.type = \"ENERGY STATUS\";\n      break;\n\n    case 0x05:\n      decoded.type = \"HEARTBEAT\";\n      decoded.mcuFirmware = bytes[6] + \".\" + bytes[7] + \".\" + bytes[8];\n      decoded.bleFirmware = bytes[9] + \".\" + bytes[10] + \".\" + bytes[11];\n\n      break;\n\n    case 0x07:\n      // Activity status message and configuration message share the same identifier\n      var tag = bytes[5];\n      switch (tag) {\n        case 1:\n          decoded.type = \"ACTIVITY STATUS\";\n          decoded.activity_counter = uint32(bytes.slice(6, 10));\n          break;\n\n        case 2:\n          decoded.type = \"CONFIGURATION\";\n          for (i = 0; i < 5; i++) {\n            var offset = 6 + 5 * i;\n            decoded[\"param\" + i] = {\n            type: bytes[offset],\n            value: uint32(bytes.slice(offset + 1, offset + 5))\n            };\n          }\n            break;\n\n        case 3:\n          decoded.type = \" SHOCK DETECTION\";\n            decoded.axisX = \"fwVersion: \" + bytes[7] + \".\" + bytes[8];\n            decoded.axisY = \"fwVersion: \" + bytes[9] + \".\" + bytes[10];\n            decoded.axisX = \"fwVersion: \" + bytes[11] + \".\" + bytes[12];\n            //Byte 7-8 - X Axis\n            //Byte 9-10 - Y Axis\n            //Byte 11-12 - Z Axis\n            break;\n\n        default:\n          decoded.error = message(0, [\"UNSUPPORTED POSITION TYPE \" + decoded.data + \"/\" + tag]);\n      }\n      break;\n   \n  \n\n    case 0x09:\n      decoded.type = \"SHUTDOWN\";\n      break;\n\n    case 0xFF:\n      decoded.type = \"DEBUG\";\n      break;\n\n    default:\n      decoded.error = message(0, [\"UNSUPPORTED MESSAGE TYPE \" + type]);\n  }\n\n  // Just some redundant debug info\n  decoded.debug = {\n    payload: hex(bytes),\n    length: bytes.length,\n    port: port,\n    server_time: new Date().toISOString()\n  };\n\n  return decoded;\n}","finalize":"","x":650,"y":220,"wires":[["dc88a040.3194f"]]},{"id":"dc88a040.3194f","type":"debug","z":"c25b4176.1ca91","name":"Decoded","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":820,"y":220,"wires":[]},{"id":"fad5a52e.4eef78","type":"inject","z":"c25b4176.1ca91","name":"Payload 2 RAW","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"v3/abeeway-sotracker@ttn/devices/micro-t1-20635f01080022c6/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"micro-t1-20635f01080022c6\",\"application_ids\":{\"application_id\":\"abeeway-sotracker\"},\"dev_eui\":\"20635F01080022C6\",\"join_eui\":\"20635F0001000013\",\"dev_addr\":\"260BABFF\"},\"correlation_ids\":[\"as:up:01F7CAZ6NRP26BV82DR4QCFZ3Q\",\"gs:conn:01F7B8TDXH4VC1JVA13M0NKZ4T\",\"gs:up:host:01F7B8TDXQ1Z4Y8BNQZK8ME9DC\",\"gs:uplink:01F7CAZ6F54EFZ9S39HM60XW4D\",\"ns:uplink:01F7CAZ6FAVMABH4CP06FQNE7K\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F7CAZ6FAA33YBBJGK5NB2PR7\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01F7CAZ6NQS0KRVTK7WSF0Y6TM\"],\"received_at\":\"2021-06-04T20:20:57.665414587Z\",\"uplink_message\":{\"session_key_id\":\"AXnOdrdVT43saIPKQWgElQ==\",\"f_port\":17,\"f_cnt\":321,\"frm_payload\":\"AyixezAJ7jvnEldmAg==\",\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"on-the-hill-01\",\"eui\":\"00800000A000104F\"},\"timestamp\":1450556283,\"rssi\":-69,\"channel_rssi\":-69,\"snr\":9.2,\"uplink_token\":\"ChwKGgoOb24tdGhlLWhpbGwtMDESCACAAACgABBPEPv21rMFGgwIqZbqhQYQ29ee1AEg+LCR35uSCA==\",\"channel_index\":3}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7}},\"data_rate_index\":5,\"coding_rate\":\"4/5\",\"frequency\":\"867100000\",\"timestamp\":1450556283},\"received_at\":\"2021-06-04T20:20:57.450903305Z\",\"consumed_airtime\":\"0.061696s\",\"version_ids\":{\"brand_id\":\"abeeway\",\"model_id\":\"abeeway-micro-tracker\",\"hardware_version\":\"3.0\",\"firmware_version\":\"2.1\",\"band_id\":\"EU_863_870\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"a2af7ddd.ce9ed\",\"_event\":\"node:5328b1c5.bdf71\"}","payloadType":"json","x":140,"y":180,"wires":[["4df601d8.548aa"]]},{"id":"aa455118.86497","type":"inject","z":"c25b4176.1ca91","name":"Payload 3 RAW","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"v3/abeeway-sotracker@ttn/devices/sotracking-abeeway-smartbadge-1/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"sotracking-abeeway-smartbadge-1\",\"application_ids\":{\"application_id\":\"abeeway-sotracker\"},\"dev_eui\":\"20635F01E10002F0\",\"join_eui\":\"20635F000A000017\",\"dev_addr\":\"260B15C3\"},\"correlation_ids\":[\"as:up:01F7CB1K81Y0BCCRQS8NPC0XSQ\",\"gs:conn:01F7AW3MWNMZHA36R1RFBNCW9J\",\"gs:up:host:01F7AW3MWY17T4TZBBS9KC5ZT6\",\"gs:uplink:01F7CB1K1HNEA99E0NW9QEBQ9J\",\"ns:uplink:01F7CB1K1KXBW7S05G8A1YRK9R\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F7CB1K1KXS0ME080KDSJFM9Q\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01F7CB1K80QT7D52ASHY229WY9\"],\"received_at\":\"2021-06-04T20:22:16.065836206Z\",\"uplink_message\":{\"session_key_id\":\"AXnWjwaP8uCrBny/l83c/A==\",\"f_port\":18,\"f_cnt\":41,\"frm_payload\":\"AygndwAJ7jvlEldmAQ==\",\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"bb1st-jansmuts-1\",\"eui\":\"323531324D003400\"},\"time\":\"2021-06-04T20:22:15.353465Z\",\"timestamp\":3067457033,\"rssi\":-119,\"channel_rssi\":-119,\"snr\":-12,\"uplink_token\":\"Ch4KHAoQYmIxc3QtamFuc211dHMtMRIIMjUxMk0ANAAQidzWtgsaDAj3luqFBhCym/eYAyCopr+Vo7gL\",\"channel_index\":1},{\"gateway_ids\":{\"gateway_id\":\"on-the-hill-01\",\"eui\":\"00800000A000104F\"},\"timestamp\":1528972996,\"rssi\":-50,\"channel_rssi\":-50,\"snr\":13,\"uplink_token\":\"ChwKGgoOb24tdGhlLWhpbGwtMDESCACAAACgABBPEMSNidkFGgwI95bqhQYQzIKgogMgoNuR77+UCA==\",\"channel_index\":1},{\"gateway_ids\":{\"gateway_id\":\"packetbroker\"},\"packet_broker\":{\"message_id\":\"01F7CB1K1ECAHK5P724V0D3260\",\"forwarder_net_id\":\"000013\",\"forwarder_tenant_id\":\"ttn\",\"forwarder_cluster_id\":\"ttn-v2-eu-3\",\"home_network_net_id\":\"000013\",\"home_network_tenant_id\":\"ttn\",\"home_network_cluster_id\":\"ttn-eu1\",\"hops\":[{\"received_at\":\"2021-06-04T20:22:15.854293349Z\",\"sender_address\":\"40.113.68.198\",\"receiver_name\":\"router-dataplane-6497cdbc97-sq5dj\",\"receiver_agent\":\"pbdataplane/1.6.0-beta.3 go/1.16.4 linux/amd64\"},{\"received_at\":\"2021-06-04T20:22:15.856019397Z\",\"sender_name\":\"router-dataplane-6497cdbc97-sq5dj\",\"sender_address\":\"forwarder_uplink\",\"receiver_name\":\"router-666f4cd6b8-n4thf\",\"receiver_agent\":\"pbrouter/1.6.0-beta.3 go/1.16.4 linux/amd64\"},{\"received_at\":\"2021-06-04T20:22:15.857718939Z\",\"sender_name\":\"router-666f4cd6b8-n4thf\",\"sender_address\":\"deliver.000013_ttn_ttn-eu1.uplink\",\"receiver_name\":\"router-dataplane-6497cdbc97-sq5dj\",\"receiver_agent\":\"pbdataplane/1.6.0-beta.3 go/1.16.4 linux/amd64\"}]},\"rssi\":-109,\"channel_rssi\":-109,\"snr\":3,\"uplink_token\":\"eyJnIjoiWlhsS2FHSkhZMmxQYVVwQ1RWUkpORkl3VGs1VE1XTnBURU5LYkdKdFRXbFBhVXBDVFZSSk5GSXdUazVKYVhkcFlWaFphVTlwU1RSUlZuQjZVa2hhZUZwV1RraE5WbU13WTFac01rbHBkMmxrUjBadVNXcHZhVmd3ZEVka2JrNVRVMWhvZUZVd1pEWlNWemg2V2taQ1NFNUliSFJhZVVvNUxsSXRUMll6V21sd1VHSXRXVkJKZWpWNU9HTnBSRUV1ZUVSbE9WRnhWVUZZYzBKbVJVOVdheTU1YW5KNldYQlNORU4zZUhWRGRrMVhjVmRITURGRVRuQnRRMGxqYzNkZmFEUkJNMGhwUmxONGFFNHpjMkZoYURselQydEVTVjlSWXpsMWRHUnRjVTFoV0Y5RVIwTmplVWxRWVhscExVNXJUMll4ZUZOaGNXdHdUR2RqTVdReWNXTkVTVEZzVXkxaWNrUlpjbnA0U0ZCTGMyMVNRVGRNZDE5d1lVVmtRM2RRY1dsUVZuZ3RjRFEzY0VSbWIxOWlVVmczVXkxTlJXMVpZa1JmWVZKMVJWOXhZVzk1TVVweVdIUXpWRzh0TGtkbE1WQjNlbTVQWDJ4MGJqUm1SMjQzYzNvd1RrRT0iLCJhIjp7ImZuaWQiOiIwMDAwMTMiLCJmdGlkIjoidHRuIiwiZmNpZCI6InR0bi12Mi1ldS0zIn19\"}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":10}},\"data_rate_index\":2,\"coding_rate\":\"4/5\",\"frequency\":\"868300000\",\"timestamp\":3067457033,\"time\":\"2021-06-04T20:22:15.353465Z\"},\"received_at\":\"2021-06-04T20:22:15.859308282Z\",\"consumed_airtime\":\"0.411648s\",\"version_ids\":{\"brand_id\":\"abeeway\",\"model_id\":\"abeeway-smart-badge\",\"hardware_version\":\"1.0\",\"firmware_version\":\"2.1\",\"band_id\":\"EU_863_870\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"ac072808.e36958\",\"_event\":\"node:5328b1c5.bdf71\"}","payloadType":"json","x":140,"y":220,"wires":[["4df601d8.548aa"]]},{"id":"a246a1.6493996","type":"debug","z":"c25b4176.1ca91","name":"Raw","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":550,"y":120,"wires":[]},{"id":"15e24aed.d516c5","type":"inject","z":"c25b4176.1ca91","name":"Payload 3 Decoded","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"v3/abeeway-sotracker@ttn/devices/sotracking-abeeway-smartbadge-1/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"sotracking-abeeway-smartbadge-1\",\"application_ids\":{\"application_id\":\"abeeway-sotracker\"},\"dev_eui\":\"20635F01E10002F0\",\"join_eui\":\"20635F000A000017\",\"dev_addr\":\"260B15C3\"},\"correlation_ids\":[\"as:up:01F7CB1K81Y0BCCRQS8NPC0XSQ\",\"gs:conn:01F7AW3MWNMZHA36R1RFBNCW9J\",\"gs:up:host:01F7AW3MWY17T4TZBBS9KC5ZT6\",\"gs:uplink:01F7CB1K1HNEA99E0NW9QEBQ9J\",\"ns:uplink:01F7CB1K1KXBW7S05G8A1YRK9R\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F7CB1K1KXS0ME080KDSJFM9Q\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01F7CB1K80QT7D52ASHY229WY9\"],\"received_at\":\"2021-06-04T20:22:16.065836206Z\",\"uplink_message\":{\"session_key_id\":\"AXnWjwaP8uCrBny/l83c/A==\",\"f_port\":18,\"f_cnt\":41,\"frm_payload\":\"AygndwAJ7jvlEldmAQ==\",\"decoded_payload\":{\"ack\":0,\"age\":72,\"battery\":3.01,\"data\":0,\"debug\":{\"length\":13,\"payload\":\"032827770009ee3be512576601\",\"port\":18,\"server_time\":\"2021-06-04T20:22:16.067Z\"},\"ehpe\":3.9215686274509802,\"latitude\":-29.806464,\"longitude\":30.7717632,\"position_type\":\"GPS fix\",\"status\":{\"mode\":{\"code\":1,\"description\":\"Motion tracking\"},\"moving\":false,\"on_demand\":false,\"periodic\":false,\"sos\":false,\"tracking\":true},\"temperature\":16.2,\"type\":\"POSITION\"},\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"bb1st-jansmuts-1\",\"eui\":\"323531324D003400\"},\"time\":\"2021-06-04T20:22:15.353465Z\",\"timestamp\":3067457033,\"rssi\":-119,\"channel_rssi\":-119,\"snr\":-12,\"uplink_token\":\"Ch4KHAoQYmIxc3QtamFuc211dHMtMRIIMjUxMk0ANAAQidzWtgsaDAj3luqFBhCym/eYAyCopr+Vo7gL\",\"channel_index\":1},{\"gateway_ids\":{\"gateway_id\":\"on-the-hill-01\",\"eui\":\"00800000A000104F\"},\"timestamp\":1528972996,\"rssi\":-50,\"channel_rssi\":-50,\"snr\":13,\"uplink_token\":\"ChwKGgoOb24tdGhlLWhpbGwtMDESCACAAACgABBPEMSNidkFGgwI95bqhQYQzIKgogMgoNuR77+UCA==\",\"channel_index\":1},{\"gateway_ids\":{\"gateway_id\":\"packetbroker\"},\"packet_broker\":{\"message_id\":\"01F7CB1K1ECAHK5P724V0D3260\",\"forwarder_net_id\":\"000013\",\"forwarder_tenant_id\":\"ttn\",\"forwarder_cluster_id\":\"ttn-v2-eu-3\",\"home_network_net_id\":\"000013\",\"home_network_tenant_id\":\"ttn\",\"home_network_cluster_id\":\"ttn-eu1\",\"hops\":[{\"received_at\":\"2021-06-04T20:22:15.854293349Z\",\"sender_address\":\"40.113.68.198\",\"receiver_name\":\"router-dataplane-6497cdbc97-sq5dj\",\"receiver_agent\":\"pbdataplane/1.6.0-beta.3 go/1.16.4 linux/amd64\"},{\"received_at\":\"2021-06-04T20:22:15.856019397Z\",\"sender_name\":\"router-dataplane-6497cdbc97-sq5dj\",\"sender_address\":\"forwarder_uplink\",\"receiver_name\":\"router-666f4cd6b8-n4thf\",\"receiver_agent\":\"pbrouter/1.6.0-beta.3 go/1.16.4 linux/amd64\"},{\"received_at\":\"2021-06-04T20:22:15.857718939Z\",\"sender_name\":\"router-666f4cd6b8-n4thf\",\"sender_address\":\"deliver.000013_ttn_ttn-eu1.uplink\",\"receiver_name\":\"router-dataplane-6497cdbc97-sq5dj\",\"receiver_agent\":\"pbdataplane/1.6.0-beta.3 go/1.16.4 linux/amd64\"}]},\"rssi\":-109,\"channel_rssi\":-109,\"snr\":3,\"uplink_token\":\"eyJnIjoiWlhsS2FHSkhZMmxQYVVwQ1RWUkpORkl3VGs1VE1XTnBURU5LYkdKdFRXbFBhVXBDVFZSSk5GSXdUazVKYVhkcFlWaFphVTlwU1RSUlZuQjZVa2hhZUZwV1RraE5WbU13WTFac01rbHBkMmxrUjBadVNXcHZhVmd3ZEVka2JrNVRVMWhvZUZVd1pEWlNWemg2V2taQ1NFNUliSFJhZVVvNUxsSXRUMll6V21sd1VHSXRXVkJKZWpWNU9HTnBSRUV1ZUVSbE9WRnhWVUZZYzBKbVJVOVdheTU1YW5KNldYQlNORU4zZUhWRGRrMVhjVmRITURGRVRuQnRRMGxqYzNkZmFEUkJNMGhwUmxONGFFNHpjMkZoYURselQydEVTVjlSWXpsMWRHUnRjVTFoV0Y5RVIwTmplVWxRWVhscExVNXJUMll4ZUZOaGNXdHdUR2RqTVdReWNXTkVTVEZzVXkxaWNrUlpjbnA0U0ZCTGMyMVNRVGRNZDE5d1lVVmtRM2RRY1dsUVZuZ3RjRFEzY0VSbWIxOWlVVmczVXkxTlJXMVpZa1JmWVZKMVJWOXhZVzk1TVVweVdIUXpWRzh0TGtkbE1WQjNlbTVQWDJ4MGJqUm1SMjQzYzNvd1RrRT0iLCJhIjp7ImZuaWQiOiIwMDAwMTMiLCJmdGlkIjoidHRuIiwiZmNpZCI6InR0bi12Mi1ldS0zIn19\"}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":10}},\"data_rate_index\":2,\"coding_rate\":\"4/5\",\"frequency\":\"868300000\",\"timestamp\":3067457033,\"time\":\"2021-06-04T20:22:15.353465Z\"},\"received_at\":\"2021-06-04T20:22:15.859308282Z\",\"consumed_airtime\":\"0.411648s\",\"version_ids\":{\"brand_id\":\"abeeway\",\"model_id\":\"abeeway-smart-badge\",\"hardware_version\":\"1.0\",\"firmware_version\":\"2.1\",\"band_id\":\"EU_863_870\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"ac072808.e36958\",\"_event\":\"node:5328b1c5.bdf71\"}","payloadType":"json","x":430,"y":460,"wires":[["bbb65838.011fa8"]]},{"id":"17ac38e3.8b7e77","type":"inject","z":"c25b4176.1ca91","name":"Payload 2 Decoded","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"v3/abeeway-sotracker@ttn/devices/micro-t1-20635f01080022c6/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"micro-t1-20635f01080022c6\",\"application_ids\":{\"application_id\":\"abeeway-sotracker\"},\"dev_eui\":\"20635F01080022C6\",\"join_eui\":\"20635F0001000013\",\"dev_addr\":\"260BABFF\"},\"correlation_ids\":[\"as:up:01F7CAZ6NRP26BV82DR4QCFZ3Q\",\"gs:conn:01F7B8TDXH4VC1JVA13M0NKZ4T\",\"gs:up:host:01F7B8TDXQ1Z4Y8BNQZK8ME9DC\",\"gs:uplink:01F7CAZ6F54EFZ9S39HM60XW4D\",\"ns:uplink:01F7CAZ6FAVMABH4CP06FQNE7K\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F7CAZ6FAA33YBBJGK5NB2PR7\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01F7CAZ6NQS0KRVTK7WSF0Y6TM\"],\"received_at\":\"2021-06-04T20:20:57.665414587Z\",\"uplink_message\":{\"session_key_id\":\"AXnOdrdVT43saIPKQWgElQ==\",\"f_port\":17,\"f_cnt\":321,\"frm_payload\":\"AyixezAJ7jvnEldmAg==\",\"decoded_payload\":{\"ack\":3,\"age\":72,\"battery\":3.77,\"data\":0,\"debug\":{\"length\":13,\"payload\":\"0328b17b3009ee3be712576602\",\"port\":17,\"server_time\":\"2021-06-04T20:20:57.667Z\"},\"ehpe\":7.8431372549019605,\"latitude\":-29.8064128,\"longitude\":30.7717632,\"position_type\":\"GPS fix\",\"status\":{\"mode\":{\"code\":1,\"description\":\"Motion tracking\"},\"moving\":false,\"on_demand\":false,\"periodic\":false,\"sos\":false,\"tracking\":true},\"temperature\":18.22,\"type\":\"POSITION\"},\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"on-the-hill-01\",\"eui\":\"00800000A000104F\"},\"timestamp\":1450556283,\"rssi\":-69,\"channel_rssi\":-69,\"snr\":9.2,\"uplink_token\":\"ChwKGgoOb24tdGhlLWhpbGwtMDESCACAAACgABBPEPv21rMFGgwIqZbqhQYQ29ee1AEg+LCR35uSCA==\",\"channel_index\":3}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7}},\"data_rate_index\":5,\"coding_rate\":\"4/5\",\"frequency\":\"867100000\",\"timestamp\":1450556283},\"received_at\":\"2021-06-04T20:20:57.450903305Z\",\"consumed_airtime\":\"0.061696s\",\"version_ids\":{\"brand_id\":\"abeeway\",\"model_id\":\"abeeway-micro-tracker\",\"hardware_version\":\"3.0\",\"firmware_version\":\"2.1\",\"band_id\":\"EU_863_870\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"a2af7ddd.ce9ed\",\"_event\":\"node:5328b1c5.bdf71\"}","payloadType":"json","x":430,"y":420,"wires":[["bbb65838.011fa8"]]},{"id":"609396c6.5b3838","type":"inject","z":"c25b4176.1ca91","name":"Payload 1 Decoded","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"v3/abeeway-sotracker@ttn/devices/micro-t1-20635f01080022c6/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"micro-t1-20635f01080022c6\",\"application_ids\":{\"application_id\":\"abeeway-sotracker\"},\"dev_eui\":\"20635F01080022C6\",\"join_eui\":\"20635F0001000013\",\"dev_addr\":\"260BABFF\"},\"correlation_ids\":[\"as:up:01F7CAV78YACQ40ATT0CQQ07BC\",\"gs:conn:01F7B8TDXH4VC1JVA13M0NKZ4T\",\"gs:up:host:01F7B8TDXQ1Z4Y8BNQZK8ME9DC\",\"gs:uplink:01F7CAV72BZA6SP9V34FXG1TRH\",\"ns:uplink:01F7CAV72FF2CBSNZT089TT44D\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F7CAV72FNN655E6Y78T4PKGR\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01F7CAV78XM0ZJVSAKTK0DCAE6\"],\"received_at\":\"2021-06-04T20:18:47.198927761Z\",\"uplink_message\":{\"session_key_id\":\"AXnOdrdVT43saIPKQWgElQ==\",\"f_port\":17,\"f_cnt\":318,\"frm_payload\":\"CiyzejAB\",\"decoded_payload\":{\"ack\":3,\"battery\":3.78,\"data\":0,\"debug\":{\"length\":6,\"payload\":\"0a2cb37a3001\",\"port\":17,\"server_time\":\"2021-06-04T20:18:47.200Z\"},\"error\":{\"code\":0,\"description\":\"UNSUPPORTED MESSAGE TYPE 10\"},\"status\":{\"mode\":{\"code\":1,\"description\":\"Motion tracking\"},\"moving\":true,\"on_demand\":false,\"periodic\":false,\"sos\":false,\"tracking\":true},\"temperature\":17.72},\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"on-the-hill-01\",\"eui\":\"00800000A000104F\"},\"timestamp\":1320097987,\"rssi\":-75,\"channel_rssi\":-75,\"snr\":9.5,\"uplink_token\":\"ChwKGgoOb24tdGhlLWhpbGwtMDESCACAAACgABBPEMOxvPUEGgwIppXqhQYQiN7M1gMguPPi37WOCA==\"}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7}},\"data_rate_index\":5,\"coding_rate\":\"4/5\",\"frequency\":\"868100000\",\"timestamp\":1320097987},\"received_at\":\"2021-06-04T20:18:46.991259908Z\",\"consumed_airtime\":\"0.051456s\",\"version_ids\":{\"brand_id\":\"abeeway\",\"model_id\":\"abeeway-micro-tracker\",\"hardware_version\":\"3.0\",\"firmware_version\":\"2.1\",\"band_id\":\"EU_863_870\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"5c67abb7.1c8d14\",\"_event\":\"node:5328b1c5.bdf71\"}","payloadType":"json","x":430,"y":380,"wires":[["bbb65838.011fa8"]]},{"id":"bbb65838.011fa8","type":"change","z":"c25b4176.1ca91","name":"Payload Switch","rules":[{"t":"move","p":"payload.topic","pt":"msg","to":"topic","tot":"msg"},{"t":"move","p":"payload.payload","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":280,"wires":[["dc88a040.3194f"]]}]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.