Giter Club home page Giter Club logo

node-red-contrib-modbustcp's Introduction

node-red-contrib-modbustcp

NPM

Node-Red Modbus TCP nodes for communicating with a Modbus TCP server.

Based on jsmodbus.

Install

Run the following command in the root directory of your Node-RED install

npm install node-red-contrib-modbustcp

Nodes

modbus read

alt tag

API

In addition, you can pass in a msg with one or more payload settings to initiate additional modbus read events.

msg.payload = {
    "name": "Name1", // Should be a unique name
    "topic": "topic1", // Override default topic 
    "dataType": "FC3", // can be format 3, "FC3", or "Coil"
    "address": 0, // starting address
    "quantity": 4, // # of units to read
    "interval": 3000, // polling interval in milliseconds
    "ieeeType": "off", // valid values are "off", "single" or "double"
    "ieeeBE": true // Big Endian format, true/false. false = little endian
}

Most of the values are optional and server to override the defaults set in the nodes config.

Values for dataType inlcude:

  • "Coil", "FC1", "FC 1", 1
  • "Input", "FC2", "FC 2", 2
  • "HoldingRegister", "FC3", "FC 3", 3
  • "InputRegister", "FC4", "FC 4", 4

If you pass in a msg with a payload.name that is the same as one previously passed in, the new values will replace the old. For example, it is possible to change the polling interval of an existing event by passing in the same msg structure with a different "interval" setting.

Note: The IEEE 754 formatting is not applied to binary data types such as "Coil" and will be ignored for those.

Note: Setting ieeeBE = false will for the node to read the inputs as "little endian".

Stop/Kill You can stop or kill the polling of a modbus item by passing in the following:

alt tag

The polled event with the same name given will be stopped if the kill=true is also passed in.

example single input

alt tag

example multiple input

alt tag

modbus write

alt tag

API

In addition to passing in a payload value for writing, you can also pass in the following in your msg to override the configured defaults:

  • dataType
    • "Coil", "FC5", "FC 5", 5
    • "HoldingRegister", "FC6", "FC 6", 6
    • "Coils", "FC15" "FC 15", 15
    • "HoldingRegisters", "FC16", "FC 16", 16
  • address

example message input:

msg = {
    address: 8,
    dataType: "Coil",
    payload: 1
}

Author

node-red-contrib-modbustcp's People

Contributors

bnystrom avatar jayharper avatar ykornilov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-red-contrib-modbustcp's Issues

Polling stops after slave disconnects then reconnects

I have a node polling at a second interval from a slave, If the slave disconnects and then reconnects, the flow stops receiving information, seems like the connection comesback - writing continues to work but polling stops

Node settings in the flow ?

Hello !
Do you plan to add the ability to configure settings (Type (function code), address, modbustcp-server settings...) directly in the flow instead of just in the node ?
This would be so convenient, especially when data are variable.
Thanks

Installation failure

Why this node fails with serialport error? This is modbus tcp, I don't want to install serial port. My board does not support serial port. I am getting make error on serial port while installing this node. Why can't I use only modbustcp?

Type-Conversion and Endianess

Hi,

would be great to add Type-Conversions (2 registers -> 1 float) with respect to endianess.

We already implemented this, but cannot send you a pull request. We try to send you the source.

Greetings,
Philipp

Modbus write API wont work

Hello!

Im am trying to use the Modbus write node and its API.

When I inject integer as a payload to the configured Modbus tcp write node, it will send the integer to proper register to the servers end so the communication with the server works.

How ever when I try to send message using the API, so that the values in the message would over write the ones in the modbus write node it wont work. Is there something I am doing wrong? There is no error or anything else that would tell me whats wrong.
Sieppaa
Configuration of nodes
Sieppaa
msg function node
Sieppaa
Content of msg in the msg debug node

Thank you!
Br,
Oskari

Install error

hi had trouble making an update. so i startet a new install.
but i got the following error:

9 Oct 15:45:17 - [info] Installing module: node-red-contrib-modbustcp, version: 1.2.3 9 Oct 15:45:26 - [warn] Installation of module node-red-contrib-modbustcp failed: 9 Oct 15:45:26 - [warn] ------------------------------------------ 9 Oct 15:45:26 - [warn] npm ERR! Cannot read property 'match' of undefined npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2018-10-09T13_45_26_936Z-debug.log 9 Oct 15:45:26 - [warn] ------------------------------------------

