Disable flow by pressing an input boolean

Hello, I need to disable flow action when a certain input boolean is disabled. Here is my flow and where I want to interrupt it.

What is the common way to do this ?

Thanks

There is 2 ways:

  1. You put your current_status node in the flow, with an additional switch to interrupt if the status is/isn’t what you want (but you might lose the value of the aria_aqi sensor if you do not move it in another part of the payload).
  2. You change to a state_changed and, depending of the value, you set a flow variable that an additional function where you want to interrupt,that will check for the flow variable to go further or not.

To play with flow variable (context), you need functions

To get a value from context:

var myBoolean = flow.get("myBoolean");

To set a value:

flow.set("myBoolean", true);

I solve in this way…probably not the most elegant

It is ok, it was my first proposal more or less, current_status + switch.
You inverted the two so you are not interrupting at the place you asked for but should work.

The only pitfall is that it is no longer triggered by a change in the sensor but with the injection of a timestamp, which is more consuming (pull instead of push).

yes more or less, I didn’t use your solution simply because I am not able to move sensor data to another part of the payload.

In your current state node configuration remove the lines in “output properties” section
Screenshot 2023-02-27 100917

then it should not change the payload at all but if your boolean is true pass the unmolested message on no message if its false.

What if I want the message passed unchanged if the boolean is false, E.G. for a vacation logic.