Periodic Timer - Using variable

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
xpdev
Posts: 59
Joined: 16 Sep 2014 06:20
Location: Italy

Periodic Timer - Using variable

Post by xpdev » 20 Jun 2018 11:32

Hi Martin, a little request, if possible.

When setting "Period timer" , field "Interval" accept only string value, but not variable.

Is it possible to make a change in order to use a variable in the "Interval" field?

This modification would make the same "Flow" usable by modifying the range of use simply by changing the variable value.

Thanks
Xiaomi MI 6

Rom Miui 10 EU STABLE

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

Re: Periodic Timer - Using variable

Post by Desmanto » 20 Jun 2018 17:06

I might need this some day, so +1.

Meanwhile, the other workaround for it is using Glovar datetime. Use a glovar datetime trigger and use a glovar for it. In each execution use

Code: Select all

global_period_timer = getDate() + global_period_interval;
So every execution will add the current time to the interval you have, essentially making it to execute again after the interval. The downside is you need the extra glovar to store the time.
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.

User avatar
xpdev
Posts: 59
Joined: 16 Sep 2014 06:20
Location: Italy

Re: Periodic Timer - Using variable

Post by xpdev » 21 Jun 2018 07:44

Thank you, waiting Martin answer, i'll use your way.
Xiaomi MI 6

Rom Miui 10 EU STABLE

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Periodic Timer - Using variable

Post by Martin » 21 Jun 2018 19:32

Hi,

I recommend to use the method Desmanto mentioned. Supporting variables in triggers is on my todo list but has quite a low priority since I did not yet have a good general idea how it can be achieved in a way that does not lead to unexpected side effects and performance issues.
One option might be to consider the variables only at the time the trigger is registered but not afterwards so you would have to disable and enable the flow when the variable is modified. Would this be helpful to solve your case?

Regards,
Martin

User avatar
xpdev
Posts: 59
Joined: 16 Sep 2014 06:20
Location: Italy

Re: Periodic Timer - Using variable

Post by xpdev » 22 Jun 2018 08:24

Thanks for the reply Martin

"Would it help to solve your case?"

No, it would not be useful, the variable could change and it would be a problem to deactivate and reactivate the flow.

I have tested the method Desmanto mentioned, it works well and not problems.

Ps Martin this is a great app !!!
Xiaomi MI 6

Rom Miui 10 EU STABLE

Locked