here the log:

17 verbose stack TypeError: Cannot read property 'match' of undefined 17 verbose stack at tarballToVersion (/usr/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:87:20) 17 verbose stack at inflatableChild (/usr/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:99:22) 17 verbose stack at BB.each (/usr/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:55:12) 17 verbose stack at tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 17 verbose stack at Object.gotValue (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:155:18) 17 verbose stack at Object.gotAccum (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:144:25) 17 verbose stack at Object.tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 17 verbose stack at Promise._settlePromiseFromHandler (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31) 17 verbose stack at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18) 17 verbose stack at Promise._settlePromise0 (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10) 17 verbose stack at Promise._settlePromises (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18) 17 verbose stack at Async._drainQueue (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16) 17 verbose stack at Async._drainQueues (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10) 17 verbose stack at Immediate.Async.drainQueues (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14) 17 verbose stack at runCallback (timers.js:810:20) 17 verbose stack at tryOnImmediate (timers.js:768:5) 18 verbose cwd /home/pi/.node-red 19 verbose Linux 4.9.35-v7+ 20 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--save" "--save-prefix=~" "--production" "[email protected]" 21 verbose node v8.12.0 22 verbose npm v6.4.1 23 error Cannot read property 'match' of undefined 24 verbose exit [ 1, true ]

anyone has an idea ?
thank you

Modbus Server crashes because of too many connections after often deploy

Hi,

while I created a new Flow with one or more "modbustcp client" Node and had to edit it many times my Modbus TCP server crashed.

I found out that after a change to the flow or other flows and the "deploy" a new connection is opened but the old one is not closed in advance.

If I do a lot of testing and are often deployed, there are sometimes so many connections open that problems can occur on the server.
So I have to restart the system after some work so the system or the Modbus server does not crash.

Here is some information: I use RedMatic on a Homematic with the modbustcp as client to the modbus server (E3DC-S10) all programs and systems are up to date.

Here is an abstract of the open Modbus connections after 2 changes and deploy, in the flow are 3 Modbus client with different queries:

# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 192.168.178.22:46378    192.168.178.33:502      ESTABLISHED
tcp        0      0 192.168.178.22:46374    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:46376    192.168.178.33:502      ESTABLISHED 
# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 192.168.178.22:46378    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:51620    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:46374    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:51622    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:51618    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:46376    192.168.178.33:502      ESTABLISHED 
# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 192.168.178.22:46378    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:54144    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:51620    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:54142    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:46374    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:54140    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:51622    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:51618    192.168.178.33:502      ESTABLISHED 
tcp        0      0 192.168.178.22:46376    192.168.178.33:502      ESTABLISHED 
#

thanks
best regards
Nico

Waiting for missing types to be registered - node-red 0.19.4

thanks for offering this software. i appreciate it very much.

i used verson 1.2.1 up to now. it worked well. no issues.

then i updated node-red to version 0.19.4 and with that i updated to version 1.2.3 of modbustcp. but that did not work. i could install it but node-red didn't find it. giving this message in the log.

0|node-red | 26 Oct 20:04:44 - [info] Waiting for missing types to be registered:
0|node-red | 26 Oct 20:04:44 - [info] - modbustcp-server
0|node-red | 26 Oct 20:04:44 - [info] - modbustcp-read
0|node-red | 26 Oct 20:04:44 - [info] - modbustcp-write

node -v is v6.10.0
npm -v is 6.4.1

now i downgraded to version 1.2.1 and it's working again.

any idea? thanks and cheers.

Connection Crashes

Hi There,

I have just installed your node to read and write values out of a PLC. When ever I deploy changes to my code, I get the following

[error] [modbustcp-server:Pool] socket error: Error: read ECONNRESET node red

and the connection becomes intemittant. Stopping Node Red and restarting it fixes it. I was wondering if you could help me sort this issues

Regards
Sam

how to catch error coming from the underlying server description node ?

hi, I'm using a simple modbus tcp read node connecting to a remote modbus server (outsideof node-red).
when this server is offline I receive in the debug console : "socket error: Error: connect ETIMEDOUT xxx.xxx.xxx.xxx:502" with the name of the modbus server (fully normal) .
I've also put a catch node to detect potential errors on this modbus tcp read node but nothing is catched .
So how can I detect that the modbus server is Offline ?
cheers

Error installing node

Hi there,

