How to trigger a profile every x seconds

1,665 views
Skip to first unread message

Nat101

unread,
Nov 20, 2013, 9:04:15 PM11/20/13
to tas...@googlegroups.com
Currently time profiles allows >= 2 minutes to fire. Certainly you can fire events at a more fine grained level. (Suppose I want to update a clock every x seconds.)
I am wondering if I am missing something very basic here.
Thank you.
nat

Matt R

unread,
Nov 20, 2013, 9:10:43 PM11/20/13
to tas...@googlegroups.com
You'll have to do a wait X seconds (or milliseconds) and a goto action to loop.

Matt

Nat101

unread,
Nov 20, 2013, 10:47:29 PM11/20/13
to tas...@googlegroups.com
That's neat. Working nicely.
Question: If I have an [intended] endless loop (with a wait X and got top) inside a profile that triggers every 2 minutes, does turning the profile off (in any other task or widget action) kill/destroy that loop, or no - since its in a loop it will continue even if profile is off? I assume that latter, so I have the GOTO conditional based on a global variable, but am wondering maybe closing a profile is like destroying a scene regardless of what is going on inside it.
Thank you much!
nat

Matt R

unread,
Nov 20, 2013, 10:54:07 PM11/20/13
to tas...@googlegroups.com
No, the profile going inactive doesn't stop any tasks that profile started.  But you could make the goto conditional on the profile being in the %PACTIVE variable, no need to make your own global variable.  You can read about the profile active variable in the userguide.

Matt

Nat101

unread,
Nov 20, 2013, 11:23:15 PM11/20/13
to tas...@googlegroups.com
Aye. Thanks.
nat
ps. Just noticed :) Does Tasker have an event if x RHYMES with y? (Good night Matt - from Nat..)

Nat101

unread,
Nov 21, 2013, 5:07:43 PM11/21/13
to tas...@googlegroups.com
%PACTIVE returns %PACTIVE.
Seems to be a problem with this. Have read other threads on this and followed the advice given.
No go. LG PRO.
Back to global variable for now.
nat

Bob Hansen

unread,
Nov 21, 2013, 5:18:37 PM11/21/13
to tas...@googlegroups.com
%PACTIVE is compared to the launching profile's name. If it is still active it will be in the list so it will match and the If statement will be true. The astrisks are necessary for the search to work.

You need to use %PACTIVE like in this example.

Profile: Screen off (351)
State: Display State [ Is:Off ]
Enter: Loop (350)
A1: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ] 
A2: Stop If [ %PACTIVE !~ *Loop* ]
A3: Flash [ Text:  loop ]
A4: Goto 1

Rich D

unread,
Nov 21, 2013, 5:23:35 PM11/21/13
to tas...@googlegroups.com

> %PACTIVE returns %PACTIVE.
> Seems to be a problem with this. Have read other threads on this and followed the advice given.
> No go. LG PRO.
> Back to global variable for now.

Well that does not sound correct......

Are you sure there where active profiles when you flashed it.

What happens with a simple test like

Profile: Test
Context: state / display on
Task:
1. Wait 5 sec
2. Flash %PACTIVE

Make sure you save all the way out of tasker then turn screen off and on..

Nat101

unread,
Nov 21, 2013, 5:25:09 PM11/21/13
to tas...@googlegroups.com
Shouldn't a dump (Flash) of %PACTIVE show something other than %PACTIVE, when profile is active? (Even without the loop you posted? [btw, thanks]) That loop is great when I want to match, but a simple dump of the variable should not come up empty, no?

Matt R

unread,
Nov 21, 2013, 5:26:41 PM11/21/13
to tas...@googlegroups.com
Make sure your profile has a name (not the generated name based on the contexts).  Long-press and select the "A" at the top to name it.

Matt

Nat101

unread,
Nov 21, 2013, 5:28:48 PM11/21/13
to tas...@googlegroups.com
One second...
My profile is time-based. In other words it's triggered every x minutes. Maybe a time trigger does not kick in at the moment it's flipped on programmatically.
I Need to check this out.

Rich D

unread,
Nov 21, 2013, 6:37:13 PM11/21/13
to tas...@googlegroups.com

> My profile is time-based. In other words it's triggered every x minutes.

'Every x min' is treated as a event so it is instantaneous and would not be listed in %PACTIVE....

Nat101

unread,
Nov 21, 2013, 7:31:35 PM11/21/13
to tas...@googlegroups.com
> Every x min' is treated as a event so it is instantaneous and would not be listed in %PACTIVE
Voila! Yes!
I suspected something related to time based trigger but couldn't get the handle on it. You clarified it.
One minute... A counter argument just hit (see, I AM confused!) me. A time based profile that fires every x minutes, even after it fires it is dormant and waiting for the next x minutes, therefore it SHOULD be active since it is waiting for x to fire, as opposed to not watching x at all when it is truly inactive.

nat

Nat101

unread,
Nov 21, 2013, 7:38:33 PM11/21/13
to tas...@googlegroups.com
Profile has a name.
Actually, the only reason I am using a time based profile in this case is to automatically fill a time-elapsed field, and I really need it to fire every few seconds, which is why you advised me on the label-wait-goto loop. Since I need to start and stop this loop programmatically only, I don't need a profile at all for this! 
So, although I want to know the scoop on %PACTIVE, in this case I don't think I'll use it.
nat

Rich D

unread,
Nov 21, 2013, 7:46:43 PM11/21/13
to Tasker Google Groups Post
 
 A counter argument just hit (see, I AM confused!)

yes, you are confused..:)
 
A time based profile that fires every x minutes, even after it fires it is dormant and waiting for the next x minutes

no, it is not dormant. It is always waiting (monitoring) for x to fire. once it fires it instantly goes back to monitoring for x to fire

if you set the time context for 4:00 to 4:01 this is a 'state' context and will be 'active' for 1 minute

    

Matt R

unread,
Nov 21, 2013, 7:50:26 PM11/21/13
to tas...@googlegroups.com
If that were the case you'd have it muddled with a non-repeating (continuous) time context that spans from x time to y time.  And you'd have the profile setting off tasks when it's already "active".  I think it makes more sense to not consider it "active" except for the exact moment it triggers, fitting it well with the other event triggers.

Matt

Nat101

unread,
Nov 21, 2013, 8:09:26 PM11/21/13
to tas...@googlegroups.com
> If that were the case you'd have it muddled with a non-repeating (continuous) time context that spans from x time to y time.  And you'd have the profile setting off tasks when it's already "active".

I thought about that and concluded (maybe incorrectly) that unlike typical programming timers that fire new events every x time, overlapping as it may, Tasker time profiles are different, in that that it is either on or off (that is why there is a manual switch on the profile). And if ON, turning it on again should have no effect. Suppose I had it on manually, then ran a task that turned it on, should have no effect since it is already on. 

> I think it makes more sense to not consider it "active" except for the exact moment it triggers, fitting it well with the other event triggers.
On contrair. It will differ in that %PACTIVE is useless [for these profiles] and that would be a documented exception to the %PACTIVE rule.
nat

Matt R

unread,
Nov 21, 2013, 8:17:11 PM11/21/13
to tas...@googlegroups.com
You lost me there, but you might be confusing a profile being active with a profile being enabled.  The switch in Tasker enables/disables the profile, but does not make it active.

And %PACTIVE is useless for all event triggers ... just like repeating time contexts ... ?

Matt

Nat101

unread,
Nov 21, 2013, 8:39:19 PM11/21/13
to tas...@googlegroups.com
The switch in Tasker enables/disables the profile, but does not make it active.
You gave me something to think about:) 
Reply all
Reply to author
Forward
0 new messages