Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
node-modbus
Advanced tools
Changelog
4.3.0 (2018-02-22)
<a name="4.2.1"></a>
Readme
NODE-MODBUS is a simple Modbus TCP/Serial Client/Server API.
Run the following command in the root directory of your Node-RED install
npm install node-modbus
Run the following command for global install
npm install -g node-modbus
The test files are implemented using mocha and sinon.
Simply use npm-update.sh
in the source code project.
To run the tests type from the projects root folder mocha test/*
.
Please feel free to fork and add your own tests.
let node_modbus = require('node-modbus')
let server = node_modbus.server.tcp.complete({ port : 502, responseDelay: 200 })
const node_modbus = require('node-modbus')
const client = node_modbus.client.tcp.complete({
'host': 'modbus.server.local', /* IP or name of server host */
'port': 502, /* well known Modbus port */
'unitId': 1,
'timeout': 2000, /* 2 sec */
'autoReconnect': true, /* reconnect on connection is lost */
'reconnectTimeout': 15000, /* wait 15 sec if auto reconnect fails to often */
'logLabel' : 'ModbusClientTCP', /* label to identify in log files */
'logLevel': 'debug', /* for less log use: info, warn or error */
'logEnabled': true
})
const time_interval = 1000
client.connect()
client.on('connect', function () {
setInterval( function () {
client.readCoils(0, 13).then((response) => console.log(response.payload))
}, time_interval) /* reading coils every second */
})
TBD
const node_modbus = require('node-modbus')
const client = modbus.client.serial.complete({
'portName': '/dev/ttyS0', /* COM1 */
'baudRate': 9600, /* */
'dataBits': 8, /* 5, 6, 7 */
'stopBits': 1, /* 1.5, 2 */
'parity': 'none', /* even, odd, mark, space */
'connectionType': 'RTU', /* RTU or ASCII */
'connectionDelay': 250, /* 250 msec - sometimes you need more on windows */
'timeout': 2000, /* 2 sec */
'autoReconnect': true, /* reconnect on connection is lost */
'reconnectTimeout': 15000, /* wait 15 sec if auto reconnect fails to often */
'logLabel' : 'ModbusClientSerial', /* label to identify in log files */
'logLevel': 'debug', /* for less log use: info, warn or error */
'logEnabled': true
})
/* here we need none connect call */
const time_interval = 1000
client.on('connect', function () {
setInterval( function () {
client.readCoils(0, 13).then((response) => console.log(response.payload))
}, time_interval) /* reading coils every second */
})
Based on jsmodbus
FAQs
Sum of implementations for the Serial/TCP Modbus protocol.
The npm package node-modbus receives a total of 76 weekly downloads. As such, node-modbus popularity was classified as not popular.
We found that node-modbus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).