I'm pretty new to node-red, so perhaps someone can help me with this error.
If tried to install the node into my node-red instance in a docker container on my Raspberry Pi 3 B
[I'm using the resin/armv7hf-debian:jessie image] I get this error:

node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/5.0.0/serialport-v5.0.0-node-v57-linux-arm.tar.gz
(full error log is attached)

Do you know how to fix this?
Is there something missing in the npm packages or what is the error?

Thanks for your help.

Best regards
FeFoLo

Error_Installing_Moodbus_Node.txt

Serial port error while installing modbus tcp

I have successfully installed node-red on Cyclone 5 SOC and accessed its GPIO from custom nodes. Now I am trying to install modbus tcp node on this board but I am getting Serial port error. I got the same error on Toradex VF61 module too. I don't know why it is giving serial port error for modbus tcp? Error is as follows:

root@cyclone5:~# npm install node-red-contrib-modbustcp

[email protected] install /home/root/node_modules/serialport
node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/home/root/node-v6.11.0-linux-armv7l/bin/node',
node-pre-gyp verb cli '/home/root/node_modules/serialport/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | arm
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/home/root/node_modules/serialport/build/Release/serialport.node" (not found)
node-pre-gyp http GET https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http EACCES: permission denied, mkdir '/home/root/node_modules/serialport/build'
node-pre-gyp verb command build [ 'rebuild' ]
node-pre-gyp http 404 https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp verb command build [ 'rebuild' ]
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/root/node_modules/serialport/build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 4.1.17-ltsi-altera
gyp ERR! command "/home/root/node-v6.11.0-linux-armv7l/bin/node" "/home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/root/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/home/root/node_modules/serialport/build/Release"
gyp ERR! cwd /home/root/node_modules/serialport
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/root/node-v6.11.0-linux-armv7l/bin/node /home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/root/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/root/node_modules/serialport/build/Release' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/root/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:891:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.1.17-ltsi-altera
node-pre-gyp ERR! command "/home/root/node-v6.11.0-linux-armv7l/bin/node" "/home/root/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/root/node_modules/serialport
node-pre-gyp ERR! node -v v6.11.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute '/home/root/node-v6.11.0-linux-armv7l/bin/node /home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/root/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/root/node_modules/serialport/build/Release' (1)
gyp ERR! configure error stall: info lifecycle [email protected]~install: Failed
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/root/node_modules/serialport/build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 4.1.17-ltsi-altera
gyp ERR! command "/home/root/node-v6.11.0-linux-armv7l/bin/node" "/home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/root/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/home/root/node_modules/serialport/build/Release"
gyp ERR! cwd /home/root/node_modules/serialport
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.
npm WARN root Invalid dependency: bcrypt-nodejs undefined

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/root/.npm/_logs/2017-06-26T07_51_30_499Z-debug.log

dataType capitalization bug

I found in modbustcp.js

  // Check to see if the incoming message overrides the dataTpye
  if (msg.hasOwnProperty("dataType") ) {
    dataType = msg.datatype;
  } else {
    dataType = node.dataType;
  }

should be
if (msg.hasOwnProperty("dataType") ) {
dataType = msg.dataType;
} else {
dataType = node.dataType;
}

the msg.dataType. I took me a bit to realize what was going on. I had to actually send both datatype and dataType to trip the logic then read the value.

Thanks for the library!

Serial port error while installing

I have successfully installed node-red on Cyclone 5 SOC and accessed its GPIO from custom nodes. Now I am trying to install modbus tcp node on this board but I am getting Serial port error. I got the same error on Toradex VF61 module too. I don't know why it is giving serial port error for modbus tcp? Error is as follows:

root@cyclone5:~# npm install node-red-contrib-modbustcp

[email protected] install /home/root/node_modules/serialport
node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/home/root/node-v6.11.0-linux-armv7l/bin/node',
node-pre-gyp verb cli '/home/root/node_modules/serialport/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | arm
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/home/root/node_modules/serialport/build/Release/serialport.node" (not found)
node-pre-gyp http GET https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http EACCES: permission denied, mkdir '/home/root/node_modules/serialport/build'
node-pre-gyp verb command build [ 'rebuild' ]
node-pre-gyp http 404 https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp verb command build [ 'rebuild' ]
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/root/node_modules/serialport/build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 4.1.17-ltsi-altera
gyp ERR! command "/home/root/node-v6.11.0-linux-armv7l/bin/node" "/home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/root/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/home/root/node_modules/serialport/build/Release"
gyp ERR! cwd /home/root/node_modules/serialport
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/root/node-v6.11.0-linux-armv7l/bin/node /home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/root/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/root/node_modules/serialport/build/Release' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/root/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:891:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.1.17-ltsi-altera
node-pre-gyp ERR! command "/home/root/node-v6.11.0-linux-armv7l/bin/node" "/home/root/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/root/node_modules/serialport
node-pre-gyp ERR! node -v v6.11.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute '/home/root/node-v6.11.0-linux-armv7l/bin/node /home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/root/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/root/node_modules/serialport/build/Release' (1)
gyp ERR! configure error stall: info lifecycle [email protected]~install: Failed
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/root/node_modules/serialport/build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 4.1.17-ltsi-altera
gyp ERR! command "/home/root/node-v6.11.0-linux-armv7l/bin/node" "/home/root/node-v6.11.0-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/root/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/home/root/node_modules/serialport/build/Release"
gyp ERR! cwd /home/root/node_modules/serialport
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.
npm WARN root Invalid dependency: bcrypt-nodejs undefined

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/root/.npm/_logs/2017-06-26T07_51_30_499Z-debug.log

working on raspberry pi

Hello,

İs it possible working on raspberry pi with modbustcp package. I have succesfully install modbustcp node to my raspberry pi. But I couldn't connect with my s7-1200 on modbus tcp. Could you help me please?

Full disk with error mesage from mod

I have full syslog and daemon.log with these repeating messages:

Dec 12 13:22:23 nodered Node-RED[1665]: (node:1665) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined
Dec 12 13:22:23 nodered Node-RED[1665]:     at processValues (/home/pi/.node-red/node_modules/node-red-contrib-modbustcp/modbustcp.js:342:18)
Dec 12 13:22:23 nodered Node-RED[1665]:     at Timeout._onTimeout (/home/pi/.node-red/node_modules/node-red-contrib-modbustcp/modbustcp.js:381:11)
Dec 12 13:22:23 nodered Node-RED[1665]:     at listOnTimeout (internal/timers.js:554:17)
Dec 12 13:22:23 nodered Node-RED[1665]:     at processTimers (internal/timers.js:497:7)
Dec 12 13:22:23 nodered Node-RED[1665]: (node:1665) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 68289759)

NodeRed repeatedly crashing after adding a ModbusTCP device

Title says everything, fully updated system using NodeJS 16

24 Dec 11:59:00 - [red] Uncaught Exception: 24 Dec 11:59:00 - [error] TypeError: Cannot read properties of undefined (reading 'forEach') at processValues (/home/florian/.node-red/node_modules/node-red-contrib-modbustcp/modbustcp.js:342:18) at SetupLoop (/home/florian/.node-red/node_modules/node-red-contrib-modbustcp/modbustcp.js:377:9) at ModbusTCPRead._inputCallback (/home/florian/.node-red/node_modules/node-red-contrib-modbustcp/modbustcp.js:400:9) at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:204:26 at Object.trigger (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/hooks.js:149:13) at ModbusTCPRead.Node._emitInput (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:196:11) at ModbusTCPRead.Node.emit (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:180:25) at ModbusTCPRead.Node.receive (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:479:10) at Immediate.<anonymous> (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:814:52) at processImmediate (node:internal/timers:464:21) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Failed with result 'exit-code'.

{"err":"Offline","message":"no connection to modbus server"}

Hello,

I am using the package "node-red-contrib-modbustcp" . I create a modbus tcpip server and it worked fine until it appeared the following error: "{"err":"Offline","message":"no connection to modbus server"}" and also "socket error: Error: connect ECONNREFUSED" . The server was configure with 127.0.0.1 and port 502. The firewall of the computer is turned off.

I reboot my computer and It works again, but I would like to know what it's the reason to avoid it in the future !

running on windows 10
node version: 8.11.3
node-red version: 0.20.3

Regards

How to read/poll once instead of at a rate?

Hi, apologies if this is posted somewhere, but I couldn't seem to find the answer. How do you read just once? I saw in the code that you can set rate to 0 to not automatically poll, but then if you send a single message into the read node to trigger a read (without an interval specified), it just reads constantly. Thanks in advance.

Unit ID in modbustcp-server Node

