node-red-contrib-modbus-modpackqt 1.1.85 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # node-red-contrib-modbus-modpackqt
2
2
 
3
- **Node-RED Modbus nodes powered by [ModPackQT](https://modpackqt.com)** — drag-and-drop nodes to read and write Modbus TCP registers (master & slave) from your Node-RED flows. No hand-written HTTP calls. No protocol handling. Just connect and go.
3
+ **Embedded Modbus TCP / RTU master + slave server for Node-RED no extra apps required.**
4
+ By [ModPackQT](https://modpackqt.com).
4
5
 
5
6
  [![npm version](https://img.shields.io/npm/v/node-red-contrib-modbus-modpackqt.svg)](https://www.npmjs.com/package/node-red-contrib-modbus-modpackqt)
6
7
  [![Node-RED](https://img.shields.io/badge/Node--RED-%E2%89%A52.0.0-red)](https://nodered.org)
@@ -8,224 +9,180 @@
8
9
 
9
10
  ---
10
11
 
11
- ## What is ModPackQT?
12
+ ## What you get
12
13
 
13
- [ModPackQT](https://modpackqt.com) is an industrial Modbus Master/Slave platform for engineers and technicians. It provides:
14
-
15
- - **Modbus TCP and RTU** communication via a local gateway app
16
- - **Built-in slave simulator** — simulate a PLC register map without hardware
17
- - **Real-time data visualization**, profile management, and AI-assisted setup
18
- - A **REST API** that this Node-RED palette talks to
19
-
20
- 👉 [Download ModPackQT](https://modpackqt.com/download) · [Modbus Tutorial](https://modpackqt.com/resources/tutorial) · [Resources Hub](https://modpackqt.com/resources)
21
-
22
- > **Requires the ModPackQT Gateway app to be running locally.**
23
- > The gateway is what the nodes talk to — not the cloud server directly.
14
+ - **Modbus master** read (FC1–FC4) and write (FC5/FC6/FC15/FC16) over **TCP** or **RTU (serial)**
15
+ - **Embedded Modbus TCP slave server** — push values from any flow, let PLCs / SCADA / HMIs read them
16
+ - **Free passive traffic monitor** see every Modbus op (timing, values, errors) in real time
17
+ - **Outputs raw register values** — pair with [`node-red-contrib-bytes-modpackqt`](https://www.npmjs.com/package/node-red-contrib-bytes-modpackqt) to decode int / float / string / bitmask
18
+ - **Zero external dependencies** Modbus runs inside the Node-RED process
24
19
 
25
20
  ---
26
21
 
27
- ## Installation
28
-
29
- ### Option 1 — Node-RED Palette Manager (recommended)
22
+ ## Install
30
23
 
31
- 1. Open Node-RED **Menu (☰) Manage palette Install**
32
- 2. Search for **`modbus-modpackqt`**
33
- 3. Click **Install**
34
- 4. Restart Node-RED — the **ModPackQT** palette group appears in the sidebar
24
+ **Recommended (one shot):** install both palettes Modbus + decoders — together.
35
25
 
36
- ### Option 2 npm CLI
26
+ Palette manager Manage palette → Install:
27
+ - `node-red-contrib-modbus-modpackqt`
28
+ - `node-red-contrib-bytes-modpackqt`
37
29
 
30
+ **npm:**
38
31
  ```bash
39
32
  cd ~/.node-red
40
- npm install node-red-contrib-modbus-modpackqt
41
- # Restart Node-RED after installation
33
+ npm install node-red-contrib-modbus-modpackqt node-red-contrib-bytes-modpackqt
34
+ # then restart Node-RED
42
35
  ```
43
36
 
44
37
  ---
45
38
 
46
- ## Prerequisites
47
-
48
- 1. **Sign up at [modpackqt.com](https://modpackqt.com)**
49
- A free account works for all master nodes. Slave nodes require a **paid plan**.
50
-
51
- 2. **Download and start the ModPackQT Gateway app**
52
- Download it from [modpackqt.com/download](https://modpackqt.com/download) and run it.
53
- By default it listens on **port 8502** (`localhost:8502`).
54
-
55
- 3. **Create an API key**
56
- In the ModPackQT web app go to **Settings → API Keys → New Key**. Paste it into the `modpackqt-config` node.
39
+ ## 5-minute walkthrough
57
40
 
58
- 4. **For slave nodes** — create and start at least one slave in the ModPackQT app first (Slave Simulator → New Slave). Note the **Slave ID** shown you'll need it in Node-RED.
41
+ ### 1. Read a temperature float from a PLC
59
42
 
60
- > **Plan limits**
61
- >
62
- > | Feature | Free | Paid |
63
- > |---|---|---|
64
- > | Master Read (`modpackqt-master-read`) | ✓ | ✓ |
65
- > | Master Write (`modpackqt-master-write`) | ✓ | ✓ |
66
- > | Slave Write (`modpackqt-slave-write`) | ✗ | ✓ |
67
- > | Slave Read (`modpackqt-slave-read`) | ✗ | ✓ |
68
- >
69
- > [View plans & upgrade →](https://modpackqt.com/#pricing)
70
-
71
- ---
43
+ ```
44
+ [inject every 5s] → [modbus master read FC3 addr=100 qty=2] → [decode-float32 BE] → [debug]
45
+ ```
72
46
 
73
- ## Available Nodes
47
+ | Step | Setting |
48
+ |---|---|
49
+ | Add a runtime config | TCP, timeout 3000 ms |
50
+ | Master read | Host `192.168.1.10`, port `502`, unit `1`, FC `3`, address `100`, qty `2` |
51
+ | `decode-float32` | Endian `BE` (try `LE_SWAP` if value looks wrong — Siemens often uses CDAB) |
74
52
 
75
- | Node | Category | Purpose |
76
- |---|---|---|
77
- | `modpackqt-config` | Config | Shared gateway connection (host, port, API key) |
78
- | `modpackqt-master-read` | Modbus Master | Read Modbus TCP registers — FC1/FC2/FC3/FC4 |
79
- | `modpackqt-master-write` | Modbus Master | Write Modbus TCP registers — FC5/FC6/FC15/FC16 |
80
- | `modpackqt-slave-read` | Modbus Slave *(paid)* | Read registers from a ModPackQT slave |
81
- | `modpackqt-slave-write` | Modbus Slave *(paid)* | Push values into a ModPackQT slave (build a live Modbus device from Node-RED) |
53
+ **`msg.payload` along the wire:**
54
+ - After Modbus read: `[16828, 0]` (raw registers)
55
+ - After decode-float32: `23.5` (clean float done)
82
56
 
83
- ---
57
+ ### 2. Send a setpoint back
84
58
 
85
- ## Node-RED Modbus Master — Read Registers (FC1/FC2/FC3/FC4)
59
+ ```
60
+ [inject 23.5] → [encode-float32 BE] → [modbus master write FC16 addr=200]
61
+ ```
86
62
 
87
- The `modpackqt-master-read` node reads registers from **any Modbus TCP slave device** by routing the request through the ModPackQT Gateway app.
63
+ The encoder converts `23.5` `[16828, 0]`, the write node sends it to the PLC.
88
64
 
89
- **Supported function codes:**
90
- - **FC1** — Read Coils
91
- - **FC2** — Read Discrete Inputs
92
- - **FC3** — Read Holding Registers
93
- - **FC4** — Read Input Registers
65
+ ### 3. Watch what's happening (debug visibility)
94
66
 
95
- **Config options:**
67
+ Drop a **modbus traffic** node anywhere on the canvas, point it at the same runtime config, wire to a Debug node. You'll see one message per Modbus op:
96
68
 
97
- | Property | Description |
98
- |---|---|
99
- | Gateway | Config node pointing at your running ModPackQT Gateway app |
100
- | Target Host | IP/hostname of the Modbus TCP slave to read from |
101
- | Target Port | Port of the Modbus TCP slave (default: 502) |
102
- | Unit ID | Modbus unit ID of the slave (1–247) |
103
- | Function Code | FC1 / FC2 / FC3 / FC4 |
104
- | Start Address | First register address (0-based) |
105
- | Quantity | Number of registers/coils to read (1–125) |
106
- | Poll Interval | Auto-poll every N ms (0 = trigger on input msg only) |
107
-
108
- **Output:**
109
69
  ```json
110
70
  {
111
- "payload": { "success": true, "values": [100, 200, 300] },
112
- "topic": "modbus/read/192.168.1.10:502"
71
+ "ts": "2026-05-09T14:23:01.234Z",
72
+ "direction": "read",
73
+ "kind": "master",
74
+ "target": "192.168.1.10:502",
75
+ "unitId": 1,
76
+ "fc": 3,
77
+ "address": 100,
78
+ "quantity": 2,
79
+ "values": [16828, 0],
80
+ "durationMs": 12,
81
+ "ok": true
113
82
  }
114
83
  ```
115
84
 
116
- ---
85
+ Filter by direction, function code, or target if you only want a slice. **Free, doesn't count toward your daily op cap.**
117
86
 
118
- ## Node-RED Modbus Master Write Registers (FC5/FC6/FC15/FC16)
87
+ ### 4. Be a Modbus slave (let SCADA read your values)
119
88
 
120
- The `modpackqt-master-write` node writes registers to **any Modbus TCP slave device**.
89
+ In the runtime config check **Enable embedded Modbus TCP slave server**, set port `1502`. Then:
121
90
 
122
- **Supported function codes:**
123
- - **FC5** Write Single Coil
124
- - **FC6** — Write Single Holding Register
125
- - **FC15** — Write Multiple Coils
126
- - **FC16** — Write Multiple Holding Registers
127
-
128
- **Input:** `msg.payload` — a number (FC5/FC6) or array of numbers (FC15/FC16)
91
+ ```
92
+ [any source] → [encode-int32 BE] [modbus slave write holding addr=0]
93
+ ```
129
94
 
130
- **Output:** Original `msg` with `msg.success = true`
95
+ External masters connecting to `your-host:1502`, unit `1`, FC `3`, address `0`, qty `2` will read the latest value back.
131
96
 
132
97
  ---
133
98
 
134
- ## Building a Modbus Slave from Node-RED *(Paid plan)*
99
+ ## Cookbook (combined with the bytes palette)
135
100
 
136
- Use `modpackqt-slave-write` to make Node-RED the **data source** for a live Modbus slave device. Any external Modbus master (PLC, SCADA, HMI) that connects to the ModPackQT slave port will read whatever values you last pushed from Node-RED.
137
-
138
- **Typical flow:**
101
+ ### Decode a status bitmask
139
102
  ```
140
- [MQTT / Sensor / Timer] → [Function: scale to integer] → [modpackqt-slave-write addr=0] → [External Modbus master reads]
103
+ [master read FC3 addr=50 qty=1] → [decode-bitmask bits=8] → [debug]
104
+ // payload = [true, true, false, true, false, false, false, false]
141
105
  ```
142
106
 
143
- **Use cases:**
144
- - Publish MQTT sensor data as Modbus TCP registers
145
- - Simulate a PLC register map for HMI/SCADA testing
146
- - Bridge OPC-UA, REST, or database data to Modbus
147
-
148
- **Slave write input — all of these work:**
149
- ```js
150
- msg.payload = 234; // single integer
151
- msg.payload = [234, 1013, 65]; // array — writes 3 registers starting at address 0
152
- msg.payload = "[234, 1013, 65]"; // JSON string also works (inject string type)
107
+ ### Read a device serial number string
153
108
  ```
154
-
155
- **Override at runtime:**
156
- ```js
157
- msg.slaveId = "42"; // select a different slave per message
158
- msg.address = 10; // start at register 10 instead of the configured address
159
- msg.registerType = "coil"; // override register type
109
+ [master read FC3 addr=10 qty=8] → [decode-string BE encoding=utf8 trim=true] → [debug]
110
+ // payload = "SN-2025-A0042"
160
111
  ```
161
112
 
162
- **Slave read output:**
163
- ```json
164
- {
165
- "payload": {
166
- "values": [234, 1013, 65],
167
- "registerType": "holding",
168
- "address": 0,
169
- "quantity": 3,
170
- "slaveId": "42"
171
- },
172
- "topic": "slave/42/holding/0"
173
- }
113
+ ### Bridge MQTT → Modbus
114
+ ```
115
+ [mqtt in topic=setpoint] → [encode-float32 BE] → [master write FC16 addr=200]
174
116
  ```
175
117
 
176
- ---
177
-
178
- ## Example Flows
179
-
180
- ### Poll Holding Registers Every 5 Seconds (Modbus Master)
181
-
118
+ ### Bridge Modbus → MQTT
182
119
  ```
183
- [Inject (repeat 5s)] → [modpackqt-master-read FC3 target=192.168.1.10:502 unitId=1 addr=0 qty=10] → [Debug]
120
+ [poll every 5s] → [master read FC3 addr=100 qty=2] → [decode-float32 BE] → [mqtt out topic=temp]
184
121
  ```
185
122
 
186
- ### Write a Setpoint Register from a Button
187
-
123
+ ### Mirror a remote PLC into local slave server
188
124
  ```
189
- [Inject (payload=1234)] → [modpackqt-master-write FC6 target=192.168.1.10:502 unitId=1 addr=100] → [Debug]
125
+ [poll 1s] → [master read FC3 addr=0 qty=10] → [slave write holding addr=0]
126
+ // any local SCADA can now read from your Node-RED slave instead of hammering the PLC
190
127
  ```
191
128
 
192
- ### Build a Slave — Publish Sensor Data as Modbus (Paid plan)
193
-
129
+ ### Alert on Modbus errors
194
130
  ```
195
- [MQTT in] → [Function: msg.payload = parseInt(msg.payload * 10)] → [modpackqt-slave-write Holding addr=0] → [Debug]
131
+ [modbus traffic filter=any] → [switch ok==false] → [email out]
196
132
  ```
197
133
 
198
- Any Modbus master on the network now reads live sensor values from the slave.
134
+ ---
199
135
 
200
- ### Import the Demo Flow
136
+ ## Available nodes
201
137
 
202
- 1. Open Node-RED **Menu → Import**
203
- 2. Choose `examples/basic-flow.json` from the package directory
204
- 3. Update the config node with your gateway host/port
205
- 4. Click **Deploy**
138
+ | Node | Purpose |
139
+ |---|---|
140
+ | `modpackqt-config` | Shared runtime master mode (TCP/RTU), serial settings, optional slave server, API key |
141
+ | `modpackqt-master-read` | Read FC1/FC2/FC3/FC4 from a remote Modbus device |
142
+ | `modpackqt-master-write` | Write FC5/FC6/FC15/FC16 to a remote Modbus device |
143
+ | `modpackqt-slave-read` | Read from the embedded slave's register store (verify what masters see) |
144
+ | `modpackqt-slave-write` | Push values into the embedded slave's register store |
145
+ | `modpackqt-traffic` | **Passive monitor** — emits one message per Modbus op. Free, with filters, full visibility into what's happening on the wire. |
206
146
 
207
147
  ---
208
148
 
209
- ## Configuration Node
149
+ ## Why Modbus + bytes are split into two palettes
150
+
151
+ Most Modbus packages bake type decoding into the read node — one giant dropdown for int16 / int32 / float32 / Siemens-CDAB / etc. That made sense in 2010 but it's a mess: every protocol re-implements the same decoders, and you can't reuse them for MQTT / TCP / BLE / file payloads.
152
+
153
+ We split them on purpose:
154
+ - **Modbus nodes** speak Modbus and output raw registers — nothing else.
155
+ - **Bytes nodes** decode any binary payload into typed values.
156
+
157
+ You write less code, your flows stay readable, and the same decoder works whether the data came from a PLC, an MQTT broker, or a UDP socket.
158
+
159
+ ---
210
160
 
211
- Add one `modpackqt-config` node per gateway instance. All other nodes reference it.
161
+ ## Pricing
212
162
 
213
- | Property | Default | Description |
163
+ | | Free | Paid |
214
164
  |---|---|---|
215
- | Host | `localhost` | Hostname or IP of the machine running the ModPackQT Gateway app |
216
- | Port | `8502` | Port that the ModPackQT Gateway app listens on |
217
- | API Key | _(empty)_ | Optional — sent as `x-api-key` header if set |
165
+ | Master read / write | | |
166
+ | Embedded slave server | | |
167
+ | **Traffic monitor** | | |
168
+ | Daily ops cap | **1,000 / day** per Node-RED instance | **Unlimited** |
169
+ | Branding in node status | Visible | Hidden |
170
+ | API key required | No | Yes |
171
+ | Trial | — | **30 days free, no credit card** |
172
+
173
+ [Get a free trial key →](https://modpackqt.com/nodered)
174
+
175
+ When the daily cap is hit, master read/write nodes return a clear error pointing at the upgrade link. **Traffic events, slave register reads/writes, and decode/encode operations don't count.**
218
176
 
219
177
  ---
220
178
 
221
- ## API Endpoints Used
179
+ ## Importing the example flow
222
180
 
223
- | Node | Gateway Endpoint |
224
- |---|---|
225
- | `modpackqt-master-read` | `POST /api/modbus/tcp/read` |
226
- | `modpackqt-master-write` | `POST /api/modbus/tcp/write` |
227
- | `modpackqt-slave-read` | `GET /api/slaves/:id/registers` |
228
- | `modpackqt-slave-write` | `PATCH /api/slaves/:id/registers` |
181
+ This package ships with a complete demo flow under `examples/basic-flow.json` showing every node combined with the bytes palette (master read → decode-float32, encode-float32 → master write, status bitmask, traffic monitor, slave loop).
182
+
183
+ Node-RED Menu → Import → Examples → **node-red-contrib-modbus-modpackqt** → basic-flow.
184
+
185
+ Make sure `node-red-contrib-bytes-modpackqt` is also installed before importing — the example uses both.
229
186
 
230
187
  ---
231
188
 
@@ -233,25 +190,48 @@ Add one `modpackqt-config` node per gateway instance. All other nodes reference
233
190
 
234
191
  | Issue | Solution |
235
192
  |---|---|
236
- | `connect ECONNREFUSED localhost:8502` | The ModPackQT Gateway app is not running. Start it first. |
237
- | `401 Unauthorized` | Missing or invalid API key check `modpackqt-config`. |
238
- | `403 Forbidden` on slave nodes | Your plan does not include the Slave Simulator. [Upgrade your plan →](https://modpackqt.com/#pricing) |
239
- | `slave not found check Slave ID` | The Slave ID is wrong or that slave was deleted. Check in ModPackQT Slave Simulator. |
240
- | `gateway not running` on slave nodes | The Gateway app is stopped. Open ModPackQT and click Start Gateway. |
241
- | `Cannot find module 'axios'` | Run `npm install` in `~/.node-red`. |
242
- | Nodes not appearing after install | Restart Node-RED completely after `npm install`. |
243
- | Node-RED version error | Requires Node-RED ≥ 2.0.0 and Node.js ≥ 14. |
193
+ | `ModPackQT free tier limit reached` | Either wait until midnight or [get a free trial key](https://modpackqt.com/nodered) |
194
+ | Decoded float looks like garbage | Try a different word order (`BE` `LE_SWAP`) — Schneider uses ABCD, Siemens often uses CDAB |
195
+ | `Serial port not configured for RTU mode` | Open runtime config set Serial Port (e.g. `/dev/ttyUSB0` or `COM3`) |
196
+ | `EADDRINUSE` on slave port | Another process already uses that port. Pick a different one (e.g. `1502`). |
197
+ | `connect ECONNREFUSED` | Target Modbus device is unreachable. Check IP / port / firewall. |
198
+ | `Embedded slave is disabled` | Open runtime config check **Enable embedded slave server** |
199
+ | Nodes don't appear after install | Fully restart Node-RED. |
200
+
201
+ ---
202
+
203
+ ## Reporting bugs & getting updates
204
+
205
+ - **Bugs / feature requests:** open a GitHub issue at the repository linked in
206
+ `package.json`, or email **support@modpackqt.com**.
207
+ - **Security issues:** see [`SECURITY.md`](./SECURITY.md) — please report
208
+ privately to **support@modpackqt.com**.
209
+ - **Updates are never automatic.** Node-RED's palette manager will show
210
+ "update available" when we publish a new version — you choose when to
211
+ upgrade. Pin a major version (`^2.0.0`) in production.
212
+ - **Changelog:** see [`CHANGELOG.md`](./CHANGELOG.md). We follow
213
+ [semver](https://semver.org/) — patch releases for bug fixes only.
214
+ - **Paid customers** get email notice for security and breaking-change
215
+ releases.
244
216
 
245
217
  ---
246
218
 
247
219
  ## Links
248
220
 
249
- - [ModPackQT Homepage](https://modpackqt.com)
250
- - [Download ModPackQT Gateway](https://modpackqt.com/download)
251
- - [Free Modbus Tutorial](https://modpackqt.com/resources/tutorial)
252
- - [Modbus Resources Hub](https://modpackqt.com/resources)
253
- - [Node-RED Docs](https://nodered.org/docs/)
254
- - [Contact / Report an Issue](https://modpackqt.com/contact)
221
+ - [ModPackQT homepage](https://modpackqt.com)
222
+ - [Node-RED + ModPackQT docs](https://modpackqt.com/nodered)
223
+ - [Bytes palette (decoders/encoders)](https://www.npmjs.com/package/node-red-contrib-bytes-modpackqt)
224
+ - [Modbus tutorials](https://modpackqt.com/resources/tutorial)
225
+ - [Disclaimer & safe-use checklist](./DISCLAIMER.md)
226
+ - [Changelog](./CHANGELOG.md)
227
+ - [Security policy](./SECURITY.md)
228
+ - [Contributing guide](./CONTRIBUTING.md)
229
+
230
+ ---
231
+
232
+ ## ⚠️ Read before deploying in production
233
+
234
+ Test new writes against the embedded slave server before wiring them to a real device. **Not for safety-instrumented systems (SIS / SIL).** See [`DISCLAIMER.md`](./DISCLAIMER.md) for the full safe-use checklist and [`LICENSE`](./LICENSE) for legal terms.
255
235
 
256
236
  ---
257
237
 
package/SECURITY.md ADDED
@@ -0,0 +1,50 @@
1
+ # Security policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ If you discover a security issue in this package, **please report it
6
+ privately** so we can fix it before it's exploited.
7
+
8
+ - **Email:** support@modpackqt.com
9
+ - **Response time:** we aim to acknowledge within **2 business days** and
10
+ publish a fix or mitigation within **90 days** of the report.
11
+
12
+ Please include:
13
+
14
+ - Affected version(s)
15
+ - A short description of the impact
16
+ - Steps or a proof-of-concept to reproduce
17
+ - Your preferred name for credit (or anonymous)
18
+
19
+ We follow [responsible disclosure](https://en.wikipedia.org/wiki/Responsible_disclosure):
20
+ we will not publish the issue until you've had a chance to verify the fix or
21
+ the 90-day window has elapsed.
22
+
23
+ ## Supported versions
24
+
25
+ | Version | Status |
26
+ |---|---|
27
+ | `2.x` | ✅ Active — security fixes within 90 days |
28
+ | `1.x` | ❌ End of life — please migrate to 2.x |
29
+
30
+ ## What is in scope
31
+
32
+ - The Node-RED nodes shipped in this package
33
+ - The embedded Modbus TCP slave server
34
+ - The traffic event bus
35
+ - Authentication and rate-limiting code paths
36
+
37
+ ## What is out of scope
38
+
39
+ - Vulnerabilities in our dependencies (please report those upstream — for
40
+ example to [`modbus-serial`](https://github.com/yaacov/node-modbus-serial))
41
+ — but tell us too so we can pin a safe version
42
+ - Issues that require an attacker to already have control of the Node-RED
43
+ runtime (Node-RED is not a sandbox)
44
+ - Denial-of-service caused by the free-tier rate limit (this is by design)
45
+
46
+ ## Hall of fame
47
+
48
+ We credit security reporters in this section unless they request anonymity.
49
+
50
+ _(none yet)_