AND multiple triggers

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
User avatar
maw
Posts: 1
Joined: 08 Nov 2019 22:36

AND multiple triggers

Post by maw » 10 Nov 2019 00:21

I think I need an AND trigger unless someone can suggest a way to accomplish this.

When I'm connected to my office wifi during work hours I want to mute the phone. If I set a wifi-connected trigger and add a time condition it won't work if I arrive early. Any suggestions how to accomplish that?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: AND multiple triggers

Post by Desmanto » 10 Nov 2019 18:05

Tirggers always work as OR logic. The only way you can use AND is to add condition to it. Or you can cascade the trigger by putting the other AND trigger in other flow and enabled it after the first flow is triggered.

For your case, it can be simple. Use 2 flows. Use the 2nd flow as the buffer to make sure the mute is executed if you arrived early.
Flow 1
Trigger : Wifi Connected
Condition : Time Range : your office hour
[True] Action : Mute the phone (or whatever your set of actions)
[False] Action : Set Flow State : Flow 2 > enabled

Flow 2
Trigger : Time : your office hour starting time
Action : Mute the phone
Action : Set Flow State : Flow 2 > disabled.

Testing the flow in 2 scenarios :
1. Arrive early : Flow 1 triggered, not office hour, enable flow 2. After office hour reached, flow 2 mute the phone and disabled itself (one time use)
2. Arrive within office hour (or late) : Flow 1 triggered and immediately mute the phone. Flow 2 never used.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply