Hi, I want to have a button to start reading from a mqtt node. Some examples?
The MQTT in node will send a message every time someone writes to the MQTT topic you subscribed to, you can't disable it from inside a flow (though you can from inside the editor, but that's probably not what you intend).
So you have build some kind of gate, using a
switch node and a context variable, like in this example from the cookbook. https://cookbook.nodered.org/basic/route-on-context
You can then set the state of the context variable using Dashboard buttons, the
switch node will allow/deny messages depending on the state of that variable.
Or, alternatively, have a look at the gate node:
+1 for the simple-gate node, it is perfect for this type of use case, blocking or allowing the mqtt messages through as desired.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.