node-red-contrib-symi-modbus 2.8.4 → 2.8.5

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.
@@ -378,25 +378,9 @@ module.exports = function(RED) {
378
378
  node.log(`注销数据监听器,当前监听器数量: ${node.dataListeners.length}`);
379
379
  }
380
380
 
381
- // 如果没有监听器了,关闭连接
382
- if (node.dataListeners.length === 0 && node.connection) {
383
- if (node.connectionType === 'tcp') {
384
- if (!node.connection.destroyed) {
385
- node.connection.destroy();
386
- node.log('所有监听器已注销,TCP连接已关闭');
387
- }
388
- } else {
389
- if (node.connection.isOpen) {
390
- node.connection.close((err) => {
391
- if (err) {
392
- node.error(`串口关闭失败: ${err.message}`);
393
- } else {
394
- node.log('所有监听器已注销,串口已关闭');
395
- }
396
- });
397
- }
398
- }
399
- }
381
+ // 保持连接永久打开,不关闭串口/TCP
382
+ // 原因:避免部署时频繁开关导致串口锁定和连接不稳定
383
+ // 连接只在节点关闭(node.on('close'))时才会被关闭
400
384
  };
401
385
 
402
386
  // 设置触发源(用于优先队列)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-symi-modbus",
3
- "version": "2.8.4",
3
+ "version": "2.8.5",
4
4
  "description": "Node-RED Modbus节点,支持TCP/串口通信、串口自动搜索、多设备轮询、可选MQTT集成(支持纯本地模式和MQTT模式)、Home Assistant自动发现、HomeKit网桥、可视化控制看板、自定义协议转换和物理开关面板双向同步,工控机长期稳定运行",
5
5
  "main": "nodes/modbus-master.js",
6
6
  "scripts": {