Successive SMS received trigger

Post your questions and help other users.

Moderator: Martin

Post Reply
Gen
Posts: 20
Joined: 09 Mar 2019 10:02

Successive SMS received trigger

Post by Gen » 04 Sep 2019 13:34

Hi,

I'm trying to create a trigger that will execute a flow only when my phone receives 3 SMS messages within 5 seconds.

At the moment I have a trigger of SMS received followed by a script action which increments a global variable by 1 and a separate branch that sleeps for 5 seconds and resets the variable to 0. I have an expression branching from the script action which checks if the variable equals to 3 and then performs my flow actions.

I don't think this is ideal because the flow seems to wait for 5 seconds before executing the rest of the flow even if my phone receives 3 SMS messages within the first second.

Could someone please advise on a better way to achieve this? I basically just need the flow to execute only if I receive x amount of SMS messages within y amount of seconds.

Thanks!
Gen.

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

Re: Successive SMS received trigger

Post by Desmanto » 05 Sep 2019 01:41

Use condition execution count, 3 times, tick timed, use 5s. True, go to your main branch of the flow. False, do nothing

This execution count will act as buffer to protect your main flow. It will only continue after it has been executed 3 times within 5 seconds. It reset after the time (5s), so the count reset to 0.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200117 Official, Android Pie 9.0, Rooted.

Gen
Posts: 20
Joined: 09 Mar 2019 10:02

Re: Successive SMS received trigger

Post by Gen » 05 Sep 2019 07:03

Perfect, thanks!

Didn't know there was such a condition :)

Post Reply