Set/reset variable

I need to set a variable depending on whether one or more doors are open.

It works fine when I do like this:
TRIGGER
When BottonX is pushed
FLOW
When Door1 OR Door2 OR Door3 are open
then set variableA to True - else set variableA to False

But if I remove the Trigger (When BottonX is pushed) it no longer works.

Is it not possible to have a Flow without having a Trigger?

Sort of. You can have a rule without a trigger, but it will never run unless it is manually executed (eg. from a dashboard).

If your goal is to have the rule run when any of those doors open, then you would want to add the doors to your Triggers as well. Something like the following.

*Note that the IF Condition itself was edited to change from ALL → ANY

PS. Here’s a an old post describing Triggers vs Flows that you might find helpful. It’s a bit dated in that it doesn’t include some of the newer features like HTTP triggers, but it covers the main concepts.

Thanks for a quick reply.
The reason why I want to set a variable depending on whether a door or window is open is that I have 13 door and window sensors and if I make a rule that includes them all, the system is slow to respond. So if I could just check a variable the response time would be faster. OK - I will survive.

1 Like

That sounds like a really excellent use case for this.

The approach I showed in my screenshot above should work for you. You can include the doors in the trigger and the condition… then set your variable accordingly (then do the same for your windows separately).

Then you would have two variables that you could reference directly in your rules and that should be really efficient. As you alluded to, when you have all the devices in a single IF Condition, the system has to query the status for each of them. And currently, checking the status in IF Conditions actually queries the source smart home platform directly, so it can add a bit of latency. So centralizing that into a variable makes a lot of sense! :sunglasses::brain:

1 Like

Thank you very much
I will try to work with your suggestion.
Have a good day

1 Like

Just for the record - I have now done as you suggested and it works perfectly. Thanks.

2 Likes