Splitting an API string then splitting the value of one of the object values

Noob struggling... I have an API call that I'm breaking into 4 value array's. One of the value arrays has to be split in to 16 values and formatted. I then need to put it back in to one array to inject in to Influxdb. I can't figure out how to get the two messages back in to a single array. Not sure if I'm not formatting the join properly or what. Thanks in advance..

[{"id":"e0c1d920.451028","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ca6ed50f.ae4e28","type":"inject","z":"e0c1d920.451028","name":"Headers","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"10","topic":"","payload":"","payloadType":"str","x":100,"y":40,"wires":[["affc3c07.a0fa9","662500d4.79951"]]},{"id":"affc3c07.a0fa9","type":"change","z":"e0c1d920.451028","name":"Device","rules":[{"t":"set","p":"device_ip","pt":"flow","to":"192.168.0.164","tot":"str"},{"t":"set","p":"port","pt":"flow","to":"80","tot":"str"},{"t":"set","p":"rejectUnauthorized","pt":"flow","to":"false","tot":"bool"},{"t":"set","p":"device_IP","pt":"msg","to":"device_ip","tot":"flow"},{"t":"set","p":"devicePort","pt":"msg","to":"port","tot":"flow"},{"t":"set","p":"method","pt":"msg","to":"get","tot":"str"},{"t":"set","p":"rejectUnauthorized","pt":"msg","to":"rejectUnauthorized","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":40,"wires":[["f321032d.74908"]]},{"id":"f321032d.74908","type":"http request","z":"e0c1d920.451028","name":"ECY Rest","method":"use","ret":"obj","paytoqs":"ignore","url":"http://{{{device_IP}}}:{{{devicePort}}}/api/rest/v1/info/bacnet","tls":"","persist":false,"proxy":"","authType":"basic","x":400,"y":40,"wires":[["9288cac.e213138"]]},{"id":"9288cac.e213138","type":"change","z":"e0c1d920.451028","name":"Headers","rules":[{"t":"set","p":"deviceIp","pt":"flow","to":"device_IP","tot":"msg"},{"t":"set","p":"deviceInstance","pt":"flow","to":"payload.deviceInstance","tot":"msg"},{"t":"set","p":"description","pt":"flow","to":"payload.description","tot":"msg"},{"t":"set","p":"headers","pt":"flow","to":"headers[\"set-cookie\"][0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":40,"wires":[[]]},{"id":"fd75460e.fbf3c8","type":"change","z":"e0c1d920.451028","name":"Device","rules":[{"t":"set","p":"device_ip","pt":"flow","to":"192.168.0.164","tot":"str"},{"t":"set","p":"port","pt":"flow","to":"80","tot":"str"},{"t":"set","p":"rejectUnauthorized","pt":"flow","to":"false","tot":"bool"},{"t":"set","p":"device_IP","pt":"msg","to":"device_ip","tot":"flow"},{"t":"set","p":"devicePort","pt":"msg","to":"port","tot":"flow"},{"t":"set","p":"method","pt":"msg","to":"post","tot":"str"},{"t":"set","p":"rejectUnauthorized","pt":"msg","to":"rejectUnauthorized","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"{\"encode\":\"text\",\"propertyReferences\":[{\"type\":\"analogValue\",\"instance\":-1,\"property\":\"objectName\",\"arrayIndex\":-1},{\"type\":\"analogValue\",\"instance\":-1,\"property\":\"objectType\",\"arrayIndex\":-1},{\"type\":\"analogValue\",\"instance\":-1,\"property\":\"presentValue\",\"arrayIndex\":-1},{\"type\":\"analogValue\",\"instance\":-1,\"property\":\"priorityArray\",\"arrayIndex\":-1}]}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":100,"wires":[["f2bf9c0d.d199d"]]},{"id":"f2bf9c0d.d199d","type":"http request","z":"e0c1d920.451028","name":"ECY Rest","method":"use","ret":"obj","paytoqs":"ignore","url":"http://{{{device_IP}}}:{{{devicePort}}}/api/rest/v1/protocols/bacnet/local/objects/read-property-multiple","tls":"","persist":false,"proxy":"","authType":"basic","x":400,"y":100,"wires":[["d2cd0080.0ead4"]]},{"id":"662500d4.79951","type":"delay","z":"e0c1d920.451028","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":100,"y":100,"wires":[["fd75460e.fbf3c8"]]},{"id":"5bdf659f.2f86bc","type":"split","z":"e0c1d920.451028","name":"","splt":",","spltType":"str","arraySplt":"4","arraySpltType":"len","stream":false,"addname":"topic","x":690,"y":100,"wires":[["4120a10.5f6f86","dc3b3d3c.79e9c"]]},{"id":"cf5f3da0.8bbd6","type":"debug","z":"e0c1d920.451028","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":280,"wires":[]},{"id":"d2cd0080.0ead4","type":"function","z":"e0c1d920.451028","name":"topic","func":"var tag = msg.payload[0].value+'_'+msg.payload[0].type+'_'+msg.payload[0].instance;\nmsg.topic = tag;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":100,"wires":[["5bdf659f.2f86bc"]]},{"id":"4120a10.5f6f86","type":"change","z":"e0c1d920.451028","name":"Msg Cleanup","rules":[{"t":"change","p":"payload[3].value","pt":"msg","from":"{","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload[3].value","pt":"msg","from":"}","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload[3].value","pt":"msg","from":"null=","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload[3].value","pt":"msg","from":"real=","fromt":"str","to":"","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload[3].value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":110,"y":160,"wires":[["29b92821.a35e18"]]},{"id":"29b92821.a35e18","type":"split","z":"e0c1d920.451028","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":270,"y":160,"wires":[["e8091a65.7b9bf8"]]},{"id":"6ba9268c.987bc8","type":"join","z":"e0c1d920.451028","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"16","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":570,"y":160,"wires":[["64759fb9.fa8dc"]]},{"id":"dc3b3d3c.79e9c","type":"function","z":"e0c1d920.451028","name":"NumConv","func":"switch(msg.payload[2].value)\n{\n    case \"Null\" : msg.payload[2].value = -1; break;\n    default     : msg.payload[2].value = presentValue = Number(msg.payload[2].value)\n}\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":840,"y":100,"wires":[["f5bc9566.465a58"]]},{"id":"e8091a65.7b9bf8","type":"function","z":"e0c1d920.451028","name":"NumConv","func":"switch(msg.payload)\n{\n    case \"Null\" : msg.payload = \"Normal\"; break;\n}\nreturn msg;\n//     case \"Null\" : msg.payload = null; break;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":160,"wires":[["6ba9268c.987bc8"]]},{"id":"f5bc9566.465a58","type":"change","z":"e0c1d920.451028","name":"","rules":[{"t":"set","p":"pointName","pt":"flow","to":"payload[0].value","tot":"msg"},{"t":"set","p":"pointType","pt":"flow","to":"payload[1].value","tot":"msg"},{"t":"set","p":"pointInstance","pt":"flow","to":"payload[0].instance","tot":"msg"},{"t":"set","p":"pointValue","pt":"flow","to":"payload[2].value","tot":"msg"},{"t":"set","p":"topic","pt":"flow","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":100,"wires":[["cf5f3da0.8bbd6"]]},{"id":"64759fb9.fa8dc","type":"change","z":"e0c1d920.451028","name":"Naming","rules":[{"t":"set","p":"priority1","pt":"flow","to":"payload[0]","tot":"msg"},{"t":"set","p":"priority2","pt":"flow","to":"payload[1]","tot":"msg"},{"t":"set","p":"priority3","pt":"flow","to":"payload[2]","tot":"msg"},{"t":"set","p":"priority4","pt":"flow","to":"payload[3]","tot":"msg"},{"t":"set","p":"priority5","pt":"flow","to":"payload[4]","tot":"msg"},{"t":"set","p":"priority6","pt":"flow","to":"payload[5]","tot":"msg"},{"t":"set","p":"priority7","pt":"flow","to":"payload[6]","tot":"msg"},{"t":"set","p":"priority8","pt":"flow","to":"payload[7]","tot":"msg"},{"t":"set","p":"priority9","pt":"flow","to":"payload[8]","tot":"msg"},{"t":"set","p":"priority10","pt":"flow","to":"payload[9]","tot":"msg"},{"t":"set","p":"priority11","pt":"flow","to":"payload[10]","tot":"msg"},{"t":"set","p":"priority12","pt":"flow","to":"payload[11]","tot":"msg"},{"t":"set","p":"priority13","pt":"flow","to":"payload[12]","tot":"msg"},{"t":"set","p":"priority14","pt":"flow","to":"payload[13]","tot":"msg"},{"t":"set","p":"priority15","pt":"flow","to":"payload[14]","tot":"msg"},{"t":"set","p":"priority16","pt":"flow","to":"payload[15]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":160,"wires":[["cf5f3da0.8bbd6"]]}]


image

I have made this flow work with a single point set but can't get it working doing a multiple point call.

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