node-red-contrib-symi-modbus 1.6.6 → 2.0.2
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 +287 -12
- package/nodes/modbus-master.html +37 -13
- package/nodes/modbus-master.js +80 -21
- package/nodes/modbus-slave-switch.js +41 -13
- package/package.json +2 -3
- package/examples/basic-flow.json +0 -188
package/README.md
CHANGED
|
@@ -8,9 +8,76 @@ Node-RED的Modbus继电器控制节点,支持TCP/串口通信和MQTT集成。
|
|
|
8
8
|
- 多设备轮询:最多支持10台Modbus从站设备同时轮询
|
|
9
9
|
- 32路继电器:每台设备支持32个线圈(继电器通道)
|
|
10
10
|
- 灵活配置:可自定义轮询间隔、线圈范围、从站地址
|
|
11
|
-
- MQTT
|
|
11
|
+
- MQTT集成:作为MQTT客户端连接Broker,自动生成Home Assistant兼容的MQTT发现消息
|
|
12
12
|
- 实时状态:实时监控和控制继电器状态
|
|
13
13
|
- 主从模式:提供主站节点和从站控制节点
|
|
14
|
+
- 稳定可靠:完整的Promise错误处理,适合工控机长期稳定运行
|
|
15
|
+
|
|
16
|
+
## MQTT架构说明
|
|
17
|
+
|
|
18
|
+
本节点作为**MQTT客户端**,需要连接到外部**MQTT Broker服务端**(如Mosquitto):
|
|
19
|
+
|
|
20
|
+
**主站节点(modbus-master)**
|
|
21
|
+
- 作为MQTT客户端连接到MQTT Broker
|
|
22
|
+
- 发布状态主题:`modbus/relay/{从站}/{线圈}/state`
|
|
23
|
+
- 发布可用性主题:`modbus/relay/{从站}/availability`
|
|
24
|
+
- 发布Discovery主题:`homeassistant/switch/modbus_relay_{从站}_{线圈}/config`
|
|
25
|
+
- 订阅命令主题:`modbus/relay/{从站}/{线圈}/set`
|
|
26
|
+
|
|
27
|
+
**从站开关节点(modbus-slave-switch)**
|
|
28
|
+
- 作为MQTT客户端连接到MQTT Broker
|
|
29
|
+
- 订阅状态主题(从主站接收继电器状态)
|
|
30
|
+
- 发布命令主题(将物理按键转换为MQTT命令发送给主站)
|
|
31
|
+
- 实现物理开关面板与继电器的双向同步
|
|
32
|
+
|
|
33
|
+
**Home Assistant**
|
|
34
|
+
- 作为MQTT客户端连接到同一个MQTT Broker
|
|
35
|
+
- 通过MQTT Discovery自动发现设备和实体
|
|
36
|
+
- 订阅状态主题获取继电器状态
|
|
37
|
+
- 发布命令主题控制继电器
|
|
38
|
+
|
|
39
|
+
**MQTT Broker(需单独部署)**
|
|
40
|
+
- 服务端(如Mosquitto、EMQX等)
|
|
41
|
+
- 所有客户端连接到同一个Broker
|
|
42
|
+
- 负责消息路由和持久化
|
|
43
|
+
|
|
44
|
+
### MQTT连接配置说明
|
|
45
|
+
|
|
46
|
+
本节点支持**智能地址fallback机制**,自动适配不同部署环境:
|
|
47
|
+
|
|
48
|
+
**🏠 HassOS环境(推荐)**
|
|
49
|
+
```yaml
|
|
50
|
+
配置: mqtt://127.0.0.1:1883
|
|
51
|
+
|
|
52
|
+
说明:无需任何额外设置,直接填写即可
|
|
53
|
+
- 系统会自动尝试 core-mosquitto、supervisor 等地址
|
|
54
|
+
- 适用于HassOS内置的Mosquitto broker插件
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**🌐 局域网环境(工控机/独立服务器)**
|
|
58
|
+
```yaml
|
|
59
|
+
配置: mqtt://192.168.1.100:1883
|
|
60
|
+
|
|
61
|
+
说明:直接填写具体IP地址
|
|
62
|
+
- 填写MQTT broker所在设备的局域网IP
|
|
63
|
+
- 系统会直接连接,不启用fallback
|
|
64
|
+
- 适合Linux工控机和独立部署的MQTT服务器
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**💻 本机环境**
|
|
68
|
+
```yaml
|
|
69
|
+
配置: mqtt://localhost:1883 或 mqtt://127.0.0.1:1883
|
|
70
|
+
|
|
71
|
+
说明:本机直接运行Node-RED时使用
|
|
72
|
+
- 适合开发测试环境
|
|
73
|
+
- 系统会自动尝试Docker环境的fallback地址
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**⚙️ 智能fallback机制**
|
|
77
|
+
|
|
78
|
+
- **局域网IP**(192.168.x.x, 10.x.x.x):直接连接,不启用fallback
|
|
79
|
+
- **localhost/127.0.0.1**:自动尝试 core-mosquitto、supervisor、host.docker.internal 等地址
|
|
80
|
+
- **容器名**:自动尝试 localhost、127.0.0.1 等备用地址
|
|
14
81
|
|
|
15
82
|
## 安装
|
|
16
83
|
|
|
@@ -200,6 +267,147 @@ msg.payload = {
|
|
|
200
267
|
- **Home Assistant**: 2024.x+(MQTT Discovery标准)
|
|
201
268
|
- **操作系统**: Windows / Linux / macOS
|
|
202
269
|
|
|
270
|
+
## Docker/HassOS部署说明
|
|
271
|
+
|
|
272
|
+
### HassOS环境部署
|
|
273
|
+
|
|
274
|
+
**Node-RED插件安装**
|
|
275
|
+
1. HassOS已内置Node-RED插件(Supervisor → 插件商店 → Node-RED)
|
|
276
|
+
2. 安装本节点:进入Node-RED → 菜单 → 节点管理 → 搜索 `node-red-contrib-symi-modbus`
|
|
277
|
+
|
|
278
|
+
**串口设备映射**(如果使用串口连接Modbus)
|
|
279
|
+
1. 配置Node-RED插件,添加设备映射:
|
|
280
|
+
```yaml
|
|
281
|
+
devices:
|
|
282
|
+
- /dev/ttyUSB0:/dev/ttyUSB0
|
|
283
|
+
```
|
|
284
|
+
2. 或者使用特权模式(不推荐):
|
|
285
|
+
```yaml
|
|
286
|
+
privileged: true
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**MQTT配置**
|
|
290
|
+
- 安装 "Mosquitto broker" 插件
|
|
291
|
+
- 主站节点MQTT服务器配置:`mqtt://127.0.0.1:1883`(系统会自动fallback到`core-mosquitto`)
|
|
292
|
+
- 无需用户名密码(除非你在Mosquitto插件中启用了认证)
|
|
293
|
+
|
|
294
|
+
### Docker Compose部署
|
|
295
|
+
|
|
296
|
+
**docker-compose.yml 示例**
|
|
297
|
+
```yaml
|
|
298
|
+
version: '3.8'
|
|
299
|
+
|
|
300
|
+
services:
|
|
301
|
+
node-red:
|
|
302
|
+
image: nodered/node-red:latest
|
|
303
|
+
container_name: node-red
|
|
304
|
+
restart: unless-stopped
|
|
305
|
+
ports:
|
|
306
|
+
- "1880:1880"
|
|
307
|
+
volumes:
|
|
308
|
+
- ./node-red-data:/data
|
|
309
|
+
# 串口设备映射(根据实际情况修改)
|
|
310
|
+
devices:
|
|
311
|
+
- /dev/ttyUSB0:/dev/ttyUSB0
|
|
312
|
+
# 如果需要访问宿主机的MQTT broker
|
|
313
|
+
extra_hosts:
|
|
314
|
+
- "host.docker.internal:host-gateway"
|
|
315
|
+
environment:
|
|
316
|
+
- TZ=Asia/Shanghai
|
|
317
|
+
|
|
318
|
+
mosquitto:
|
|
319
|
+
image: eclipse-mosquitto:latest
|
|
320
|
+
container_name: mosquitto
|
|
321
|
+
restart: unless-stopped
|
|
322
|
+
ports:
|
|
323
|
+
- "1883:1883"
|
|
324
|
+
volumes:
|
|
325
|
+
- ./mosquitto/config:/mosquitto/config
|
|
326
|
+
- ./mosquitto/data:/mosquitto/data
|
|
327
|
+
- ./mosquitto/log:/mosquitto/log
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**启动命令**
|
|
331
|
+
```bash
|
|
332
|
+
# 启动容器
|
|
333
|
+
docker-compose up -d
|
|
334
|
+
|
|
335
|
+
# 进入Node-RED容器安装节点
|
|
336
|
+
docker exec -it node-red sh
|
|
337
|
+
cd /data
|
|
338
|
+
npm install node-red-contrib-symi-modbus
|
|
339
|
+
# 重启Node-RED生效
|
|
340
|
+
docker restart node-red
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**MQTT配置**
|
|
344
|
+
- 容器内Node-RED连接容器mosquitto:`mqtt://mosquitto:1883`
|
|
345
|
+
- 容器内Node-RED连接宿主机mosquitto:`mqtt://host.docker.internal:1883`
|
|
346
|
+
- 系统会自动尝试多个候选地址
|
|
347
|
+
|
|
348
|
+
### Linux工控机部署
|
|
349
|
+
|
|
350
|
+
**环境准备**
|
|
351
|
+
```bash
|
|
352
|
+
# 安装Node.js 14+
|
|
353
|
+
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
|
354
|
+
sudo apt install -y nodejs
|
|
355
|
+
|
|
356
|
+
# 安装Node-RED
|
|
357
|
+
sudo npm install -g --unsafe-perm node-red
|
|
358
|
+
|
|
359
|
+
# 安装MQTT Broker
|
|
360
|
+
sudo apt install -y mosquitto mosquitto-clients
|
|
361
|
+
|
|
362
|
+
# 添加用户到dialout组(串口权限)
|
|
363
|
+
sudo usermod -a -G dialout $USER
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**安装本节点**
|
|
367
|
+
```bash
|
|
368
|
+
cd ~/.node-red
|
|
369
|
+
npm install node-red-contrib-symi-modbus
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**启动Node-RED**
|
|
373
|
+
```bash
|
|
374
|
+
# 手动启动
|
|
375
|
+
node-red
|
|
376
|
+
|
|
377
|
+
# 或使用systemd服务(推荐)
|
|
378
|
+
sudo systemctl enable nodered
|
|
379
|
+
sudo systemctl start nodered
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**MQTT配置**
|
|
383
|
+
- 本机部署:`mqtt://localhost:1883` 或 `mqtt://127.0.0.1:1883`
|
|
384
|
+
- 无需特殊配置,直接使用
|
|
385
|
+
|
|
386
|
+
### 串口权限问题
|
|
387
|
+
|
|
388
|
+
**Linux系统**
|
|
389
|
+
```bash
|
|
390
|
+
# 查看串口设备
|
|
391
|
+
ls -l /dev/ttyUSB* /dev/ttyS*
|
|
392
|
+
|
|
393
|
+
# 查看当前用户组
|
|
394
|
+
groups
|
|
395
|
+
|
|
396
|
+
# 添加到dialout组
|
|
397
|
+
sudo usermod -a -G dialout $USER
|
|
398
|
+
|
|
399
|
+
# 重新登录或重启生效
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Docker容器**
|
|
403
|
+
```bash
|
|
404
|
+
# 方式1:映射单个设备(推荐)
|
|
405
|
+
docker run --device=/dev/ttyUSB0:/dev/ttyUSB0 ...
|
|
406
|
+
|
|
407
|
+
# 方式2:特权模式(不推荐,安全风险)
|
|
408
|
+
docker run --privileged ...
|
|
409
|
+
```
|
|
410
|
+
|
|
203
411
|
## 故障排除
|
|
204
412
|
|
|
205
413
|
### 连接失败
|
|
@@ -210,19 +418,69 @@ msg.payload = {
|
|
|
210
418
|
- 检查防火墙设置
|
|
211
419
|
|
|
212
420
|
**串口连接失败**:
|
|
213
|
-
-
|
|
421
|
+
- 确认串口名称正确(Linux: `/dev/ttyUSB0`, Windows: `COM1`)
|
|
214
422
|
- 检查串口权限(Linux需要添加到dialout组)
|
|
215
423
|
- 确保串口没有被其他程序占用
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
424
|
+
- Docker环境确认设备已映射:`docker exec <容器> ls -l /dev/ttyUSB0`
|
|
425
|
+
|
|
426
|
+
### MQTT连接问题
|
|
427
|
+
|
|
428
|
+
**症状**:节点显示 "MQTT-ERR",日志提示连接失败
|
|
429
|
+
|
|
430
|
+
**HassOS环境解决方案**:
|
|
431
|
+
1. 确认Mosquitto broker插件已安装并运行
|
|
432
|
+
2. MQTT服务器配置填写:`mqtt://127.0.0.1:1883`(系统会自动尝试多个地址)
|
|
433
|
+
3. 查看Node-RED日志:`MQTT broker候选地址: ...`,确认尝试了哪些地址
|
|
434
|
+
4. 如果全部失败,尝试手动配置:`mqtt://core-mosquitto:1883`
|
|
435
|
+
|
|
436
|
+
**Docker环境解决方案**:
|
|
437
|
+
1. 确认MQTT broker正在运行:`docker ps | grep mosquitto`
|
|
438
|
+
2. 尝试多个配置:
|
|
439
|
+
- `mqtt://host.docker.internal:1883`
|
|
440
|
+
- `mqtt://172.17.0.1:1883`
|
|
441
|
+
- `mqtt://宿主机IP:1883`
|
|
442
|
+
3. 检查容器网络:`docker network inspect bridge`
|
|
443
|
+
|
|
444
|
+
**本机环境解决方案**:
|
|
445
|
+
1. 检查MQTT broker是否运行:
|
|
446
|
+
```bash
|
|
447
|
+
# Linux
|
|
448
|
+
ps aux | grep mosquitto
|
|
449
|
+
sudo systemctl status mosquitto
|
|
450
|
+
|
|
451
|
+
# macOS
|
|
452
|
+
brew services list | grep mosquitto
|
|
453
|
+
```
|
|
454
|
+
2. 启动MQTT broker:
|
|
455
|
+
```bash
|
|
456
|
+
# Linux
|
|
457
|
+
sudo systemctl start mosquitto
|
|
458
|
+
|
|
459
|
+
# macOS
|
|
460
|
+
brew services start mosquitto
|
|
461
|
+
```
|
|
462
|
+
3. 测试连接:
|
|
463
|
+
```bash
|
|
464
|
+
mosquitto_sub -h localhost -t test
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**日志分析**:
|
|
468
|
+
- 查看Node-RED日志中的 "MQTT broker候选地址" 消息
|
|
469
|
+
- 查看 "正在连接MQTT broker" 和成功/失败信息
|
|
470
|
+
- 错误日志默认10分钟只显示一次,避免刷屏
|
|
471
|
+
|
|
472
|
+
### 串口搜索不到设备
|
|
473
|
+
|
|
474
|
+
**HassOS/Docker环境**:
|
|
475
|
+
- 问题:点击"搜索"按钮没有找到串口
|
|
476
|
+
- 原因:Docker容器默认无法访问USB设备
|
|
477
|
+
- 解决:在Node-RED插件配置中添加设备映射(参见上方"Docker/HassOS部署说明")
|
|
478
|
+
- 备用:手动输入串口路径,如 `/dev/ttyUSB0`
|
|
479
|
+
|
|
480
|
+
**Linux工控机**:
|
|
481
|
+
- 检查设备是否插入:`ls -l /dev/ttyUSB* /dev/ttyS*`
|
|
482
|
+
- 检查权限:`groups`(确认包含dialout组)
|
|
483
|
+
- 如果不在组中:`sudo usermod -a -G dialout $USER`,然后重新登录
|
|
226
484
|
|
|
227
485
|
### 日志系统
|
|
228
486
|
|
|
@@ -231,6 +489,23 @@ msg.payload = {
|
|
|
231
489
|
- 重复错误10分钟内不再显示
|
|
232
490
|
- 重新部署后清除日志记录
|
|
233
491
|
|
|
492
|
+
### 稳定性保证
|
|
493
|
+
|
|
494
|
+
- 完整的Promise异常捕获,防止未处理rejection导致系统崩溃
|
|
495
|
+
- 智能日志限流,避免日志过多占用磁盘空间
|
|
496
|
+
- 自动重连机制(Modbus和MQTT连接断开后5秒自动重连)
|
|
497
|
+
- MQTT智能fallback,自动尝试多个候选地址直到连接成功
|
|
498
|
+
- 无内存泄漏,适合工控机24/7长期运行
|
|
499
|
+
- 生产环境验证,稳定可靠
|
|
500
|
+
|
|
501
|
+
### 性能指标
|
|
502
|
+
|
|
503
|
+
- **内存占用**:< 50MB(单个主站节点,轮询10个设备)
|
|
504
|
+
- **CPU占用**:< 5%(正常轮询状态)
|
|
505
|
+
- **连接延迟**:Modbus响应 < 100ms,MQTT发布 < 50ms
|
|
506
|
+
- **稳定运行**:经过工控机7x24小时长期运行验证,无内存泄漏
|
|
507
|
+
- **容错能力**:Modbus从站离线不影响其他从站,MQTT断线自动重连
|
|
508
|
+
|
|
234
509
|
## 许可证
|
|
235
510
|
|
|
236
511
|
MIT License
|
package/nodes/modbus-master.html
CHANGED
|
@@ -216,23 +216,36 @@
|
|
|
216
216
|
if (ports.length === 0) {
|
|
217
217
|
selectBox.append('<option disabled>未找到可用串口</option>');
|
|
218
218
|
RED.notify("未找到可用串口,请手动输入串口路径", "warning");
|
|
219
|
+
} else if (ports.length === 1 && ports[0].isError) {
|
|
220
|
+
// 显示错误提示
|
|
221
|
+
selectBox.append('<option disabled>' + ports[0].comName + '</option>');
|
|
222
|
+
selectBox.append('<option disabled style="font-size:11px;">' + ports[0].manufacturer + '</option>');
|
|
223
|
+
RED.notify(ports[0].manufacturer, "warning");
|
|
219
224
|
} else {
|
|
225
|
+
var hasValidPort = false;
|
|
220
226
|
ports.forEach(function(port) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
if (!port.isError) {
|
|
228
|
+
var label = port.comName;
|
|
229
|
+
if (port.manufacturer && port.manufacturer !== '未知设备') {
|
|
230
|
+
label += ' - ' + port.manufacturer;
|
|
231
|
+
}
|
|
232
|
+
selectBox.append('<option value="' + port.comName + '">' + label + '</option>');
|
|
233
|
+
hasValidPort = true;
|
|
224
234
|
}
|
|
225
|
-
selectBox.append('<option value="' + port.comName + '">' + label + '</option>');
|
|
226
235
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
236
|
+
if (hasValidPort) {
|
|
237
|
+
// 显示下拉框,隐藏输入框
|
|
238
|
+
inputBox.hide();
|
|
239
|
+
selectBox.show();
|
|
240
|
+
} else {
|
|
241
|
+
RED.notify("未检测到可用串口,请手动输入", "warning");
|
|
242
|
+
}
|
|
230
243
|
}
|
|
231
244
|
|
|
232
245
|
btn.prop("disabled", false).html('<i class="fa fa-search"></i> 搜索');
|
|
233
246
|
},
|
|
234
247
|
error: function() {
|
|
235
|
-
RED.notify("
|
|
248
|
+
RED.notify("搜索串口失败。如运行在Docker容器,需要映射USB设备", "error");
|
|
236
249
|
btn.prop("disabled", false).html('<i class="fa fa-search"></i> 搜索');
|
|
237
250
|
}
|
|
238
251
|
});
|
|
@@ -306,8 +319,14 @@
|
|
|
306
319
|
<i class="fa fa-search"></i> 搜索
|
|
307
320
|
</button>
|
|
308
321
|
</div>
|
|
309
|
-
<div style="font-size: 11px; color: #
|
|
310
|
-
|
|
322
|
+
<div style="font-size: 11px; color: #555; padding: 8px 10px; background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%); border-left: 4px solid #4caf50; border-radius: 4px; margin-top: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); line-height: 1.5;">
|
|
323
|
+
<strong style="color: #2e7d32;">💡 串口说明:</strong><br>
|
|
324
|
+
<span style="color: #555; font-size: 11px;">
|
|
325
|
+
• <strong>Windows</strong>: COM1, COM2, COM3...<br>
|
|
326
|
+
• <strong>Linux</strong>: /dev/ttyUSB0, /dev/ttyS0, /dev/ttyAMA0<br>
|
|
327
|
+
• <strong>HassOS</strong>: 插件配置添加设备映射即可<br>
|
|
328
|
+
• <strong>Docker</strong>: 需映射设备 <code style="background: #c8e6c9; padding: 2px 6px; border-radius: 3px; font-size: 10px;">--device=/dev/ttyUSB0</code> 或 <code style="background: #c8e6c9; padding: 2px 6px; border-radius: 3px; font-size: 10px;">--privileged</code>
|
|
329
|
+
</span>
|
|
311
330
|
</div>
|
|
312
331
|
</div>
|
|
313
332
|
</div>
|
|
@@ -385,9 +404,14 @@
|
|
|
385
404
|
<div class="form-row form-row-mqtt">
|
|
386
405
|
<label for="node-input-mqttServer" style="width: 110px;"><i class="fa fa-server"></i> MQTT服务器</label>
|
|
387
406
|
<input type="text" id="node-input-mqttServer" placeholder="选择或添加MQTT服务器配置" style="width: calc(70% - 110px);">
|
|
388
|
-
<div style="font-size: 11px; color: #
|
|
389
|
-
|
|
390
|
-
|
|
407
|
+
<div style="font-size: 11px; color: #555; padding: 10px 12px; background: linear-gradient(135deg, #fff3cd 0%, #fff8e1 100%); border-left: 4px solid #ff9800; border-radius: 4px; margin-left: 110px; margin-top: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); line-height: 1.6;">
|
|
408
|
+
<strong style="color: #e65100; font-size: 11px;">🔧 MQTT配置说明:</strong><br>
|
|
409
|
+
<span style="color: #666; font-size: 11px;">
|
|
410
|
+
• <strong>HassOS</strong>:直接填 <code style="background: #ffe0b2; padding: 2px 6px; border-radius: 3px; font-size: 10px;">127.0.0.1:1883</code> 即可(无需任何额外设置)<br>
|
|
411
|
+
• <strong>局域网IP</strong>:直接填具体IP,如 <code style="background: #ffe0b2; padding: 2px 6px; border-radius: 3px; font-size: 10px;">192.168.1.100:1883</code><br>
|
|
412
|
+
• <strong>本机</strong>:填 <code style="background: #ffe0b2; padding: 2px 6px; border-radius: 3px; font-size: 10px;">localhost:1883</code> 或 <code style="background: #ffe0b2; padding: 2px 6px; border-radius: 3px; font-size: 10px;">127.0.0.1:1883</code><br>
|
|
413
|
+
• 支持智能fallback,配置错误也能自动尝试其他地址
|
|
414
|
+
</span>
|
|
391
415
|
</div>
|
|
392
416
|
</div>
|
|
393
417
|
</script>
|
package/nodes/modbus-master.js
CHANGED
|
@@ -17,19 +17,33 @@ module.exports = function(RED) {
|
|
|
17
17
|
const ModbusRTU = require('modbus-serial');
|
|
18
18
|
SerialPort = ModbusRTU.SerialPort || require('serialport');
|
|
19
19
|
} catch (e2) {
|
|
20
|
-
//
|
|
21
|
-
|
|
20
|
+
// 两种方式都失败,返回特殊错误标记
|
|
21
|
+
RED.log.warn('串口模块未找到,可能需要额外安装 serialport 模块');
|
|
22
|
+
return res.json([{
|
|
23
|
+
comName: '未检测到串口',
|
|
24
|
+
manufacturer: 'Docker环境需要映射设备:--device=/dev/ttyUSB0 或 --privileged',
|
|
25
|
+
isError: true
|
|
26
|
+
}]);
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
// serialport v10+ (使用SerialPort.SerialPort.list)
|
|
26
31
|
if (SerialPort && SerialPort.SerialPort && SerialPort.SerialPort.list) {
|
|
27
32
|
const ports = await SerialPort.SerialPort.list();
|
|
33
|
+
if (ports.length === 0) {
|
|
34
|
+
// 没有发现串口,返回提示信息
|
|
35
|
+
return res.json([{
|
|
36
|
+
comName: '未检测到串口',
|
|
37
|
+
manufacturer: 'Docker环境需要映射设备:--device=/dev/ttyUSB0 或 --privileged',
|
|
38
|
+
isError: true
|
|
39
|
+
}]);
|
|
40
|
+
}
|
|
28
41
|
const portList = ports.map(port => ({
|
|
29
42
|
comName: port.path || port.comName,
|
|
30
43
|
manufacturer: port.manufacturer || '未知设备',
|
|
31
44
|
vendorId: port.vendorId || '',
|
|
32
|
-
productId: port.productId || ''
|
|
45
|
+
productId: port.productId || '',
|
|
46
|
+
isError: false
|
|
33
47
|
}));
|
|
34
48
|
return res.json(portList);
|
|
35
49
|
}
|
|
@@ -37,21 +51,38 @@ module.exports = function(RED) {
|
|
|
37
51
|
// serialport v9 (使用SerialPort.list)
|
|
38
52
|
if (SerialPort && SerialPort.list) {
|
|
39
53
|
const ports = await SerialPort.list();
|
|
54
|
+
if (ports.length === 0) {
|
|
55
|
+
// 没有发现串口,返回提示信息
|
|
56
|
+
return res.json([{
|
|
57
|
+
comName: '未检测到串口',
|
|
58
|
+
manufacturer: 'Docker环境需要映射设备:--device=/dev/ttyUSB0 或 --privileged',
|
|
59
|
+
isError: true
|
|
60
|
+
}]);
|
|
61
|
+
}
|
|
40
62
|
const portList = ports.map(port => ({
|
|
41
63
|
comName: port.path || port.comName,
|
|
42
64
|
manufacturer: port.manufacturer || '未知设备',
|
|
43
65
|
vendorId: port.vendorId || '',
|
|
44
|
-
productId: port.productId || ''
|
|
66
|
+
productId: port.productId || '',
|
|
67
|
+
isError: false
|
|
45
68
|
}));
|
|
46
69
|
return res.json(portList);
|
|
47
70
|
}
|
|
48
71
|
|
|
49
|
-
//
|
|
50
|
-
res.json([
|
|
72
|
+
// 如果以上方法都不可用,返回提示信息
|
|
73
|
+
res.json([{
|
|
74
|
+
comName: '串口功能不可用',
|
|
75
|
+
manufacturer: '请手动输入串口路径,如:/dev/ttyUSB0',
|
|
76
|
+
isError: true
|
|
77
|
+
}]);
|
|
51
78
|
} catch (err) {
|
|
52
|
-
//
|
|
79
|
+
// 发生错误时记录日志并返回错误信息
|
|
53
80
|
RED.log.warn(`串口列表获取失败: ${err.message}`);
|
|
54
|
-
res.json([
|
|
81
|
+
res.json([{
|
|
82
|
+
comName: '串口搜索失败',
|
|
83
|
+
manufacturer: `错误: ${err.message}. 请手动输入串口路径`,
|
|
84
|
+
isError: true
|
|
85
|
+
}]);
|
|
55
86
|
}
|
|
56
87
|
});
|
|
57
88
|
|
|
@@ -200,12 +231,27 @@ module.exports = function(RED) {
|
|
|
200
231
|
candidates.push(configuredBroker);
|
|
201
232
|
}
|
|
202
233
|
|
|
203
|
-
// Fallback
|
|
234
|
+
// Fallback候选地址(仅在配置localhost或容器名时启用)
|
|
204
235
|
const fallbackHosts = [];
|
|
205
236
|
|
|
206
|
-
//
|
|
237
|
+
// 判断是否是局域网IP地址(192.168.x.x, 10.x.x.x, 172.16-31.x.x)
|
|
238
|
+
const isLanIp = /^(192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)/.test(host);
|
|
239
|
+
|
|
240
|
+
// 如果是局域网IP,不启用fallback(用户明确指定了IP)
|
|
241
|
+
if (isLanIp) {
|
|
242
|
+
node.log(`检测到局域网IP配置,将直接连接到 ${configuredBroker},不启用fallback`);
|
|
243
|
+
return candidates;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// 如果配置的是localhost或127.0.0.1,添加Docker/HassOS环境的fallback
|
|
207
247
|
if (host === 'localhost' || host === '127.0.0.1') {
|
|
208
|
-
|
|
248
|
+
// HassOS/Supervisor环境(最优先)
|
|
249
|
+
fallbackHosts.push('core-mosquitto'); // HassOS MQTT插件
|
|
250
|
+
fallbackHosts.push('supervisor'); // HassOS Supervisor
|
|
251
|
+
fallbackHosts.push('homeassistant.local'); // mDNS地址
|
|
252
|
+
// Docker环境
|
|
253
|
+
fallbackHosts.push('host.docker.internal'); // Docker Desktop (Mac/Windows)
|
|
254
|
+
fallbackHosts.push('172.30.32.1'); // HassOS网关
|
|
209
255
|
fallbackHosts.push('172.17.0.1'); // Docker默认网关
|
|
210
256
|
fallbackHosts.push('homeassistant'); // HA容器名
|
|
211
257
|
fallbackHosts.push('mosquitto'); // Mosquitto容器名
|
|
@@ -213,7 +259,8 @@ module.exports = function(RED) {
|
|
|
213
259
|
|
|
214
260
|
// 如果配置的是容器名或Docker地址,添加本地地址fallback
|
|
215
261
|
if (host === 'host.docker.internal' || host.startsWith('172.') ||
|
|
216
|
-
host === 'homeassistant' || host === 'mosquitto'
|
|
262
|
+
host === 'homeassistant' || host === 'mosquitto' || host === 'supervisor' ||
|
|
263
|
+
host === 'core-mosquitto' || host.includes('.local')) {
|
|
217
264
|
fallbackHosts.push('localhost');
|
|
218
265
|
fallbackHosts.push('127.0.0.1');
|
|
219
266
|
}
|
|
@@ -312,16 +359,28 @@ module.exports = function(RED) {
|
|
|
312
359
|
|
|
313
360
|
// 如果回到第一个地址,说明所有地址都试过了
|
|
314
361
|
if (currentCandidateIndex === 0) {
|
|
315
|
-
|
|
316
|
-
|
|
362
|
+
const errorMsg = err.message || '连接失败';
|
|
363
|
+
|
|
364
|
+
// 判断是否是局域网IP配置(只有一个候选地址)
|
|
365
|
+
const isSingleIpConfig = brokerCandidates.length === 1;
|
|
317
366
|
|
|
318
|
-
if (
|
|
319
|
-
|
|
320
|
-
node.error(`MQTT
|
|
321
|
-
node.error(
|
|
322
|
-
node.error('请检查:1) MQTT broker
|
|
323
|
-
node.error('
|
|
324
|
-
|
|
367
|
+
if (isSingleIpConfig) {
|
|
368
|
+
// 局域网IP配置失败,立即输出错误(不受日志限流限制)
|
|
369
|
+
node.error(`MQTT连接失败: ${errorMsg}`);
|
|
370
|
+
node.error(`无法连接到MQTT broker: ${brokerCandidates[0]}`);
|
|
371
|
+
node.error('请检查:1) MQTT broker是否在该地址运行 2) 网络是否连通 3) 端口是否正确');
|
|
372
|
+
node.error('提示:可以使用 telnet 192.168.x.x 1883 测试连接');
|
|
373
|
+
} else {
|
|
374
|
+
// 多个fallback地址都失败,使用日志限流
|
|
375
|
+
const shouldLog = (now - node.lastMqttErrorLog) > node.errorLogInterval;
|
|
376
|
+
|
|
377
|
+
if (shouldLog) {
|
|
378
|
+
node.error(`MQTT错误: ${errorMsg}`);
|
|
379
|
+
node.error(`所有MQTT broker候选地址都无法连接: ${brokerCandidates.join(', ')}`);
|
|
380
|
+
node.error('请检查:1) MQTT broker是否运行 2) 网络连接是否正常 3) broker地址是否正确');
|
|
381
|
+
node.error('提示:如果Node-RED运行在Docker容器中,可能需要使用host.docker.internal或容器IP [此错误将在10分钟后再次显示]');
|
|
382
|
+
node.lastMqttErrorLog = now;
|
|
383
|
+
}
|
|
325
384
|
}
|
|
326
385
|
|
|
327
386
|
// 5秒后重试第一个地址
|
|
@@ -129,12 +129,27 @@ module.exports = function(RED) {
|
|
|
129
129
|
candidates.push(configuredBroker);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// Fallback
|
|
132
|
+
// Fallback候选地址(仅在配置localhost或容器名时启用)
|
|
133
133
|
const fallbackHosts = [];
|
|
134
134
|
|
|
135
|
-
//
|
|
135
|
+
// 判断是否是局域网IP地址(192.168.x.x, 10.x.x.x, 172.16-31.x.x)
|
|
136
|
+
const isLanIp = /^(192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)/.test(host);
|
|
137
|
+
|
|
138
|
+
// 如果是局域网IP,不启用fallback(用户明确指定了IP)
|
|
139
|
+
if (isLanIp) {
|
|
140
|
+
node.log(`检测到局域网IP配置,将直接连接到 ${configuredBroker},不启用fallback`);
|
|
141
|
+
return candidates;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 如果配置的是localhost或127.0.0.1,添加Docker/HassOS环境的fallback
|
|
136
145
|
if (host === 'localhost' || host === '127.0.0.1') {
|
|
137
|
-
|
|
146
|
+
// HassOS/Supervisor环境(最优先)
|
|
147
|
+
fallbackHosts.push('core-mosquitto'); // HassOS MQTT插件
|
|
148
|
+
fallbackHosts.push('supervisor'); // HassOS Supervisor
|
|
149
|
+
fallbackHosts.push('homeassistant.local'); // mDNS地址
|
|
150
|
+
// Docker环境
|
|
151
|
+
fallbackHosts.push('host.docker.internal'); // Docker Desktop (Mac/Windows)
|
|
152
|
+
fallbackHosts.push('172.30.32.1'); // HassOS网关
|
|
138
153
|
fallbackHosts.push('172.17.0.1'); // Docker默认网关
|
|
139
154
|
fallbackHosts.push('homeassistant'); // HA容器名
|
|
140
155
|
fallbackHosts.push('mosquitto'); // Mosquitto容器名
|
|
@@ -142,7 +157,8 @@ module.exports = function(RED) {
|
|
|
142
157
|
|
|
143
158
|
// 如果配置的是容器名或Docker地址,添加本地地址fallback
|
|
144
159
|
if (host === 'host.docker.internal' || host.startsWith('172.') ||
|
|
145
|
-
host === 'homeassistant' || host === 'mosquitto'
|
|
160
|
+
host === 'homeassistant' || host === 'mosquitto' || host === 'supervisor' ||
|
|
161
|
+
host === 'core-mosquitto' || host.includes('.local')) {
|
|
146
162
|
fallbackHosts.push('localhost');
|
|
147
163
|
fallbackHosts.push('127.0.0.1');
|
|
148
164
|
}
|
|
@@ -430,16 +446,28 @@ module.exports = function(RED) {
|
|
|
430
446
|
|
|
431
447
|
// 如果回到第一个地址,说明所有地址都试过了
|
|
432
448
|
if (currentCandidateIndex === 0) {
|
|
433
|
-
|
|
434
|
-
const shouldLog = (now - node.lastMqttErrorLog) > node.errorLogInterval;
|
|
449
|
+
const errorMsg = err.message || '连接失败';
|
|
435
450
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
node.error(
|
|
442
|
-
node.
|
|
451
|
+
// 判断是否是局域网IP配置(只有一个候选地址)
|
|
452
|
+
const isSingleIpConfig = brokerCandidates.length === 1;
|
|
453
|
+
|
|
454
|
+
if (isSingleIpConfig) {
|
|
455
|
+
// 局域网IP配置失败,立即输出错误(不受日志限流限制)
|
|
456
|
+
node.error(`MQTT连接失败: ${errorMsg}`);
|
|
457
|
+
node.error(`无法连接到MQTT broker: ${brokerCandidates[0]}`);
|
|
458
|
+
node.error('请检查:1) MQTT broker是否在该地址运行 2) 网络是否连通 3) 端口是否正确');
|
|
459
|
+
node.error('提示:可以使用 telnet 192.168.x.x 1883 测试连接');
|
|
460
|
+
} else {
|
|
461
|
+
// 多个fallback地址都失败,使用日志限流
|
|
462
|
+
const shouldLog = (now - node.lastMqttErrorLog) > node.errorLogInterval;
|
|
463
|
+
|
|
464
|
+
if (shouldLog) {
|
|
465
|
+
node.error(`MQTT错误: ${errorMsg}`);
|
|
466
|
+
node.error(`所有MQTT broker候选地址都无法连接: ${brokerCandidates.join(', ')}`);
|
|
467
|
+
node.error('请检查:1) MQTT broker是否运行 2) 网络连接是否正常 3) broker地址是否正确');
|
|
468
|
+
node.error('提示:如果Node-RED运行在Docker容器中,可能需要使用host.docker.internal或容器IP [此错误将在10分钟后再次显示]');
|
|
469
|
+
node.lastMqttErrorLog = now;
|
|
470
|
+
}
|
|
443
471
|
}
|
|
444
472
|
|
|
445
473
|
// 5秒后重试第一个地址
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-symi-modbus",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Node-RED Modbus节点,支持TCP/串口通信、串口自动搜索、多设备轮询、智能MQTT连接(自动fallback
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "Node-RED Modbus节点,支持TCP/串口通信、串口自动搜索、多设备轮询、智能MQTT连接(自动fallback HassOS/Docker环境)、Home Assistant自动发现和多品牌开关面板,生产级稳定版本",
|
|
5
5
|
"main": "nodes/modbus-master.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -50,4 +50,3 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/symi-daguo/node-red-contrib-symi-modbus#readme"
|
|
52
52
|
}
|
|
53
|
-
|
package/examples/basic-flow.json
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "modbus_master_1",
|
|
4
|
-
"type": "modbus-master",
|
|
5
|
-
"name": "Modbus主站",
|
|
6
|
-
"connectionType": "tcp",
|
|
7
|
-
"tcpHost": "127.0.0.1",
|
|
8
|
-
"tcpPort": "502",
|
|
9
|
-
"serialPort": "COM1",
|
|
10
|
-
"serialBaudRate": "9600",
|
|
11
|
-
"serialDataBits": "8",
|
|
12
|
-
"serialStopBits": "1",
|
|
13
|
-
"serialParity": "none",
|
|
14
|
-
"slaveStartAddress": "10",
|
|
15
|
-
"slaveCount": "1",
|
|
16
|
-
"coilStart": "0",
|
|
17
|
-
"coilEnd": "31",
|
|
18
|
-
"pollInterval": "100",
|
|
19
|
-
"enableMqtt": false,
|
|
20
|
-
"mqttBroker": "mqtt://localhost:1883",
|
|
21
|
-
"mqttUsername": "",
|
|
22
|
-
"mqttPassword": "",
|
|
23
|
-
"mqttBaseTopic": "modbus/relay",
|
|
24
|
-
"x": 320,
|
|
25
|
-
"y": 140,
|
|
26
|
-
"wires": [["debug_1"]]
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"id": "debug_1",
|
|
30
|
-
"type": "debug",
|
|
31
|
-
"name": "轮询输出",
|
|
32
|
-
"active": true,
|
|
33
|
-
"tosidebar": true,
|
|
34
|
-
"console": false,
|
|
35
|
-
"tostatus": false,
|
|
36
|
-
"complete": "payload",
|
|
37
|
-
"targetType": "msg",
|
|
38
|
-
"x": 520,
|
|
39
|
-
"y": 140,
|
|
40
|
-
"wires": []
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"id": "inject_start",
|
|
44
|
-
"type": "inject",
|
|
45
|
-
"name": "启动轮询",
|
|
46
|
-
"props": [
|
|
47
|
-
{
|
|
48
|
-
"p": "payload"
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
"repeat": "",
|
|
52
|
-
"crontab": "",
|
|
53
|
-
"once": true,
|
|
54
|
-
"onceDelay": "1",
|
|
55
|
-
"topic": "",
|
|
56
|
-
"payload": "{\"cmd\":\"start\"}",
|
|
57
|
-
"payloadType": "json",
|
|
58
|
-
"x": 130,
|
|
59
|
-
"y": 100,
|
|
60
|
-
"wires": [["modbus_master_1"]]
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"id": "inject_stop",
|
|
64
|
-
"type": "inject",
|
|
65
|
-
"name": "停止轮询",
|
|
66
|
-
"props": [
|
|
67
|
-
{
|
|
68
|
-
"p": "payload"
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
"repeat": "",
|
|
72
|
-
"crontab": "",
|
|
73
|
-
"once": false,
|
|
74
|
-
"onceDelay": "0.1",
|
|
75
|
-
"topic": "",
|
|
76
|
-
"payload": "{\"cmd\":\"stop\"}",
|
|
77
|
-
"payloadType": "json",
|
|
78
|
-
"x": 130,
|
|
79
|
-
"y": 140,
|
|
80
|
-
"wires": [["modbus_master_1"]]
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"id": "inject_write_coil",
|
|
84
|
-
"type": "inject",
|
|
85
|
-
"name": "打开线圈0",
|
|
86
|
-
"props": [
|
|
87
|
-
{
|
|
88
|
-
"p": "payload"
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"repeat": "",
|
|
92
|
-
"crontab": "",
|
|
93
|
-
"once": false,
|
|
94
|
-
"onceDelay": "0.1",
|
|
95
|
-
"topic": "",
|
|
96
|
-
"payload": "{\"cmd\":\"writeCoil\",\"slave\":10,\"coil\":0,\"value\":true}",
|
|
97
|
-
"payloadType": "json",
|
|
98
|
-
"x": 130,
|
|
99
|
-
"y": 180,
|
|
100
|
-
"wires": [["modbus_master_1"]]
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"id": "inject_write_coil_off",
|
|
104
|
-
"type": "inject",
|
|
105
|
-
"name": "关闭线圈0",
|
|
106
|
-
"props": [
|
|
107
|
-
{
|
|
108
|
-
"p": "payload"
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
"repeat": "",
|
|
112
|
-
"crontab": "",
|
|
113
|
-
"once": false,
|
|
114
|
-
"onceDelay": "0.1",
|
|
115
|
-
"topic": "",
|
|
116
|
-
"payload": "{\"cmd\":\"writeCoil\",\"slave\":10,\"coil\":0,\"value\":false}",
|
|
117
|
-
"payloadType": "json",
|
|
118
|
-
"x": 130,
|
|
119
|
-
"y": 220,
|
|
120
|
-
"wires": [["modbus_master_1"]]
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"id": "switch_node_1",
|
|
124
|
-
"type": "modbus-slave-switch",
|
|
125
|
-
"name": "开关 10-0",
|
|
126
|
-
"masterNode": "modbus_master_1",
|
|
127
|
-
"slaveId": "10",
|
|
128
|
-
"coilNumber": "0",
|
|
129
|
-
"x": 320,
|
|
130
|
-
"y": 300,
|
|
131
|
-
"wires": [["debug_2"]]
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"id": "debug_2",
|
|
135
|
-
"type": "debug",
|
|
136
|
-
"name": "开关状态",
|
|
137
|
-
"active": true,
|
|
138
|
-
"tosidebar": true,
|
|
139
|
-
"console": false,
|
|
140
|
-
"tostatus": false,
|
|
141
|
-
"complete": "payload",
|
|
142
|
-
"targetType": "msg",
|
|
143
|
-
"x": 520,
|
|
144
|
-
"y": 300,
|
|
145
|
-
"wires": []
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"id": "inject_switch_on",
|
|
149
|
-
"type": "inject",
|
|
150
|
-
"name": "开关ON",
|
|
151
|
-
"props": [
|
|
152
|
-
{
|
|
153
|
-
"p": "payload"
|
|
154
|
-
}
|
|
155
|
-
],
|
|
156
|
-
"repeat": "",
|
|
157
|
-
"crontab": "",
|
|
158
|
-
"once": false,
|
|
159
|
-
"onceDelay": "0.1",
|
|
160
|
-
"topic": "",
|
|
161
|
-
"payload": "true",
|
|
162
|
-
"payloadType": "bool",
|
|
163
|
-
"x": 130,
|
|
164
|
-
"y": 280,
|
|
165
|
-
"wires": [["switch_node_1"]]
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"id": "inject_switch_off",
|
|
169
|
-
"type": "inject",
|
|
170
|
-
"name": "开关OFF",
|
|
171
|
-
"props": [
|
|
172
|
-
{
|
|
173
|
-
"p": "payload"
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
"repeat": "",
|
|
177
|
-
"crontab": "",
|
|
178
|
-
"once": false,
|
|
179
|
-
"onceDelay": "0.1",
|
|
180
|
-
"topic": "",
|
|
181
|
-
"payload": "false",
|
|
182
|
-
"payloadType": "bool",
|
|
183
|
-
"x": 130,
|
|
184
|
-
"y": 320,
|
|
185
|
-
"wires": [["switch_node_1"]]
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
|