[ { "id": "3ad07ff8.75293", "type": "debug", "z": "3a4e58f7.6f9718", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 490, "y": 160, "wires": [] }, { "id": "ee53941e.c04888", "type": "json", "z": "3a4e58f7.6f9718", "name": "", "property": "payload", "action": "", "pretty": false, "x": 330, "y": 160, "wires": [ [ "f4368bdb.6b85f8", "3ad07ff8.75293" ] ] }, { "id": "af150293.3e179", "type": "debug", "z": "3a4e58f7.6f9718", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 350, "y": 300, "wires": [] }, { "id": "a699bbec.66cc68", "type": "inject", "z": "3a4e58f7.6f9718", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"app_id\":\"ad-telecom\",\"dev_id\":\"adtelecom-0001\",\"hardware_serial\":\"002FCBDA509E7B85\",\"port\":1,\"counter\":3,\"payload_raw\":\"SGVsbG8sIHdvcmxkIQ==\",\"metadata\":{\"time\":\"2020-12-22T21:46:13.66822284Z\",\"frequency\":868.5,\"modulation\":\"LORA\",\"data_rate\":\"SF7BW125\",\"airtime\":61696000,\"coding_rate\":\"4/5\",\"gateways\":[{\"gtw_id\":\"eui-b827ebfffe875de4\",\"timestamp\":1261113099,\"time\":\"2020-12-22T21:46:13.643929Z\",\"channel\":2,\"rssi\":-37,\"snr\":7.2,\"rf_chain\":0,\"latitude\":41.40739,\"longitude\":2.19543,\"altitude\":40}]}}", "payloadType": "str", "x": 90, "y": 260, "wires": [ [ "ee53941e.c04888" ] ] }, { "id": "f4368bdb.6b85f8", "type": "function", "z": "3a4e58f7.6f9718", "name": "Repartidor", "func": "var keys = Object.keys(msg.payload);\n\nvar msgs = keys.map(function(key) {\n return {topic: key, payload: msg.payload[key] };\n})\n\nreturn [msgs];", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 480, "y": 200, "wires": [ [ "2291b341.6d7ccc" ] ] }, { "id": "2291b341.6d7ccc", "type": "switch", "z": "3a4e58f7.6f9718", "name": "", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", "v": "hardware_serial", "vt": "str" }, { "t": "eq", "v": "port", "vt": "str" }, { "t": "eq", "v": "counter", "vt": "str" }, { "t": "eq", "v": "payload_raw", "vt": "str" }, { "t": "eq", "v": "metadata", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 5, "x": 130, "y": 340, "wires": [ [], [], [], [ "ba54443d.748888", "d7da604d.7c22d" ], [] ] }, { "id": "ba54443d.748888", "type": "function", "z": "3a4e58f7.6f9718", "name": "Base64 -> HEX", "func": "var b = new Buffer(msg.payload, 'base64')\nmsg.payload = b.toString('hex')\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 320, "y": 340, "wires": [ [ "af150293.3e179", "a326aa3b.2d6fb8" ] ] }, { "id": "d7da604d.7c22d", "type": "debug", "z": "3a4e58f7.6f9718", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 310, "y": 380, "wires": [] }, { "id": "a326aa3b.2d6fb8", "type": "function", "z": "3a4e58f7.6f9718", "name": "Vector hexCar -> text", "func": "var vector = msg.payload\nvar value,cByte = \"\",szText = \"\"\nvar n = 0\n\nfor(var key in vector){\n value = vector[key]\n if(n<2){\n cByte += value\n }else{\n szText += String.fromCharCode(parseInt(cByte,16))\n n = 0\n cByte = value\n }\n n++\n}\nszText += String.fromCharCode(parseInt(cByte,16))\nmsg.payload = szText\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 560, "y": 340, "wires": [ [ "e79cecb2.c7d7b" ] ] }, { "id": "e79cecb2.c7d7b", "type": "debug", "z": "3a4e58f7.6f9718", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 530, "y": 400, "wires": [] }, { "id": "32daf65a.c75c2a", "type": "comment", "z": "3a4e58f7.6f9718", "name": "Habitualment no necessari", "info": "", "x": 570, "y": 300, "wires": [] }, { "id": "e1dadc63.f8c53", "type": "comment", "z": "3a4e58f7.6f9718", "name": "Exemple de pujada", "info": "Per a verificar la resta de nodes", "x": 110, "y": 220, "wires": [] }, { "id": "ba3c8cb8.90b01", "type": "mqtt in", "z": "3a4e58f7.6f9718", "name": "", "topic": "ad-telecom/devices/adtelecom-0001-abp/up", "qos": "2", "datatype": "auto", "broker": "1268def1.994291", "x": 180, "y": 100, "wires": [ [ "ee53941e.c04888" ] ] }, { "id": "1268def1.994291", "type": "mqtt-broker", "z": "", "name": "", "broker": "eu.thethings.network", "port": "1883", "clientid": "", "usetls": false, "compatmode": false, "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "closeTopic": "", "closeQos": "0", "closePayload": "", "willTopic": "", "willQos": "0", "willPayload": "" } ]