BiancoRoyal/node-red-contrib-modbus

Modbus Server on Node Red / Reading data with Modbus Poll

kristjanhaukur opened this issue · 1 comments

I am planning to use Node Red as a gateway between REST API on one hand and a SCADA system on the other. Node Red is requesting data from the API, parsing it and exposing on Modbus TCP, making it available for the SCADA (older generation).

Testing only the Modbus side of things, I set up a simple flow writing data to input and holding registers of the Modbus Server. The server output seems to confirm data in the server buffers (which is the same as registers, right?)

I can connect Modbus Poll to the Modbus server on Node Red (localhost:10502) but I am reading zero values from all the registers I thought I just changed. Why am I not reading any data from the Modbus Server? Anyone care to assist a Node Red newbie in this forum?

[ { "id": "c5f09feacedfada2", "type": "modbus-server", "z": "83388a94f9857f93", "name": "Modbus Server", "logEnabled": false, "hostname": "127.0.0.1", "serverPort": 10502, "responseDelay": 100, "delayUnit": "ms", "coilsBufferSize": 10000, "holdingBufferSize": 10000, "inputBufferSize": 10000, "discreteBufferSize": 10000, "showErrors": false, "x": 500, "y": 500, "wires": [ [ "90f9e6046c0ea96f" ], [ "90f9e6046c0ea96f" ], [ "90f9e6046c0ea96f" ], [ "90f9e6046c0ea96f" ], [] ] }, { "id": "3dbb34c00d6d0120", "type": "function", "z": "83388a94f9857f93", "name": "Set Payload", "func": "msg.payload = {\n 'value': [5,84,36,98,140,312,214,166], \n 'register': 'input', \n 'address': 0 , \n 'disableMsgOutput' : 0 \n}; \nreturn msg;\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 250, "y": 500, "wires": [ [ "c5f09feacedfada2" ] ] }, { "id": "fbe5274fd3d0f5ea", "type": "inject", "z": "83388a94f9857f93", "name": "Start", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 90, "y": 500, "wires": [ [ "3dbb34c00d6d0120" ] ] }, { "id": "90f9e6046c0ea96f", "type": "debug", "z": "83388a94f9857f93", "name": "Debug server", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 800, "y": 500, "wires": [] }, { "id": "84105bcad97f0fcb", "type": "modbus-flex-write", "z": "83388a94f9857f93", "name": "", "showStatusActivities": false, "showErrors": false, "showWarnings": true, "server": "48496f3b.10762", "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 510, "y": 600, "wires": [ [], [] ] }, { "id": "329c01cf23a7d62a", "type": "function", "z": "83388a94f9857f93", "name": "function 2", "func": "msg.payload = {\n value: [100,90,100,200,100,200],\n 'fc': 16,\n 'unitid': 1,\n 'address': 0,\n 'quantity': 6\n};\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 300, "y": 600, "wires": [ [ "84105bcad97f0fcb" ] ] }, { "id": "dcb6c0eece1ab024", "type": "inject", "z": "83388a94f9857f93", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 175, "y": 600, "wires": [ [ "329c01cf23a7d62a" ] ], "l": false }, { "id": "48496f3b.10762", "type": "modbus-client", "name": "local", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": false, "failureLogEnabled": false, "tcpHost": "127.0.0.1", "tcpPort": "10502", "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": false, "reconnectTimeout": 2000, "parallelUnitIdsAllowed": false } ]