Working with Comma Separated Data Stream

#1

I am feeding a data stream from a weigh scale. The scale allows me to separate the predefined variable by ",". The data variables are set up in the scale enclosed in <>, (i.e. ,,,. ) I am feeding into a Split node and in the debug window I can see each of the variables values. I want to send each variable to a different Gauge in the Dashboard. Any suggestions on how to access these values individually?

Thanks

0 Likes

#2

Do you have an actual example of a full "blob" of data ? Does it come in "lines" ?

0 Likes

#3

This is a snip of the command window I have the debug node connected to the output of the TCP node.

0 Likes

#4

You can see the 3 variables I am trying to work with. One is the 15 tn/hr, the second is the daily total of about 805 and the third is the master total of about 239924.

0 Likes

#5

You said the values were separated by commas -- yet your debug shows each value in its own msg. Is this debug output actually AFTER the split node?

What output options are you using in the tcp in node? If you export your flow and include it between two lines with only 3 backtics (```), then we can import the flow and try in our own environments...

0 Likes

#6

image

The debug was right after the TCP node. I will attempt to export in a different reply.

0 Likes

#7
[{"id":"8de68d01.1cee9","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"c074a51b.e1cb68","type":"tcp in","z":"8de68d01.1cee9","name":"Secondary Belt Scale","server":"client","host":"10.0.31.113","port":"502","datamode":"stream","datatype":"utf8","newline":"","topic":"Scale","base64":false,"x":180,"y":460,"wires":[["7b063bc4.049154"]],"outputLabels":["Weight"]},{"id":"7b063bc4.049154","type":"split","z":"8de68d01.1cee9","name":"","splt":",","spltType":"str","arraySplt":"5","arraySpltType":"len","stream":true,"addname":"","x":430,"y":460,"wires":[["f8079988.2b9a18"]]},{"id":"f50d455.d5cf5b8","type":"ui_chart","z":"8de68d01.1cee9","name":"","group":"4da77d47.8e8fb4","order":2,"width":"6","height":"6","label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"250","ymax":"400","removeOlder":"20","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":870,"y":300,"wires":[[],[]]},{"id":"f8079988.2b9a18","type":"switch","z":"8de68d01.1cee9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"tn","vt":"str"},{"t":"btwn","v":"0","vt":"num","v2":"3000","v2t":"num"},{"t":"gt","v":"3000","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":710,"y":460,"wires":[["d2317820.6cbd28","8dcccb13.4b9968","f50d455.d5cf5b8"],["de5065fe.2c5638","3376c66c.aadb0a"],["fdb8d612.21f338","1679a80f.54c5a8"]]},{"id":"d2317820.6cbd28","type":"debug","z":"8de68d01.1cee9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":890,"y":340,"wires":[]},{"id":"de5065fe.2c5638","type":"debug","z":"8de68d01.1cee9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":930,"y":460,"wires":[]},{"id":"fdb8d612.21f338","type":"debug","z":"8de68d01.1cee9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":890,"y":560,"wires":[]},{"id":"1679a80f.54c5a8","type":"ui_gauge","z":"8de68d01.1cee9","name":"","group":"4da77d47.8e8fb4","order":0,"width":0,"height":0,"gtype":"gage","title":"MASTER TOTAL","label":"units","format":"{{value}}","min":0,"max":"3000000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":910,"y":600,"wires":[]},{"id":"3376c66c.aadb0a","type":"ui_gauge","z":"8de68d01.1cee9","name":"","group":"4da77d47.8e8fb4","order":0,"width":0,"height":0,"gtype":"gage","title":"DAILY TOTAL","label":"units","format":"{{value}}","min":0,"max":"4000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":950,"y":500,"wires":[]},{"id":"8dcccb13.4b9968","type":"ui_gauge","z":"8de68d01.1cee9","name":"","group":"4da77d47.8e8fb4","order":0,"width":0,"height":0,"gtype":"gage","title":"TPH","label":"units","format":"{{value}}","min":0,"max":"600","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":880,"y":400,"wires":[]},{"id":"4da77d47.8e8fb4","type":"ui_group","z":"","name":"Secondary Belt Scale","tab":"d562cb38.4360c8","order":1,"disp":true,"width":"6"},{"id":"d562cb38.4360c8","type":"ui_tab","z":"","name":"Tower","icon":"dashboard","order":2}]

0 Likes

#8

I was able to configure the switch node to do what I was looking for, of course it will only work once the values are large enough. If I were to reset to zero each day, the second two outputs would be confused.

0 Likes

#9

Were you able to run what I sent?

0 Likes

#10

Yes, but as I don't have the raw data stream, it's not easy to test.

It looks like the tcp in node is breaking up your data based on some number of bytes or random chunks of time... instead of using "stream" mode, try specifying a "single string" payload, and remove the split node. Then we can take a look at the msg.payloads and deal with splitting the values into separate msgs, using the csv node (if the order of values is always the same).

0 Likes

#11

When I set the tcp in node to single string, nothing seems to get through to the debug node, so I am not able to get a snap shot of what the string looks like using that method. Any other thoughts?

0 Likes

#12

Maybe try a different separator for the line output mode. Maybe \r rather than \n ?

0 Likes