Built-in variables in a Variable Value State context

268 views
Skip to first unread message

jmjc...@gmail.com

unread,
Jan 21, 2021, 2:26:27 AM1/21/21
to Tasker
Don't know starting when, we can use built-in variables (not dynamic or monitored) in a variable value state context. Used to throw an error I think.

Joao, is it intentional? How does it work? How often is the value checked? I tried the %LAPP, %WIFI, and %TIMES variables and got mixed results. Sometimes it worked but sometimes it didn't.


João Dias

unread,
Jan 21, 2021, 4:36:41 AM1/21/21
to tas...@googlegroups.com
Hi. I didn't change that. It was always the case that some variables could be used and some couldn't :)

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

Rich D

unread,
Jan 21, 2021, 4:47:28 AM1/21/21
to Tasker Google Groups Post

Hi. I didn't change that. It was always the case that some variables could be used and some couldn't :)

As far as I know any variable that is not monitored could not be used in a context. When you tried to use them you would get a warning toast. If you try to use %TIME in a "Event" variable changed context you will get that toast.  Users have been asking since the beginning of tasker for %TIMES to be available in a context. 

jmjc...@gmail.com

unread,
Jan 21, 2021, 5:26:24 AM1/21/21
to Tasker
Then it is strange. For example, you could not use %TIMES in a variable state context before but you can now!

jmjc...@gmail.com

unread,
Jan 21, 2021, 5:31:47 AM1/21/21
to Tasker
Exactly that. Built-in variables that are not monitored could not be used in a variable state context before. If you tried, you will get an error! But now, with the latest beta, there is no error and it seems to work as well, although not reliably.

João Dias

unread,
Jan 21, 2021, 5:55:49 AM1/21/21
to tas...@googlegroups.com
Oops! Turns out I did change that! Can't remember why! Maybe some test I was doing at the time? I didn't even include it in the changelogs... I'll need to revert that! As you said, this may not be working consistently!

jmjc...@gmail.com

