node-red-contrib-modbus-rtu 1.1.30 → 1.1.32
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 +59 -19
- package/examples/{crc only.js → add crc only.json } +23 -20
- package/examples/{gui.js → build modbus payload by GUI.json } +17 -34
- package/examples/{dynamic.js → dynamic.json} +23 -20
- package/examples/read selec meter via na111 mode mqtt client.json +181 -0
- package/examples/read selec meter via na111 mode tcp server.json +132 -0
- package/package.json +9 -2
- /package/{modbus_rtu.html → modbus_rtu/modbus_rtu.html} +0 -0
- /package/{modbus_rtu.js → modbus_rtu/modbus_rtu.js} +0 -0
package/README.md
CHANGED
|
@@ -1,34 +1,74 @@
|
|
|
1
1
|
# node-red-contrib-modbus-rtu
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Một node mạnh mẽ và linh hoạt để xây dựng gói tin Modbus RTU, tự động tính toán CRC16, và giải mã dữ liệu số thực (Float) trực tiếp trong Node-RED.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A robust Node-RED node for building Modbus RTU frames, automatic CRC16 calculation, and decoding Floating-point data.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 🌟 Tính năng nổi bật / Key Features
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **Tự động tính CRC16**: Không cần viết code để tính checksum, node sẽ tự động chèn 2 byte CRC vào cuối Buffer.
|
|
12
|
+
- **Xử lý số thực (Float)**: Hỗ trợ chuyển đổi mảng byte nhận về thành số thực với định dạng **ABCD** hoặc **CDAB** (đặc biệt hữu ích cho các dòng đồng hồ năng lượng như Selec, Elmeasure...).
|
|
13
|
+
- **Cấu hình động (Dynamic)**: Cho phép thay đổi Slave ID, mã hàm, địa chỉ thanh ghi ngay trong quá trình chạy thông qua `msg.payload`.
|
|
14
|
+
- **Kiểm tra gói tin (Check CRC)**: Hỗ trợ xác thực gói tin nhận về từ thiết bị ngoại vi có toàn vẹn hay không.
|
|
15
|
+
- **Hỗ trợ đa dạng mã hàm**: 01, 02, 03, 04, 05, 06, 15, 16.
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
---
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
## 🛠 Cấu hình / Configuration
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
Trong cửa sổ cài đặt node, bạn có các tùy chọn tại mục **Function**:
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
| Function | Mô tả (Description) | Cách dùng (Usage) |
|
|
24
|
+
| :--- | :--- | :--- |
|
|
25
|
+
| **ADD CRC (0)** | Chỉ thêm CRC | Thêm 2 byte CRC16 vào cuối `msg.payload` (Buffer). |
|
|
26
|
+
| **DYNAMIC (-1)** | Cấu hình động | Lấy thông số từ `msg.payload = {id, fn, addr, count}`. |
|
|
27
|
+
| **CHECK CRC (-2)** | Kiểm tra lỗi | Kiểm tra và bóc tách dữ liệu nếu CRC của gói tin nhận về là đúng. |
|
|
28
|
+
| **FLOATs ABCD (-3)** | Chuyển đổi số thực | Chuyển mảng byte nhận về thành mảng số thực định dạng ABCD. |
|
|
29
|
+
| **FLOATs CDAB (-4)** | Chuyển đổi số thực | Chuyển mảng byte nhận về thành mảng số thực định dạng CDAB (Selec Meter). |
|
|
30
|
+
| **Mã hàm (1-16)** | Mã hàm cố định | Xây dựng gói tin dựa trên Slave ID, Address, Count trên giao diện. |
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
---
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
- 1.0.1 .. 1.0.11: fix bug
|
|
34
|
+
## 📖 Ví dụ / Examples
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
### 1. Tạo gói tin Modbus từ giao diện (GUI)
|
|
37
|
+
Cấu hình: `Slave ID: 1`, `Function: 3`, `Address: 0`, `Count: 2`.
|
|
38
|
+
- **Input**: Bất kỳ gói tin nào kích hoạt node.
|
|
39
|
+
- **Output (Buffer)**: `01 03 00 00 00 02 C4 0B`
|
|
33
40
|
|
|
41
|
+
### 2. Cấu hình động (Dynamic Mode)
|
|
42
|
+
Sử dụng một node `function` trước node này:
|
|
43
|
+
```javascript
|
|
44
|
+
msg.payload = {
|
|
45
|
+
id: 2,
|
|
46
|
+
fn: 4,
|
|
47
|
+
addr: 10,
|
|
48
|
+
count: 1
|
|
49
|
+
};
|
|
50
|
+
return msg;
|
|
51
|
+
```
|
|
34
52
|
|
|
53
|
+
### 3. Giải mã dữ liệu đồng hồ Selec (NA111)
|
|
54
|
+
Nối đầu ra của node TCP/Serial vào node này, chọn Function: FLOATs CDAB (-4) và cài đặt Làm tròn (Decimal).
|
|
55
|
+
|
|
56
|
+
Kết quả: msg.payload trả về mảng số thực đã giải mã (Ví dụ: [220.5, 49.9, 0.98]).
|
|
57
|
+
|
|
58
|
+
## 🚀 Cài đặt / Installation
|
|
59
|
+
Chạy lệnh sau trong thư mục dữ liệu Node-RED (thường là ~/.node-red):
|
|
60
|
+
|
|
61
|
+
Bash
|
|
62
|
+
npm install node-red-contrib-modbus-rtu
|
|
63
|
+
|
|
64
|
+
## 👤 Thông tin tác giả / Author
|
|
65
|
+
Tác giả: Do Duy Cop
|
|
66
|
+
|
|
67
|
+
Dự án: S-Connect IoT System
|
|
68
|
+
|
|
69
|
+
GitHub: node-red-contrib-modbus-rtu
|
|
70
|
+
|
|
71
|
+
Email: duycop@gmail.com
|
|
72
|
+
|
|
73
|
+
## 📄 Bản quyền / License
|
|
74
|
+
Dự án được phát hành dưới giấy phép MIT. 2026 © Do Duy Cop.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"id": "
|
|
3
|
+
"id": "400fdf897cec0c1a",
|
|
4
4
|
"type": "inject",
|
|
5
5
|
"z": "2b535346fadd97c6",
|
|
6
6
|
"name": "",
|
|
@@ -20,36 +20,36 @@
|
|
|
20
20
|
"topic": "",
|
|
21
21
|
"payload": "",
|
|
22
22
|
"payloadType": "date",
|
|
23
|
-
"x":
|
|
24
|
-
"y":
|
|
23
|
+
"x": 400,
|
|
24
|
+
"y": 360,
|
|
25
25
|
"wires": [
|
|
26
26
|
[
|
|
27
|
-
"
|
|
27
|
+
"328387c40d312d5b"
|
|
28
28
|
]
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"id": "
|
|
32
|
+
"id": "328387c40d312d5b",
|
|
33
33
|
"type": "function",
|
|
34
34
|
"z": "2b535346fadd97c6",
|
|
35
|
-
"name": "
|
|
36
|
-
"func": "msg.payload = Buffer.from('010300040001', \"hex\")\
|
|
35
|
+
"name": "id+fn+data",
|
|
36
|
+
"func": "msg.payload = Buffer.from('010300040001', \"hex\")\nreturn msg;",
|
|
37
37
|
"outputs": 1,
|
|
38
38
|
"timeout": 0,
|
|
39
39
|
"noerr": 0,
|
|
40
40
|
"initialize": "",
|
|
41
41
|
"finalize": "",
|
|
42
42
|
"libs": [],
|
|
43
|
-
"x":
|
|
44
|
-
"y":
|
|
43
|
+
"x": 570,
|
|
44
|
+
"y": 360,
|
|
45
45
|
"wires": [
|
|
46
46
|
[
|
|
47
|
-
"
|
|
47
|
+
"5ef1bdd0f1cd29d7"
|
|
48
48
|
]
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
"id": "
|
|
52
|
+
"id": "1a05ffb5c52334bf",
|
|
53
53
|
"type": "debug",
|
|
54
54
|
"z": "2b535346fadd97c6",
|
|
55
55
|
"name": "debug 1",
|
|
@@ -60,32 +60,35 @@
|
|
|
60
60
|
"complete": "false",
|
|
61
61
|
"statusVal": "",
|
|
62
62
|
"statusType": "auto",
|
|
63
|
-
"x":
|
|
64
|
-
"y":
|
|
63
|
+
"x": 960,
|
|
64
|
+
"y": 360,
|
|
65
65
|
"wires": []
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
|
-
"id": "
|
|
68
|
+
"id": "5ef1bdd0f1cd29d7",
|
|
69
69
|
"type": "modbus_rtu",
|
|
70
70
|
"z": "2b535346fadd97c6",
|
|
71
|
+
"ten": "",
|
|
71
72
|
"slave_id": "",
|
|
72
73
|
"fn": "0",
|
|
73
74
|
"addr": "",
|
|
74
75
|
"count": "",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
76
|
+
"lamtron": "",
|
|
77
|
+
"x": 750,
|
|
78
|
+
"y": 360,
|
|
77
79
|
"wires": [
|
|
78
80
|
[
|
|
79
|
-
"
|
|
80
|
-
]
|
|
81
|
+
"1a05ffb5c52334bf"
|
|
82
|
+
],
|
|
83
|
+
[]
|
|
81
84
|
]
|
|
82
85
|
},
|
|
83
86
|
{
|
|
84
|
-
"id": "
|
|
87
|
+
"id": "8523f40b0dabf7d2",
|
|
85
88
|
"type": "global-config",
|
|
86
89
|
"env": [],
|
|
87
90
|
"modules": {
|
|
88
|
-
"node-red-contrib-modbus-rtu": "1.
|
|
91
|
+
"node-red-contrib-modbus-rtu": "1.1.30"
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"id": "
|
|
3
|
+
"id": "10c8cedc55ec906a",
|
|
4
4
|
"type": "inject",
|
|
5
5
|
"z": "2b535346fadd97c6",
|
|
6
6
|
"name": "",
|
|
@@ -20,36 +20,16 @@
|
|
|
20
20
|
"topic": "",
|
|
21
21
|
"payload": "",
|
|
22
22
|
"payloadType": "date",
|
|
23
|
-
"x":
|
|
24
|
-
"y":
|
|
23
|
+
"x": 400,
|
|
24
|
+
"y": 440,
|
|
25
25
|
"wires": [
|
|
26
26
|
[
|
|
27
|
-
"
|
|
27
|
+
"df21e8a640d5c119"
|
|
28
28
|
]
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"id": "
|
|
33
|
-
"type": "function",
|
|
34
|
-
"z": "2b535346fadd97c6",
|
|
35
|
-
"name": "function 1",
|
|
36
|
-
"func": "msg.payload = Buffer.from('010300040001', \"hex\")\n//msg.payload={id:5, fn:6, addr:7, count:8}\nreturn msg;",
|
|
37
|
-
"outputs": 1,
|
|
38
|
-
"timeout": 0,
|
|
39
|
-
"noerr": 0,
|
|
40
|
-
"initialize": "",
|
|
41
|
-
"finalize": "",
|
|
42
|
-
"libs": [],
|
|
43
|
-
"x": 480,
|
|
44
|
-
"y": 260,
|
|
45
|
-
"wires": [
|
|
46
|
-
[
|
|
47
|
-
"9f529aa85f9dc7e9"
|
|
48
|
-
]
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"id": "51c08ea65917c4fd",
|
|
32
|
+
"id": "3fd7afc76f962b1c",
|
|
53
33
|
"type": "debug",
|
|
54
34
|
"z": "2b535346fadd97c6",
|
|
55
35
|
"name": "debug 1",
|
|
@@ -60,32 +40,35 @@
|
|
|
60
40
|
"complete": "false",
|
|
61
41
|
"statusVal": "",
|
|
62
42
|
"statusType": "auto",
|
|
63
|
-
"x":
|
|
64
|
-
"y":
|
|
43
|
+
"x": 720,
|
|
44
|
+
"y": 440,
|
|
65
45
|
"wires": []
|
|
66
46
|
},
|
|
67
47
|
{
|
|
68
|
-
"id": "
|
|
48
|
+
"id": "df21e8a640d5c119",
|
|
69
49
|
"type": "modbus_rtu",
|
|
70
50
|
"z": "2b535346fadd97c6",
|
|
51
|
+
"ten": "FN3",
|
|
71
52
|
"slave_id": "4",
|
|
72
53
|
"fn": "3",
|
|
73
54
|
"addr": "5",
|
|
74
55
|
"count": "6",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
56
|
+
"lamtron": "",
|
|
57
|
+
"x": 550,
|
|
58
|
+
"y": 440,
|
|
77
59
|
"wires": [
|
|
78
60
|
[
|
|
79
|
-
"
|
|
80
|
-
]
|
|
61
|
+
"3fd7afc76f962b1c"
|
|
62
|
+
],
|
|
63
|
+
[]
|
|
81
64
|
]
|
|
82
65
|
},
|
|
83
66
|
{
|
|
84
|
-
"id": "
|
|
67
|
+
"id": "ed335ab6a7990851",
|
|
85
68
|
"type": "global-config",
|
|
86
69
|
"env": [],
|
|
87
70
|
"modules": {
|
|
88
|
-
"node-red-contrib-modbus-rtu": "1.
|
|
71
|
+
"node-red-contrib-modbus-rtu": "1.1.30"
|
|
89
72
|
}
|
|
90
73
|
}
|
|
91
74
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"id": "
|
|
3
|
+
"id": "3ec0474e402c3d94",
|
|
4
4
|
"type": "inject",
|
|
5
5
|
"z": "2b535346fadd97c6",
|
|
6
6
|
"name": "",
|
|
@@ -20,36 +20,36 @@
|
|
|
20
20
|
"topic": "",
|
|
21
21
|
"payload": "",
|
|
22
22
|
"payloadType": "date",
|
|
23
|
-
"x":
|
|
24
|
-
"y":
|
|
23
|
+
"x": 440,
|
|
24
|
+
"y": 540,
|
|
25
25
|
"wires": [
|
|
26
26
|
[
|
|
27
|
-
"
|
|
27
|
+
"66cdfaea3877033c"
|
|
28
28
|
]
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"id": "
|
|
32
|
+
"id": "66cdfaea3877033c",
|
|
33
33
|
"type": "function",
|
|
34
34
|
"z": "2b535346fadd97c6",
|
|
35
|
-
"name": "
|
|
36
|
-
"func": "
|
|
35
|
+
"name": "params",
|
|
36
|
+
"func": "msg.payload={id:5, fn:6, addr:7, count:8}\nreturn msg;",
|
|
37
37
|
"outputs": 1,
|
|
38
38
|
"timeout": 0,
|
|
39
39
|
"noerr": 0,
|
|
40
40
|
"initialize": "",
|
|
41
41
|
"finalize": "",
|
|
42
42
|
"libs": [],
|
|
43
|
-
"x":
|
|
44
|
-
"y":
|
|
43
|
+
"x": 600,
|
|
44
|
+
"y": 540,
|
|
45
45
|
"wires": [
|
|
46
46
|
[
|
|
47
|
-
"
|
|
47
|
+
"13e2f70e6db14402"
|
|
48
48
|
]
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
"id": "
|
|
52
|
+
"id": "7aa6c6828cd20a8b",
|
|
53
53
|
"type": "debug",
|
|
54
54
|
"z": "2b535346fadd97c6",
|
|
55
55
|
"name": "debug 1",
|
|
@@ -60,32 +60,35 @@
|
|
|
60
60
|
"complete": "false",
|
|
61
61
|
"statusVal": "",
|
|
62
62
|
"statusType": "auto",
|
|
63
|
-
"x":
|
|
64
|
-
"y":
|
|
63
|
+
"x": 960,
|
|
64
|
+
"y": 540,
|
|
65
65
|
"wires": []
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
|
-
"id": "
|
|
68
|
+
"id": "13e2f70e6db14402",
|
|
69
69
|
"type": "modbus_rtu",
|
|
70
70
|
"z": "2b535346fadd97c6",
|
|
71
|
+
"ten": "DYNAMIC",
|
|
71
72
|
"slave_id": "",
|
|
72
73
|
"fn": "-1",
|
|
73
74
|
"addr": "",
|
|
74
75
|
"count": "",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
76
|
+
"lamtron": "",
|
|
77
|
+
"x": 770,
|
|
78
|
+
"y": 540,
|
|
77
79
|
"wires": [
|
|
78
80
|
[
|
|
79
|
-
"
|
|
80
|
-
]
|
|
81
|
+
"7aa6c6828cd20a8b"
|
|
82
|
+
],
|
|
83
|
+
[]
|
|
81
84
|
]
|
|
82
85
|
},
|
|
83
86
|
{
|
|
84
|
-
"id": "
|
|
87
|
+
"id": "080d04333eedbf73",
|
|
85
88
|
"type": "global-config",
|
|
86
89
|
"env": [],
|
|
87
90
|
"modules": {
|
|
88
|
-
"node-red-contrib-modbus-rtu": "1.
|
|
91
|
+
"node-red-contrib-modbus-rtu": "1.1.30"
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
]
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "51c08ea65917c4fd",
|
|
4
|
+
"type": "debug",
|
|
5
|
+
"z": "2b535346fadd97c6",
|
|
6
|
+
"name": "debug 1",
|
|
7
|
+
"active": true,
|
|
8
|
+
"tosidebar": true,
|
|
9
|
+
"console": false,
|
|
10
|
+
"tostatus": false,
|
|
11
|
+
"complete": "false",
|
|
12
|
+
"statusVal": "",
|
|
13
|
+
"statusType": "auto",
|
|
14
|
+
"x": 1340,
|
|
15
|
+
"y": 280,
|
|
16
|
+
"wires": []
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "ab3005336fa8aee4",
|
|
20
|
+
"type": "modbus_rtu",
|
|
21
|
+
"z": "2b535346fadd97c6",
|
|
22
|
+
"ten": "",
|
|
23
|
+
"slave_id": "",
|
|
24
|
+
"fn": "-2",
|
|
25
|
+
"addr": "",
|
|
26
|
+
"count": "",
|
|
27
|
+
"x": 970,
|
|
28
|
+
"y": 280,
|
|
29
|
+
"wires": [
|
|
30
|
+
[
|
|
31
|
+
"f3fd5d4e4bd5959d"
|
|
32
|
+
],
|
|
33
|
+
[]
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "3348c248275461c2",
|
|
38
|
+
"type": "inject",
|
|
39
|
+
"z": "2b535346fadd97c6",
|
|
40
|
+
"name": "",
|
|
41
|
+
"props": [
|
|
42
|
+
{
|
|
43
|
+
"p": "payload"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"p": "topic",
|
|
47
|
+
"vt": "str"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"repeat": "",
|
|
51
|
+
"crontab": "",
|
|
52
|
+
"once": false,
|
|
53
|
+
"onceDelay": 0.1,
|
|
54
|
+
"topic": "",
|
|
55
|
+
"payload": "",
|
|
56
|
+
"payloadType": "date",
|
|
57
|
+
"x": 340,
|
|
58
|
+
"y": 280,
|
|
59
|
+
"wires": [
|
|
60
|
+
[
|
|
61
|
+
"948574ade489cc2f"
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "f3fd5d4e4bd5959d",
|
|
67
|
+
"type": "modbus_rtu",
|
|
68
|
+
"z": "2b535346fadd97c6",
|
|
69
|
+
"ten": "",
|
|
70
|
+
"slave_id": "",
|
|
71
|
+
"fn": "-4",
|
|
72
|
+
"addr": "",
|
|
73
|
+
"count": "",
|
|
74
|
+
"lamtron": "3",
|
|
75
|
+
"x": 1160,
|
|
76
|
+
"y": 280,
|
|
77
|
+
"wires": [
|
|
78
|
+
[
|
|
79
|
+
"51c08ea65917c4fd"
|
|
80
|
+
],
|
|
81
|
+
[]
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "948574ade489cc2f",
|
|
86
|
+
"type": "modbus_rtu",
|
|
87
|
+
"z": "2b535346fadd97c6",
|
|
88
|
+
"ten": "Read Selec",
|
|
89
|
+
"slave_id": "2",
|
|
90
|
+
"fn": "4",
|
|
91
|
+
"addr": "0",
|
|
92
|
+
"count": "64",
|
|
93
|
+
"lamtron": "",
|
|
94
|
+
"x": 490,
|
|
95
|
+
"y": 280,
|
|
96
|
+
"wires": [
|
|
97
|
+
[
|
|
98
|
+
"bd6ef6ea5144e037"
|
|
99
|
+
],
|
|
100
|
+
[]
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "bd6ef6ea5144e037",
|
|
105
|
+
"type": "mqtt out",
|
|
106
|
+
"z": "2b535346fadd97c6",
|
|
107
|
+
"name": "",
|
|
108
|
+
"topic": "device/1/sub",
|
|
109
|
+
"qos": "0",
|
|
110
|
+
"retain": "false",
|
|
111
|
+
"respTopic": "",
|
|
112
|
+
"contentType": "",
|
|
113
|
+
"userProps": "",
|
|
114
|
+
"correl": "",
|
|
115
|
+
"expiry": "",
|
|
116
|
+
"broker": "fe81706764017ce0",
|
|
117
|
+
"x": 650,
|
|
118
|
+
"y": 280,
|
|
119
|
+
"wires": []
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"id": "800344048f7952e2",
|
|
123
|
+
"type": "mqtt in",
|
|
124
|
+
"z": "2b535346fadd97c6",
|
|
125
|
+
"name": "",
|
|
126
|
+
"topic": "device/1/pub",
|
|
127
|
+
"qos": "2",
|
|
128
|
+
"datatype": "auto-detect",
|
|
129
|
+
"broker": "fe81706764017ce0",
|
|
130
|
+
"nl": false,
|
|
131
|
+
"rap": true,
|
|
132
|
+
"rh": 0,
|
|
133
|
+
"inputs": 0,
|
|
134
|
+
"x": 810,
|
|
135
|
+
"y": 280,
|
|
136
|
+
"wires": [
|
|
137
|
+
[
|
|
138
|
+
"ab3005336fa8aee4"
|
|
139
|
+
]
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "fe81706764017ce0",
|
|
144
|
+
"type": "mqtt-broker",
|
|
145
|
+
"name": "MQTT_Broker",
|
|
146
|
+
"broker": "127.0.0.1",
|
|
147
|
+
"port": 1883,
|
|
148
|
+
"clientid": "demo_client",
|
|
149
|
+
"autoConnect": true,
|
|
150
|
+
"usetls": false,
|
|
151
|
+
"protocolVersion": 4,
|
|
152
|
+
"keepalive": 60,
|
|
153
|
+
"cleansession": true,
|
|
154
|
+
"autoUnsubscribe": true,
|
|
155
|
+
"birthTopic": "",
|
|
156
|
+
"birthQos": "0",
|
|
157
|
+
"birthRetain": "false",
|
|
158
|
+
"birthPayload": "",
|
|
159
|
+
"birthMsg": {},
|
|
160
|
+
"closeTopic": "",
|
|
161
|
+
"closeQos": "0",
|
|
162
|
+
"closeRetain": "false",
|
|
163
|
+
"closePayload": "",
|
|
164
|
+
"closeMsg": {},
|
|
165
|
+
"willTopic": "",
|
|
166
|
+
"willQos": "0",
|
|
167
|
+
"willRetain": "false",
|
|
168
|
+
"willPayload": "",
|
|
169
|
+
"willMsg": {},
|
|
170
|
+
"userProps": "",
|
|
171
|
+
"sessionExpiry": ""
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"id": "320195f62a5f654e",
|
|
175
|
+
"type": "global-config",
|
|
176
|
+
"env": [],
|
|
177
|
+
"modules": {
|
|
178
|
+
"node-red-contrib-modbus-rtu": "1.1.30"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "51c08ea65917c4fd",
|
|
4
|
+
"type": "debug",
|
|
5
|
+
"z": "2b535346fadd97c6",
|
|
6
|
+
"name": "debug 1",
|
|
7
|
+
"active": true,
|
|
8
|
+
"tosidebar": true,
|
|
9
|
+
"console": false,
|
|
10
|
+
"tostatus": false,
|
|
11
|
+
"complete": "false",
|
|
12
|
+
"statusVal": "",
|
|
13
|
+
"statusType": "auto",
|
|
14
|
+
"x": 1240,
|
|
15
|
+
"y": 300,
|
|
16
|
+
"wires": []
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "ab3005336fa8aee4",
|
|
20
|
+
"type": "modbus_rtu",
|
|
21
|
+
"z": "2b535346fadd97c6",
|
|
22
|
+
"ten": "",
|
|
23
|
+
"slave_id": "",
|
|
24
|
+
"fn": "-2",
|
|
25
|
+
"addr": "",
|
|
26
|
+
"count": "",
|
|
27
|
+
"x": 870,
|
|
28
|
+
"y": 300,
|
|
29
|
+
"wires": [
|
|
30
|
+
[
|
|
31
|
+
"f3fd5d4e4bd5959d"
|
|
32
|
+
],
|
|
33
|
+
[]
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "3348c248275461c2",
|
|
38
|
+
"type": "inject",
|
|
39
|
+
"z": "2b535346fadd97c6",
|
|
40
|
+
"name": "",
|
|
41
|
+
"props": [
|
|
42
|
+
{
|
|
43
|
+
"p": "payload"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"p": "topic",
|
|
47
|
+
"vt": "str"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"repeat": "",
|
|
51
|
+
"crontab": "",
|
|
52
|
+
"once": false,
|
|
53
|
+
"onceDelay": 0.1,
|
|
54
|
+
"topic": "",
|
|
55
|
+
"payload": "",
|
|
56
|
+
"payloadType": "date",
|
|
57
|
+
"x": 260,
|
|
58
|
+
"y": 300,
|
|
59
|
+
"wires": [
|
|
60
|
+
[
|
|
61
|
+
"948574ade489cc2f"
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "f3fd5d4e4bd5959d",
|
|
67
|
+
"type": "modbus_rtu",
|
|
68
|
+
"z": "2b535346fadd97c6",
|
|
69
|
+
"ten": "",
|
|
70
|
+
"slave_id": "",
|
|
71
|
+
"fn": "-4",
|
|
72
|
+
"addr": "",
|
|
73
|
+
"count": "",
|
|
74
|
+
"lamtron": "3",
|
|
75
|
+
"x": 1060,
|
|
76
|
+
"y": 300,
|
|
77
|
+
"wires": [
|
|
78
|
+
[
|
|
79
|
+
"51c08ea65917c4fd"
|
|
80
|
+
],
|
|
81
|
+
[]
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "948574ade489cc2f",
|
|
86
|
+
"type": "modbus_rtu",
|
|
87
|
+
"z": "2b535346fadd97c6",
|
|
88
|
+
"ten": "Read Selec",
|
|
89
|
+
"slave_id": "2",
|
|
90
|
+
"fn": "4",
|
|
91
|
+
"addr": "0",
|
|
92
|
+
"count": "64",
|
|
93
|
+
"lamtron": "",
|
|
94
|
+
"x": 430,
|
|
95
|
+
"y": 300,
|
|
96
|
+
"wires": [
|
|
97
|
+
[
|
|
98
|
+
"6c6c8163305070fa"
|
|
99
|
+
],
|
|
100
|
+
[]
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "6c6c8163305070fa",
|
|
105
|
+
"type": "tcp request",
|
|
106
|
+
"z": "2b535346fadd97c6",
|
|
107
|
+
"name": "",
|
|
108
|
+
"server": "ip_rs485_to_lan",
|
|
109
|
+
"port": "502",
|
|
110
|
+
"out": "time",
|
|
111
|
+
"ret": "buffer",
|
|
112
|
+
"splitc": "0",
|
|
113
|
+
"newline": "",
|
|
114
|
+
"trim": false,
|
|
115
|
+
"tls": "",
|
|
116
|
+
"x": 650,
|
|
117
|
+
"y": 300,
|
|
118
|
+
"wires": [
|
|
119
|
+
[
|
|
120
|
+
"ab3005336fa8aee4"
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "f1926ead1b3e17c8",
|
|
126
|
+
"type": "global-config",
|
|
127
|
+
"env": [],
|
|
128
|
+
"modules": {
|
|
129
|
+
"node-red-contrib-modbus-rtu": "1.1.30"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-modbus-rtu",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.32",
|
|
4
|
+
"private": false,
|
|
4
5
|
"description": "Node-RED function build content modbus_rtu - Code by DoDuyCop",
|
|
5
6
|
"author": "duycop",
|
|
6
7
|
"license": "MIT",
|
|
@@ -17,13 +18,19 @@
|
|
|
17
18
|
"crc16",
|
|
18
19
|
"modbus_rtu"
|
|
19
20
|
],
|
|
21
|
+
"files": [
|
|
22
|
+
"examples","modbus_rtu"
|
|
23
|
+
],
|
|
24
|
+
"directories": {
|
|
25
|
+
"example": "examples"
|
|
26
|
+
},
|
|
20
27
|
"engines": {
|
|
21
28
|
"node": ">=18.0.0"
|
|
22
29
|
},
|
|
23
30
|
"node-red": {
|
|
24
31
|
"version": ">=4.1.0",
|
|
25
32
|
"nodes": {
|
|
26
|
-
"modbus_rtu": "modbus_rtu.js"
|
|
33
|
+
"modbus_rtu": "modbus_rtu/modbus_rtu.js"
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
36
|
}
|
|
File without changes
|
|
File without changes
|