Hi, would it better to specify the Unit ID in the modbustcp-read and modbustcp-write nodes rather than the modbustcp-server node? I have a modbus TCP to RTU gateway which has multiple devices on the RS485 bus. There shouldn't be a need to define a new server node for each device on the bus since you only need one connection to the gateway.

Update config nodes by incoming payload

I need to modify/add config nodes for the modbustcp node externall triggered by a web request

/add-modbus-device?ip=1.2.3.4&port=502 

Since modbus device communication data is stored in config nodes this is not possible today.

It would be perfect if the config data could be updated/overridden by the incoming payload of the modbustcp node.

  • Is such a feature on the roadmap?
  • Should I create a pull request for this repo?
  • Or is this a bad idea - why?

Request time out

Hello,

I am able to read values from the Modbus via the Modbus TCP Client Read Node.
But when I try to write data to the Modbus this error occurs:
grafik
This happens when the read AND write Nodes are active.
If I delete the Read-Node, the Write-Node works.
How can I fix this problem?

Best regards and thanks in advance

Nicolai

Cannot have two modbus tcp outputs to the same modbus server - connection failures

I tried to use this with relatively popular SIEMENS LOGO!8 PLC, with modbus-tcp server enabled. All works nice, when I add first modbus-tcp output node to Node-RED flow. When I add a second one, then both outputs start to fail as connections starts to break and neither output is working, or just one is working time-to-time. I like the idea of configuration node for modbus-tcp server, which allows defining such server just once, so it can be referred to in read and write nodes thereafter.
My expectation was, that this separate configuration of server means that all requests, at least from the same Node flow, to it will be queued to the same tcp connection, as is the way how SCADA systems and equivalent automation systems work, to my best knowledge. PLC devices and simpler modbus-devices have typically limited processing and memory resources for IP stack services, so optimal way to use them is single-connection with request queues.

I was not able to find answer in documentation, of what is the intended modbus-tcp connection behavior in this code.

Read AND Write Connection to one Modbus-Server

I have an AC which is controllable by ModBus.

So I tried the Read-Node and can query the AC without any problems.
When I implement a Write-Node it can not connect to the Server as long as the Read-Node works.

How could I achieve reading in intervals and writing as needed to the same server?
Is this possible?

Regards
Markus

How to solve the "TypeError" issues

Hi!

Not really an issue... more of a quick reference, in case other users have the same problem.
My system was running Node.js v4.X, and after re-installing Node-RED completely, and the Modbus TCP package, and reconfiguring my flows, the console was throwing the following error for the "Modbus TCP read" nodes:
[error] [modbustcp-read:<YOUR_FLOW_ID>] TypeError: Buffer.alloc is not a function

As for the "Modbus TCP write", I was getting:
[error] [modbustcp-server:<YOUR_FLOW_ID>] TypeError: Cannot read property 'close' of null

The Buffer API is only available in Node.js v5.10.0 or later, so the solution is simple: Update Node.js.
I installed v6.11.0 now, and everything works again :)
Maybe this is helpful for someone...
Cheers!

Opens multiple connections

I have the problem that my buscoupler closes the connection.

I think the output-node opens a new connection for every writing. But it must stay connected.

Auto Reconnect

Hi

I am reading data using the Modbus "master" node. if it losses the connection will it automatically try and reconnect, do you know what the reconnect time is?

Thanks
Great node to have!!

Trouble connecting to two clients with two flows

I'm using node-red 0.19.4 on raspi 4.14.79-v7+ armv71.
I have two ModBus Servers with different IPs both on Port 502.
Server 1 (192.168.178.27:502) is slow and has to send a longer answer (2 secs) every 5 secs, but works fine.
Now I got another Modbus Server which I want to (and must) request every second.
I set up new flow with new Modbus Server config node (192.168.178.208:502) and new modbustcp input node.
But this new input node seems to interfere with the one of Server 1.
From its beginning the connection indicator of Server 1 went grey.
The connection to server 2 can't start and I get a connection error in the debug output.
One of 20 connection retries returns an correct answer.
But at the same time the connection to server 1 became corrupt, too. With the same connection error message, but IP of server 1 instead (can't connect to 192.168.178.27:502).
Deleting the new flow didn't fix it, the connection to server 1 was still broken.
Later I found out that still there is the second modbustcp config node in the background. After deleting it, flow 1 connected and went running ok again.

Could it be, that it is not possible to set up two different ModbusTCP connections in one node-red system?
Or am I doing something wrong?
Thanks for the support!
wbuh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.