节点红色获取Modbus TCP读取状态更改

时间:2017-02-14 07:58:43

标签: node-red

有没有办法让Modbus读取节点状态发生变化?该节点有一个"活动标签"它显示状态(读取,轮询,错误,超时等..)是否有办法将其作为msg.payload?

Here an example of the Modbus Read node with the "activity label" in bottom left corner

2 个答案:

答案 0 :(得分:0)

查看Status节点,它是节点代码集的一部分,应该允许您选择您感兴趣的节点并接收其状态的更新。

Node-red Status node

答案 1 :(得分:0)

感谢Hardillb不知道该节点!我刚刚为Modbus状态管理做了一个简单但有用的流程,其中一个触发器只在错误时间> 1时发送输出。阅读时间。这是流程:

[{"id":"f2ad55d5.52afe8","type":"status","z":"e34a61f.64e60a","name":"modbus status","scope":["b294ab2d.91ac88"],"x":323,"y":545,"wires":[["14f7bc93.c66a23"]]},{"id":"14f7bc93.c66a23","type":"function","z":"e34a61f.64e60a","name":"Parse error","func":"var status = msg.status.text;\n\nvar error = false;\n\nmsg = {};\n\nstatus = status.split(\" \");\n\nswitch(status[0]){\n    case \"timeout\":\n    case \"EMPTY\":\n    case \"error\":\n    case \"waiting\":\n        error = true;\n}\n\nif(!error)\nmsg.reset = 1; //reset the trigger, no errors\n\nelse \nmsg.payload = true; //start trigger\n\n\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":547,"wires":[["a740b015.432ca"]]},{"id":"a740b015.432ca","type":"trigger","z":"e34a61f.64e60a","op1":"","op2":"{ \"status\": 400 }","op1type":"nul","op2type":"json","duration":"2000","extend":false,"units":"ms","reset":"","name":"Trigger error","x":786.5,"y":547,"wires":[["e82e77fe.eb8948"]]},{"id":"e82e77fe.eb8948","type":"debug","z":"e34a61f.64e60a","name":"","active":true,"console":"false","complete":"true","x":1007,"y":549,"wires":[]}]