Modbus TCP variable split function code

Hi !!

what should be the function code to split Modbus read registers in Fred cloud.
I am able to read all the 10 registers in debug Messages in Fred cloud but unable to write function code to split the values to read in the dashboard.
please help

one method - try this [Announce] node-red-contrib-buffer-parser - V2.0.2

The buffer parser takes your array of data & turns it into named items of any format you need (float, signed integer, byte revered if necessary (often necessary with modbus))...

then you can access each named items value like this

image

then paste that into the dashboard items like this...
image

image

demo flow...

[{"id":"68dcb361.27d5bc","type":"buffer-parser","z":"284fa9c6.f473c6","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"item1","offset":"0","length":"1","offsetbit":"0","mask":""},{"type":"int16be","name":"item2","offset":"2","length":"1","offsetbit":"0","mask":""},{"type":"int16be","name":"item3","offset":"4","length":"1","offsetbit":"0","mask":""},{"type":"int16be","name":"item4","offset":"6","length":"1","offsetbit":"0","mask":""},{"type":"int16be","name":"item5","offset":"8","length":"1","offsetbit":"0","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"object","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":700,"y":540,"wires":[["ad8c8500.89fdd8","801b9f08.c2dcd","fa47c578.c6fdd8"]]},{"id":"5ad37cbb.990974","type":"inject","z":"284fa9c6.f473c6","name":"fake data","topic":"fake data","payload":"[12345,543321,31314,44444,71111,15243,43434,999]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":520,"y":540,"wires":[["68dcb361.27d5bc"]]},{"id":"ad8c8500.89fdd8","type":"debug","z":"284fa9c6.f473c6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":870,"y":540,"wires":[]},{"id":"801b9f08.c2dcd","type":"ui_text","z":"284fa9c6.f473c6","group":"9ff3d14a.12719","order":0,"width":0,"height":0,"name":"","label":"text","format":"{{payload.item1.value}}","layout":"row-spread","x":830,"y":640,"wires":[]},{"id":"fa47c578.c6fdd8","type":"ui_text","z":"284fa9c6.f473c6","group":"9ff3d14a.12719","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload.item2.value}}","layout":"row-spread","x":830,"y":680,"wires":[]},{"id":"9ff3d14a.12719","type":"ui_group","z":"","name":"Default","tab":"93ef5e6b.7382d","order":1,"disp":true,"width":"6","collapse":false},{"id":"93ef5e6b.7382d","type":"ui_tab","z":"","name":"STUFF","icon":"dashboard","disabled":false,"hidden":false}]

Thanks Steve..
Suggested node is works fine for local server..

But in FRED -Cloud Hosted Node-Red, no such node is available.
I think simple function code is helpful for splitting the Modbus read registers.

I've not used it. Does Fred env not able to access the flow library?

Dear Steve,

please find below details for your reference..
I have searching solution from last 3 days..but fail..
if possible please help to resolve the issue...

flow at local server:
flows (1).json (2.2 KB)

flow at Fred cloud hosted node red:
flows (2).json (376 Bytes)

Note: By default, payload will contain the data to be sent to, or received from FRED. The client can be configured to send or receive the entire message object as a JSON formatted string.

In lite mode selected services and node is available..

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