Can be stop interval flow with function

Hi

I query a mysql database with function for last data and send to mqtt but i use inject interval every 1 sec i need to stop interval when i get a mqtt message to stop sending but if the last data has change i need to start send again and wait mqtt stop

Use a flow or context variable that is set by your MQTT message. Use a switch node to only allow data through if the variable is set. To resume data flow, you should be able to use the rbe node followed by a change node to reset the variable.

In fact though, you might want to review your approach since it may be that you only need the rbe node on its own.

Can be a sample for me ?

Sorry, I'm at work.

Start by adding an rbe node downstream of your query output so that you can see how it works. Then add a change node after that that sets a flow variable - perhaps to false. Then add another flow that listens to the MQTT topic and uses a change node to set the flow variable to true. Finally, work out where to put the switch node that checks the variable and only allows the message to pass if it is false.

Along the way, think about ways to simplify the logic because it strikes me that you've invented an approach in your head that could actually be greatly simplified.

1 Like

Ok i will try this and show you the output thank sir