Modbus TCP Multi Data Type

Hello Folks,

I hope you`re all having an epic day.

I am currently trying to read a tcp register however the tcp register has different data types. What I am finding is that the TCP read wont work (yet still show active) if you have multiple data types in the TCP register. The modbus response node shows "initialized" only.

Is there any way around this? Ideally I would like Bool and Uint data in my TCP and read all together.

Thank you.

Ed

Hi Ed,
There is a node called buffer parser that does what you need.

Someone gave me this example, I hope it help you.

[{"id":"a15ab1d7.fa063","type":"tab","label":"Strom","disabled":false,"info":""},{"id":"fa8953c2.b8e12","type":"function","z":"a15ab1d7.fa063","name":"Request","func":"msg.payload = { value: msg.payload,\n'fc': 3,\n'unitid': 255, \n'address': 50520 , \n'quantity': 24 }; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":38.00000762939453,"wires":[["4655e9ec.33a088"]]},{"id":"4655e9ec.33a088","type":"modbus-flex-getter","z":"a15ab1d7.fa063","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"d2648ef7.bf3c6","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":134.99998474121094,"y":94.00000762939453,"wires":[[],["6582ed29.ff8cbc"]]},{"id":"397df8c7.ed4e68","type":"inject","z":"a15ab1d7.fa063","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":101,"y":38.00000762939453,"wires":[["fa8953c2.b8e12"]]},{"id":"6582ed29.ff8cbc","type":"buffer-parser","z":"a15ab1d7.fa063","name":"","data":"payload.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint32be","name":"L1U","offset":0,"length":1,"offsetbit":0,"scale":"0.01","mask":""},{"type":"uint32be","name":"L2U","offset":4,"length":1,"offsetbit":0,"scale":"0.01","mask":""},{"type":"uint32be","name":"L3U","offset":8,"length":1,"offsetbit":0,"scale":"0.01","mask":""},{"type":"uint32be","name":"freq","offset":12,"length":1,"offsetbit":0,"scale":"0.01","mask":""},{"type":"uint32be","name":"L1I","offset":16,"length":1,"offsetbit":0,"scale":"0.001","mask":""},{"type":"uint32be","name":"L2I","offset":20,"length":1,"offsetbit":0,"scale":"0.001","mask":""},{"type":"uint32be","name":"L3I","offset":24,"length":1,"offsetbit":0,"scale":"0.001","mask":""},{"type":"uint32be","name":"NI","offset":28,"length":1,"offsetbit":0,"scale":"0.001","mask":""},{"type":"int32be","name":"Pwirk","offset":32,"length":1,"offsetbit":0,"scale":"10","mask":""},{"type":"int32be","name":"Pblind","offset":36,"length":1,"offsetbit":0,"scale":"10","mask":""},{"type":"uint32be","name":"Pschein","offset":40,"length":1,"offsetbit":0,"scale":"10","mask":""},{"type":"int32be","name":"CosPhi","offset":44,"length":1,"offsetbit":0,"scale":"0.001","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":117.33335876464844,"y":154,"wires":[["9c5cad1a.58afa"]]},{"id":"6f1557fc.95083","type":"debug","z":"a15ab1d7.fa063","name":"U L1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":382.25,"y":83.66666412353516,"wires":[]},{"id":"899a3e5b.c52768","type":"debug","z":"a15ab1d7.fa063","name":"U L2","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":381.16668701171875,"y":131.1666259765625,"wires":[]},{"id":"913fca98.cc7ff","type":"debug","z":"a15ab1d7.fa063","name":"U L3","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":384.16668701171875,"y":179.1666259765625,"wires":[]},{"id":"9c5cad1a.58afa","type":"split","z":"a15ab1d7.fa063","name":"split","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":95.16667175292969,"y":303.1666564941406,"wires":[["6c7bbfa5.65c64"]]},{"id":"6c7bbfa5.65c64","type":"switch","z":"a15ab1d7.fa063","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"L1U","vt":"str"},{"t":"eq","v":"L2U","vt":"str"},{"t":"eq","v":"L3U","vt":"str"},{"t":"eq","v":"freq","vt":"str"},{"t":"eq","v":"L1I","vt":"str"},{"t":"eq","v":"L2I","vt":"str"},{"t":"eq","v":"L3I","vt":"str"},{"t":"eq","v":"NI","vt":"str"},{"t":"eq","v":"Pwirk","vt":"str"},{"t":"eq","v":"Pblind","vt":"str"},{"t":"eq","v":"Pschein","vt":"str"},{"t":"eq","v":"CosPhi","vt":"str"}],"checkall":"true","repair":false,"outputs":12,"x":216.1666717529297,"y":303.1666564941406,"wires":[["6f1557fc.95083"],["899a3e5b.c52768"],["913fca98.cc7ff"],["82b25fcc.a8ee1"],["c5814a0a.4b2368"],["8d344eb7.a562d8"],["ce2baa05.9eee2"],["fd10ceaf.d93808"],["37435e9c.554a5a"],["c4ce9b38.9199f"],["d9c605bf.16bd68"],["a9eb333d.ec6f4"]]},{"id":"82b25fcc.a8ee1","type":"debug","z":"a15ab1d7.fa063","name":"Hz","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":384.16668701171875,"y":227.16665649414062,"wires":[]},{"id":"c5814a0a.4b2368","type":"debug","z":"a15ab1d7.fa063","name":"I L1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":382.16668701171875,"y":275.1666564941406,"wires":[]},{"id":"8d344eb7.a562d8","type":"debug","z":"a15ab1d7.fa063","name":"I L2","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":385.0833740234375,"y":324.6666259765625,"wires":[]},{"id":"ce2baa05.9eee2","type":"debug","z":"a15ab1d7.fa063","name":"I L3","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":382.0833740234375,"y":371.6666259765625,"wires":[]},{"id":"fd10ceaf.d93808","type":"debug","z":"a15ab1d7.fa063","name":"N L3","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":385.0833740234375,"y":421.6666564941406,"wires":[]},{"id":"37435e9c.554a5a","type":"debug","z":"a15ab1d7.fa063","name":"P Wirk","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":388.16668701171875,"y":473.1666564941406,"wires":[]},{"id":"c4ce9b38.9199f","type":"debug","z":"a15ab1d7.fa063","name":"P Blind","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":399.0833740234375,"y":521.6666259765625,"wires":[]},{"id":"d9c605bf.16bd68","type":"debug","z":"a15ab1d7.fa063","name":"P Schein","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":400.0833740234375,"y":572.6666259765625,"wires":[]},{"id":"a9eb333d.ec6f4","type":"debug","z":"a15ab1d7.fa063","name":"Cos Phi","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":400.0833740234375,"y":623.6666870117188,"wires":[]},{"id":"d2648ef7.bf3c6","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

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