unread,
Jan 21, 2021, 5:59:02 AM1/21/21
to Tasker
Oh, I was so excited to see that change....:-(

Rich D

unread,
Jan 21, 2021, 6:00:59 AM1/21/21
to Tasker Google Groups Post
I'm pretty sure it's just a bug that crept in from somewhere. it doesn't make sense that you could use it in a state context and not a event context.  You could always use it in a hacky way on the right side of the equation in a state context but again it was never reliable. 

jmjc...@gmail.com

unread,
Jan 21, 2021, 6:12:36 AM1/21/21
to Tasker
I have a logcat profile that fires every 5 seconds to run some tasks when I am at the office. It works fine but when I found out I could use %TIMES, I created a variable state profile with this:

If %TIMES ~R [0-4]$

Hoping it will work and replace my old logcat profile. It works but not consistently.

João Dias

unread,
Jan 21, 2021, 6:14:46 AM1/21/21
to tas...@googlegroups.com
Ok, reverted. Not sure if you need it but here's a version with the restriction again: https://drive.google.com/file/d/1SvQFvAxFwCk-hArfO_6wOH0UlvvMGi0z/view?usp=sharing

Ian Grody

unread,
Jan 27, 2021, 10:08:45 AM1/27/21
to Tasker
It would be useful to get a list of devices where this is an issue. I used a Modulus as a state with %TIMES (%TIMES%10 > 8 for example) and it works absolutely brilliant on several devices; Sony M2, Moto G Falcon (both 1GB 7.1.2), Sony XA2 and XZP, Moto e6, Sony SW3 by way of kidapp and in both MM and N Android x86 running on laptops or VM's.

When it was added, I found it by accident and now use the modulus for refined timing rather than loop/wait a Task. It is considerably more reliable than the wait/loop.

João Dias

unread,
Jan 27, 2021, 11:35:23 AM1/27/21
to tas...@googlegroups.com
Would be great if everyone could let us know where this wasn't working and in what situations :) Thanks!

Rich D

unread,
Jan 27, 2021, 6:13:29 PM1/27/21
to Tasker Google Groups Post

Would be great if everyone could let us know where this wasn't working and in what situations :) Thanks!

It is my understanding that unmonitored variables only work in a context when something else in tasker calls the variable so it gets set and then the context will see it. I have confirmed this by using them on the right side of a context equation. I assume it is the fact that %TIMES is continually being set that allows the Modulus to work. Perhaps you could make a exception to the rule to allow  %TIMES% to be used.  Even if it does not work on every device there are certainly already tasker actions that do not work on certain devices so the protocol is already in place. 

jmjc...@gmail.com

unread,
Jan 27, 2021, 8:30:06 PM1/27/21
to Tasker
It doesn't work CONSISTENTLY on all my Samsung devices (S20, S6 Tablet and Note 10). 

But I agree that since some Tasker actions/contexts don't work on all devices anyway, it will be beneficial to those who find this useful and working on their devices.

%TIMES is quite useful. If Joao could make %TIMES an exception, as Rich suggested, OR somehow create a NEW context that allows users to run some tasks every x seconds, that would be great. 

For now, my workaround is to use the Logcat Event. I use "~R\d" in the Filter field. This will fire all the time since every single log has a number, i.e. the timestamp. That I use the Cooldown time to control the frequency. This works but not very precise. For example, if I set the Cooldown time to 10 seconds. It will run consistently every 10/11 seconds as long as I am using the phone. But when the phone idles (and apprantely goes to sleep or deep sleep mode I think BUT Tasker not being killed), it becomes not precise, meaning it will run every 10, 12, 28 seconds or even over a minute, instead of always 10.

Rich D

unread,
Jan 28, 2021, 5:10:47 AM1/28/21
to Tasker Google Groups Post


%TIMES is quite useful. If Joao could make %TIMES an exception, as Rich suggested,

Just to clarify.. I was suggesting allowing %TIMES%  in the context to allow the Modulus to work on some devices with some sort of warning toast that it might not work on all devices. %TIMES would still not be allowed.

OR somehow create a NEW context that allows users to run some tasks every x seconds, that would be great. 

That is something that has been needed for a long while. 


For now, my workaround is to use the Logcat Event.

Wow.. Sounds complex... Have you tried the context of intent received for the 'time click'.  I have never used it but I believe that has been the accepted workaround for a long time now. 

jmjc...@gmail.com

unread,
Jan 28, 2021, 7:21:43 AM1/28/21
to Tasker
TIME_TICK is fired once per minute. Not frequent enough.

Rich D

unread,
Jan 28, 2021, 1:02:57 PM1/28/21
to Tasker Google Groups Post

TIME_TICK is fired once per minute. Not frequent enough.

Ahh..  of course. Not sure what I was thinking with that,, or wasn't thinking.. ¯\_(ツ)_/¯

João Dias

unread,
Feb 9, 2021, 9:17:56 AM2/9/21
to tas...@googlegroups.com
Ok, I decided to create a new Tick event in Tasker that can trigger with a defined time interval as small as 100 ms. Can you please try this version? https://drive.google.com/file/d/1SvQFvAxFwCk-hArfO_6wOH0UlvvMGi0z/view?usp=sharing

What do you think?
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Rich D

unread,
Feb 10, 2021, 5:05:14 AM2/10/21
to Tasker Google Groups Post


What do you think?


Ahhhh... Now this we have needed for a very long time...  Awesome work... Taking it out for a test drive now, will let you know if there are any issue...  👍👍👍👍👍👍👍

João Dias

unread,
Feb 10, 2021, 6:19:18 AM2/10/21
to tas...@googlegroups.com
Great! :) Let me know how it goes.

jmjc...@gmail.com

unread,
Feb 10, 2021, 6:30:57 AM2/10/21
to Tasker
Test

jmjc...@gmail.com

unread,
Feb 10, 2021, 6:34:15 AM2/10/21
to Tasker
Hi Joao,

On my old Huawei on A9, I set it to 30 seconds and it works for about 2 hours or so and then the trigger time gets longer and longer.

On my Samsung on A10, it works fine when display is on but stops firing as soon as display goes off.

Jimmy Jimmy

unread,
Feb 12, 2021, 4:31:39 AM2/12/21
to tas...@googlegroups.com
Thanks Joao. I tried to reply in the group but somehow my reply gets deleted again and again.

The profile works great when display is on but it stops firing as soon as display goes off.

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/xfV4iRjkO-4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/CAG6Z%2BFfaM18G_SYvZax5BNTx8JHzU7VegGabZBtzCY7RQJHzCA%40mail.gmail.com.

João Dias

unread,
Feb 12, 2021, 4:33:36 AM2/12/21
to tas...@googlegroups.com
Maybe your phone is killing Tasker? 
To make sure Tasker and the AutoApps run in the foreground please check here: https://tasker.joaoapps.com/userguide/en/faqs/faq-problem.html#00

