[ { "id": "6dbccc6b.fce8fc", "type": "debug", "z": "a8145098.de8008", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "x": 510, "y": 60, "wires": [] }, { "id": "af9f6255.823f28", "type": "inject", "z": "a8145098.de8008", "name": "", "topic": "", "payload": "UPC", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 110, "y": 60, "wires": [ [ "a55566a5.2a3568" ] ] }, { "id": "8967d6e3.dd2a5", "type": "inject", "z": "a8145098.de8008", "name": "", "topic": "", "payload": "School", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 110, "y": 100, "wires": [ [ "a55566a5.2a3568" ] ] }, { "id": "a55566a5.2a3568", "type": "function", "z": "a8145098.de8008", "name": "-> downlink", "func": "var b = new Buffer(msg.payload);\nmsg.payload = b.toString('base64');\n\nmsg.payload = {\n port: 1,\n confirmed: false,\n payload_raw: msg.payload\n};\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 300, "y": 80, "wires": [ [ "6dbccc6b.fce8fc", "69533d25.90173c" ] ] }, { "id": "69533d25.90173c", "type": "mqtt out", "z": "a8145098.de8008", "name": "", "topic": "lora-upc-school/devices/proto01/down", "qos": "2", "retain": "false", "broker": "76f3379d.096228", "x": 610, "y": 100, "wires": [] }, { "id": "921b3357.a17048", "type": "mqtt in", "z": "a8145098.de8008", "name": "", "topic": "#", "qos": "2", "broker": "76f3379d.096228", "x": 130, "y": 380, "wires": [ [] ] }, { "id": "9aafef5c.eb8a2", "type": "function", "z": "a8145098.de8008", "name": "Base64 -> str", "func": "var b = new Buffer(msg.payload, 'base64');\nmsg.payload = b.toString('hex');\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 180, "y": 300, "wires": [ [ "d1c96627.8344", "188b1106.8edb2f" ] ] }, { "id": "94be5b9a.e1e1c", "type": "function", "z": "a8145098.de8008", "name": "payload_raw", "func": "msg.payload = msg.payload.payload_raw;\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 530, "y": 200, "wires": [ [ "9aafef5c.eb8a2" ] ] }, { "id": "a564f193.64eae", "type": "mqtt in", "z": "a8145098.de8008", "name": "", "topic": "lora-upc-school/devices/proto01/up", "qos": "2", "broker": "15058d0e.d59fc3", "x": 180, "y": 200, "wires": [ [ "9c5ad6de.5a585" ] ] }, { "id": "be3a1329.f97678", "type": "debug", "z": "a8145098.de8008", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 430, "y": 380, "wires": [] }, { "id": "d1c96627.8344", "type": "function", "z": "a8145098.de8008", "name": "Array -> T,P,H", "func": "function parseFloat(str) {\n var float = 0, sign, order, mantiss,exp,\n int = 0, multi = 1;\n if (/^0x/.exec(str)) {\n int = parseInt(str,16);\n }else{\n for (var i = str.length -1; i >=0; i -= 1) {\n if (str.charCodeAt(i)>255) {\n console.log('Wrong string parametr'); \n return false;\n }\n int += str.charCodeAt(i) * multi;\n multi *= 256;\n }\n }\n sign = (int>>>31)?-1:1;\n exp = (int >>> 23 & 0xff) - 127;\n mantissa = ((int & 0x7fffff) + 0x800000).toString(2);\n for (i=0; i