node-red-contrib-symi-modbus 2.8.9 → 2.9.0
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 +8 -1
- package/nodes/modbus-slave-switch.js +8 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -888,7 +888,14 @@ HomeKit网桥节点无需输入消息,自动同步主站配置和状态。
|
|
|
888
888
|
|
|
889
889
|
## 版本信息
|
|
890
890
|
|
|
891
|
-
**当前版本**: v2.
|
|
891
|
+
**当前版本**: v2.9.0 (2025-12-05)
|
|
892
|
+
|
|
893
|
+
**v2.9.0 更新内容**:
|
|
894
|
+
- **重要修复**:一个按键现在可以控制多个不同从站的继电器
|
|
895
|
+
- 修复了全局防抖机制导致的问题:之前一个开关配置控制多个从站时,只有第一个从站会执行
|
|
896
|
+
- 现在支持:一个物理按键同时控制从站0A和0B的同一线圈,两个都会正确执行
|
|
897
|
+
- 优化防抖key设计,包含目标从站地址,确保不同目标互不影响
|
|
898
|
+
- RS-485开关、Mesh开关、Mesh场景模式均已修复
|
|
892
899
|
|
|
893
900
|
**v2.8.9 更新内容**:
|
|
894
901
|
- 新增Mesh开关无线模式支持,适用于场景触发按键
|
|
@@ -789,8 +789,9 @@ module.exports = function(RED) {
|
|
|
789
789
|
node.config.buttonType === 'scene' ||
|
|
790
790
|
buttonEvent.deviceType === 0x07;
|
|
791
791
|
|
|
792
|
-
//
|
|
793
|
-
|
|
792
|
+
// 全局防抖:防止同一个按键的同一个目标重复触发
|
|
793
|
+
// 包含targetSlaveAddress,允许一个按键控制多个不同从站的继电器
|
|
794
|
+
const debounceKey = `${node.config.switchId}-${node.config.buttonNumber}-${node.config.targetSlaveAddress}`;
|
|
794
795
|
const now = Date.now();
|
|
795
796
|
const lastTriggerTime = globalDebounceCache.get(debounceKey) || 0;
|
|
796
797
|
|
|
@@ -873,7 +874,8 @@ module.exports = function(RED) {
|
|
|
873
874
|
// 场景模式:跳过LED反馈锁和状态缓存检查,直接触发继电器
|
|
874
875
|
if (isSceneMode) {
|
|
875
876
|
// 场景模式:全局防抖(200ms内只触发一次)
|
|
876
|
-
|
|
877
|
+
// 包含targetSlaveAddress,允许一个按键控制多个不同从站的继电器
|
|
878
|
+
const debounceKey = `mesh-scene-${node.config.meshShortAddress}-${node.config.meshButtonNumber}-${node.config.targetSlaveAddress}`;
|
|
877
879
|
const lastTriggerTime = globalDebounceCache.get(debounceKey) || 0;
|
|
878
880
|
|
|
879
881
|
if (now - lastTriggerTime < 200) {
|
|
@@ -912,8 +914,9 @@ module.exports = function(RED) {
|
|
|
912
914
|
return;
|
|
913
915
|
}
|
|
914
916
|
|
|
915
|
-
//
|
|
916
|
-
|
|
917
|
+
// 第四步:全局防抖:防止同一个按键的同一个目标重复触发
|
|
918
|
+
// 包含targetSlaveAddress,允许一个按键控制多个不同从站的继电器
|
|
919
|
+
const debounceKey = `mesh-${node.config.meshShortAddress}-${node.config.meshButtonNumber}-${node.config.targetSlaveAddress}`;
|
|
917
920
|
now = Date.now();
|
|
918
921
|
const lastTriggerTime = globalDebounceCache.get(debounceKey) || 0;
|
|
919
922
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-symi-modbus",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Node-RED Modbus节点,支持TCP/串口通信、串口自动搜索、多设备轮询、可选MQTT集成(支持纯本地模式和MQTT模式)、Home Assistant自动发现、HomeKit网桥、可视化控制看板、自定义协议转换和物理开关面板双向同步,工控机长期稳定运行",
|
|
5
5
|
"main": "nodes/modbus-master.js",
|
|
6
6
|
"scripts": {
|