I'm pulling in data 1 character per register over modbus. And it looks like this
How do i combine these decimals together, and spit out the message in ASCII? And then I need to display it on the dashboard.
I'm pulling in data 1 character per register over modbus. And it looks like this
How do i combine these decimals together, and spit out the message in ASCII? And then I need to display it on the dashboard.
Look very ambiguous as to what you have is it an array or buffer?
From array using JS in function node.
msg.payload = String.fromCharCode.apply(null, msg.payload);
returns HILSCHYW
When supplying data it is best to supply text. You can gain this by using the copy value in the debug sidebar
There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value for any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

Then paste in thread using
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)
```
code goes here
```
You can edit and correct your post by clicking the pencil
icon.
See this post for more details - How to share code or flow json
Or have a look at node-red-contrib-buffer-parser (node) - Node-RED
Thanks. This is what I have so far.
[
{
"id": "b9d76657be281509",
"type": "function",
"z": "6a32a593.d9b52c",
"name": "function 7",
"func": "msg.payload = String.fromCharCode.apply(null, msg.payload);\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1160,
"y": 400,
"wires": [
[
"8c98c667f6facbbb",
"0998a5d4af6ea6ef"
]
]
},
{
"id": "8c98c667f6facbbb",
"type": "debug",
"z": "6a32a593.d9b52c",
"name": "debug 20",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 1320,
"y": 420,
"wires": []
},
{
"id": "0998a5d4af6ea6ef",
"type": "ui-text",
"z": "6a32a593.d9b52c",
"group": "48c8e79a24d4f0fd",
"order": 0,
"width": 0,
"height": 0,
"name": "",
"label": "",
"format": "{{msg.payload}}",
"layout": "row-spread",
"style": false,
"font": "",
"fontSize": 16,
"color": "#717171",
"wrapText": false,
"className": "",
"value": "payloads",
"valueType": "msg",
"x": 1310,
"y": 360,
"wires": []
},
{
"id": "5f0dee67d36441cb",
"type": "modbus-read",
"z": "6a32a593.d9b52c",
"name": "PLC-READ",
"topic": "PLC",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"showWarnings": true,
"unitid": "1",
"dataType": "InputRegister",
"adr": "222",
"quantity": "3",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"enableDeformedMessages": false,
"startDelayTime": "",
"server": "bf81420f.323c4",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 950,
"y": 420,
"wires": [
[
"b173d0bf6cc20683",
"b9d76657be281509"
],
[]
]
},
{
"id": "b173d0bf6cc20683",
"type": "debug",
"z": "6a32a593.d9b52c",
"name": "debug 21",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1100,
"y": 340,
"wires": []
},
{
"id": "48c8e79a24d4f0fd",
"type": "ui-group",
"name": "STATUS",
"page": "8b20a6d5d1ae7cd3",
"width": "12",
"height": 1,
"order": 4,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": false,
"groupType": "default"
},
{
"id": "bf81420f.323c4",
"type": "modbus-client",
"name": "PLC",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": false,
"tcpHost": "192.168.0.10",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "",
"unit_id": 1,
"commandDelay": 1,
"clientTimeout": 1000,
"reconnectOnTimeout": true,
"reconnectTimeout": 2000,
"parallelUnitIdsAllowed": true,
"showErrors": false,
"showWarnings": true,
"showLogs": true
},
{
"id": "8b20a6d5d1ae7cd3",
"type": "ui-page",
"name": "Page 1",
"ui": "ff48cd83ca1ae463",
"path": "/page1",
"icon": "home",
"layout": "grid",
"theme": "f7b447c2f12c78b5",
"breakpoints": [
{
"name": "Default",
"px": "0",
"cols": "3"
},
{
"name": "Tablet",
"px": "576",
"cols": "6"
},
{
"name": "Small Desktop",
"px": "800",
"cols": "3"
},
{
"name": "Desktop",
"px": "1024",
"cols": "12"
},
{
"name": "",
"px": "",
"cols": ""
}
],
"order": 1,
"className": "",
"visible": true,
"disabled": false
},
{
"id": "ff48cd83ca1ae463",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": [
"ui-notification",
"ui-control"
],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showReconnectNotification": true,
"notificationDisplayTime": 1,
"showDisconnectNotification": true,
"allowInstall": false
},
{
"id": "f7b447c2f12c78b5",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094CE",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"density": "default",
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px"
}
},
{
"id": "6937d8b37ae8dbe4",
"type": "global-config",
"env": [],
"modules": {
"@flowfuse/node-red-dashboard": "1.29.0",
"node-red-contrib-modbus": "5.45.2"
}
}
]
So I'm reading modbus into the function block, I can see the return message is correct via the debug node. But my display text is just blank. I think it just wants to display what's in the label field. I want to display that returned message.
Thoughts?
It is still ambiguous as to what your msg.payload is, you still have not supplied it.
You might want to try node-red-contrib-buffer-parser. It is designed for PLC type data conversions.
Demo flow (import it using CTRL-I)
[{"id":"78c86fd55843c975","type":"buffer-maker","z":"8ed63487b1358a63","name":"fake modbus read","specification":"spec","specificationType":"ui","items":[{"name":"item1","type":"uint8","length":1,"dataType":"num","data":"72"},{"name":"item2","type":"uint8","length":1,"dataType":"num","data":"73"},{"name":"item3","type":"uint8","length":1,"dataType":"num","data":"76"},{"name":"item4","type":"uint8","length":1,"dataType":"num","data":"83"},{"name":"item5","type":"uint8","length":1,"dataType":"num","data":"67"},{"name":"item6","type":"uint8","length":1,"dataType":"num","data":"72"},{"name":"item7","type":"uint8","length":1,"dataType":"num","data":"69"},{"name":"item8","type":"uint8","length":1,"dataType":"num","data":"82"},{"name":"item6","type":"uint16be","length":1,"dataType":"num","data":"32770"}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","x":1570,"y":160,"wires":[["830662bcf54ddd0c","e0df0f9abec67347"]]},{"id":"3fbccca92dd566f2","type":"inject","z":"8ed63487b1358a63","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1380,"y":160,"wires":[["78c86fd55843c975"]]},{"id":"830662bcf54ddd0c","type":"debug","z":"8ed63487b1358a63","name":"debug 16","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1780,"y":160,"wires":[]},{"id":"e0df0f9abec67347","type":"buffer-parser","z":"8ed63487b1358a63","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"ascii","name":"state","offset":0,"length":6,"offsetbit":0,"scale":"1","mask":""},{"type":"bool","name":"auto","offset":7,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"bool","name":"manual","offset":7,"length":1,"offsetbit":1,"scale":"1","mask":""},{"type":"bool","name":"running","offset":7,"length":1,"offsetbit":10,"scale":"1","mask":""},{"type":"bool","name":"fault","offset":7,"length":1,"offsetbit":15,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":1550,"y":220,"wires":[["5b8739e0b6ce98e7"]]},{"id":"5b8739e0b6ce98e7","type":"debug","z":"8ed63487b1358a63","name":"parsed","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1770,"y":220,"wires":[]},{"id":"c95f7b6b775da3eb","type":"global-config","env":[],"modules":{"node-red-contrib-buffer-parser":"3.2.2"}}]
Couldn't you use the join node?
![]()