BiancoRoyal / node-red-contrib-modbus

maintained by PLUS for Node-RED - https://plus4nodered.com
https://www.npmjs.com/package/node-red-contrib-modbus
BSD 3-Clause "New" or "Revised" License
302 stars 110 forks source link

Disabling one modbus-read node will move other nodes to "closed" state #487

Open nagisa opened 3 months ago

nagisa commented 3 months ago

Which node-red-contrib-modbus version are you using?

5.41.0

What happened?

I have a couple modbus-read nodes that refer to the same server. Usually this works quite alright.

However, when modifying flows I tend to enable and disable nodes or groups of nodes sometimes. When I disable a modbus-read node, I notice that all the other nodes that associate themselves with the same modbus-server will move to a "closed" state and will stop reading from the server indefinitely (until node-red is restarted.)

Server

Modbus-Server Node

How can this be reproduced?

Example flow ```json [ { "id": "0e37c0f212591d47", "type": "modbus-read", "z": "d46d2bc29f86c250", "name": "Always running", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "0", "quantity": "1", "rate": "1", "rateUnit": "s", "delayOnStart": false, "startDelayTime": "", "server": "94d99994b72809c9", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 490, "y": 380, "wires": [ [ "a89e59cbbad53d59" ], [] ] }, { "id": "a75206a1b33c393c", "type": "modbus-read", "z": "d46d2bc29f86c250", "name": "Right-click > Node > Disable me!", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "1", "quantity": "1", "rate": "1", "rateUnit": "s", "delayOnStart": false, "startDelayTime": "", "server": "94d99994b72809c9", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 520, "y": 500, "wires": [ [ "5dfd9114971bee9f" ], [] ] }, { "id": "24bff9ce523ba95d", "type": "comment", "z": "d46d2bc29f86c250", "name": "Right-click and disable the node below.", "info": "", "x": 540, "y": 440, "wires": [] }, { "id": "a89e59cbbad53d59", "type": "debug", "z": "d46d2bc29f86c250", "name": "debug 37", "active": true, "tosidebar": false, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 680, "y": 380, "wires": [] }, { "id": "5dfd9114971bee9f", "type": "debug", "z": "d46d2bc29f86c250", "name": "debug 38", "active": true, "tosidebar": false, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 760, "y": 500, "wires": [] }, { "id": "84a2aed2a22b5929", "type": "modbus-server", "z": "d46d2bc29f86c250", "name": "", "logEnabled": false, "hostname": "127.0.0.1", "serverPort": 10502, "responseDelay": 100, "delayUnit": "ms", "coilsBufferSize": 10000, "holdingBufferSize": 10000, "inputBufferSize": 10000, "discreteBufferSize": 10000, "showErrors": false, "showStatusActivities": false, "x": 480, "y": 240, "wires": [ [], [], [], [], [] ] }, { "id": "66bc7cb59eb28303", "type": "comment", "z": "d46d2bc29f86c250", "name": "\"Deploy modified nodes\"", "info": "", "x": 500, "y": 560, "wires": [] }, { "id": "8e4ef4f6177cbd29", "type": "comment", "z": "d46d2bc29f86c250", "name": "Deploy this example", "info": "", "x": 490, "y": 320, "wires": [] }, { "id": "94d99994b72809c9", "type": "modbus-client", "name": "Test Server", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": false, "failureLogEnabled": true, "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": "0x3A", "unit_id": "1", "commandDelay": "1", "clientTimeout": "1000", "reconnectOnTimeout": true, "reconnectTimeout": "2000", "parallelUnitIdsAllowed": true, "showErrors": false, "showWarnings": true, "showLogs": true } ] ```
  1. Import the flow above;
  2. Deploy it;
  3. Disable one of the modbus-read nodes (see the in-flow comments!)
  4. Deploy the flow again.

What did you expect to happen?

I would expect the remaining modbus-read nodes to continue operating and modbus-server to remain connected as long as there's at least one modbus-read node associated with the modbus-server is enabled.

Other Information

This is also reproducible with 5.30.0.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 60 days with no activity. It will be closed in 30 days, but can be saved by removing the stale label or commenting.