Pay special attention to the location part. If Tasker doesn't have permission to get location in the background it might not work correctly, so disable and re-enable the location permission and make sure that you allow Tasker to always access it.

Make sure to check here too: https://dontkillmyapp.com/?app=Tasker

Hope this helps!


Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


On Fri, Feb 12, 2021 at 9:31 AM jmjc...@gmail.com <jmjc...@gmail.com> wrote:
Thanks Joao. It works when display is on but as soon as display goes off, it stops firing.
--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/fb509be1-3c2b-44d7-95a6-4f489aa7cb6bn%40googlegroups.com.

jmjc...@gmail.com

unread,
Feb 12, 2021, 9:05:34 AM2/12/21
to Tasker
Thanks Joao. But I am afraid the issue is not due to Tasker being killed in the background. I have a time context profile that fires every 2 minutes. That works perfectly for hours, even days. But the Tick event doesn't. It works perfectly while display is on. But after display is off, slowly the firing time gets longer and longer. Probably has to do with phone going to deep sleep? But Tasker is not killed. That Tick event does continue to fire. Just not every 30 seconds as I set it.

João Dias

unread,
Feb 16, 2021, 9:24:36 AM2/16/21
to tas...@googlegroups.com
Thanks. But does it ever stop working altogether? Or does it always continue working just with a delay?

João Dias

unread,
Feb 16, 2021, 9:27:49 AM2/16/21
to tas...@googlegroups.com
Also, does it run correctly again as soon as you turn on the display? Or do you need to reset something?

jmjc...@gmail.com

unread,
Feb 16, 2021, 10:00:06 AM2/16/21
to Tasker
Yes, the tick continues to work forever. Just that there is a random delay when display is off. Tasker is not killed. That event is not killed and is being triggered.

And yes, as soon as display is back on, it works perfectly again immediately with the 30 seconds interval without me doing anything.

João Dias

unread,
Feb 16, 2021, 10:06:18 AM2/16/21
to tas...@googlegroups.com
Unfortunately, unless I use alarms like the Time context does, I think that is bound to happen, yes. How long of a delay do you experience after a while? 

jmjc...@gmail.com

unread,
Feb 17, 2021, 1:51:07 AM2/17/21
to Tasker
Tick is set to 30 seconds. I have created a log (below) for your reference. 

When display is on, works perfectly. When display is off, delay happens immediately and the delay time is very random. Then if display turns on, it works again immediately.

Display On
11:27:50 Tick
11:28:20 Tick
11:28:50 Tick
11:29:20 Tick
11:29:50 Tick
11:30:20 Tick
11:30:50 Tick
11:31:20 Tick
11:31:50 Tick
11:32:20 Tick
11:32:50 Tick
11:33:18 Display Off
11:34:26 Tick
11:49:00 Tick
12:04:33 Tick
12:10:35 Tick
12:30:04 Tick
12:34:47 Tick
12:48:27 Tick
13:00:00 Tick
13:21:07 Tick
13:30:01 Tick
13:40:06 Tick
13:46:09 Tick
14:04:39 Tick
14:10:28 Display On
14:10:50 Tick
14:11:20 Tick
14:11:50 Tick
14:12:20 Tick
14:12:50 Tick
14:13:20 Tick
14:13:50 Tick
14:14:20 Tick

Possible to use alarms in Tick? OR make Time context work with seconds?

João Dias

unread,
Feb 24, 2021, 7:03:00 AM2/24/21
to tas...@googlegroups.com
Ok, I think I may have something. Thanks for your help!! Can you please try this version? https://drive.google.com/file/d/1SvQFvAxFwCk-hArfO_6wOH0UlvvMGi0z/view?usp=sharing


   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.

jmjc...@gmail.com

unread,
Feb 24, 2021, 7:52:34 AM2/24/21
to Tasker
Thanks a lot Joao! Will test it right away. What have been changed?

João Dias

unread,
Feb 24, 2021, 7:55:45 AM2/24/21
to tas...@googlegroups.com
I'm now securing a wakelock whenever a tick event is active. I've been trying for the past 2 hours and it seems stable to me on my Pixel 2 at least...

jmjc...@gmail.com

unread,
Feb 24, 2021, 10:36:57 AM2/24/21
to Tasker
Awesome, it worked perfectly! Thanks a lot! This feature has been badly needed!

João Dias

unread,
Feb 24, 2021, 10:38:03 AM2/24/21
to tas...@googlegroups.com
Awesome :) Glad it works!!
Reply all
Reply to author
Forward
0 new messages