Re: Proximity Sensor delay

508 views
Skip to first unread message

Pent

unread,
Jun 7, 2012, 6:43:42 AM6/7/12
to Tasker
> So, I'd like to set up a delay for this task: ie. the app/action is
> launched only if the proximity sensor is covered for more than, say, one
> second (as when this task is enabled, it is very easy to inadvertently lock
> the screen).

Profile: Prox
Context: State: Proximity
Task:
Wait 1 Second
System Lock If %PACTIVE Matches *,Prox,*

i.e. only lock if it's still active (i.e. prox sensor still covered)
after a second.

> Finally, is it possible to specify to only run this task if the device is
> in portrait (or is 'device orientation' an upcoming feature?)?

A Display Orientation state is in the next version (then you can just
add it to the profile
as a new context).

Pent

Rigsby

unread,
Jun 7, 2012, 10:55:31 AM6/7/12
to tas...@googlegroups.com
Thank you for this; it looks like it will achieve what I need it to do.

As I'm new to Tasker, I'm not sure how I would use this script.  Could you please point me in the direction of a suitable reference?  I've checked the Userguide, but I'm not sure what I should be looking for (my Tasker is not in 'Beginner' mode).

------
Rigsby

Pent

unread,
Jun 7, 2012, 11:07:12 AM6/7/12
to Tasker
Well, at the moment you just have

System Lock

In your task, right ?

In the task edit screen for the existing task, click the + button
bottom leftish, select category Task, then action Wait. Set the second
slider to 1. Accept. Back in the Task edit screen, click and drag at
the right hand side of the Wait action to move it to the top of the
task.

Click on the System Lock action, click the If checkbox. At the LHS
enter %PACTIVE, click the middle button to select Matches, fill in
*,Prox,* in the RHS.

In the main screen, long-click the profile header to give it the name
Prox.

Pent

Stupifier

unread,
Jun 7, 2012, 5:27:14 PM6/7/12
to tas...@googlegroups.com
Wow, I'm so glad you mentioned this method.  I was accomplishing similar proximity sensor behavior in a MUCH more complicated/dirty way....it was requiring multiple profiles and extra variables.  It was also a PITA to figure out various wait timings with it.  Now, its sooo much smoother and reliable.  Thanks!  Now I can do a hand wave over the sensor and skip music tracks....OR hold my hand over the sensor for just a tiny bit and it will turn the screen on.  You're the best

Rigsby

unread,
Jun 8, 2012, 6:15:23 AM6/8/12
to tas...@googlegroups.com
Thanks for this Pent, it is now working for me.

------
Rigsby

francwalter

unread,
Dec 27, 2014, 10:55:25 AM12/27/14
to tas...@googlegroups.com
Am Donnerstag, 7. Juni 2012 12:43:42 UTC+2 schrieb Pent:
> So, I'd like to set up a delay for this task: ie. the app/action is
> launched only if the proximity sensor is covered for more than, say, one
> second (as when this task is enabled, it is very easy to inadvertently lock
> the screen).

Profile: Prox
Context: State: Proximity
Task:
Wait 1 Second
System Lock If %PACTIVE Matches *,Prox,*


Is it possible that in Tasker 4.6u1 this system variable %PACTIVE is not anymore defined?
I don't find it in the userguide :(

 

francwalter

unread,
Dec 27, 2014, 12:06:51 PM12/27/14
to tas...@googlegroups.com

Sorry, now I found it.
It is in Profiles Enabled (dynamic)
%PACTIVE
A comma-separated list of the currently active, named profiles in activation order. Duplicate names will appear on the list only once. The list always starts and ends with a comma to make matching easier, if it's not empty.


I have the problem, that the %PACTIVE doesn't reset fast enough. I tried a profile where I lock the display after five seconds, when Proximity is on. After five seconds (with "Wait") I check again if %PACTIVE still contains Off, if not I don't lock the display.
If I use an own variable which I reset with another (second) profile if Proximity is off, this works without problem. If I use the system variable %PACTIVE this doesn't work, maybe it doesn't contains Off, after five seconds, but the Proximity is off.
It is not reliable at all, with own variable and two profiles, no problem.


Rich D

unread,
Dec 27, 2014, 1:04:56 PM12/27/14
to Tasker Google Groups Post


> I have the problem, that the %PACTIVE doesn't reset fast enough. I tried a profile where I lock the display after five seconds, when Proximity is on. After five seconds (with "Wait") I check again if %PACTIVE still contains Off, if not I don't lock the display.
> If I use an own variable which I reset with another (second) profile if Proximity is off, this works without problem. If I use the system variable %PACTIVE this doesn't work, maybe it doesn't contains Off, after five seconds, but the Proximity is off.
> It is not reliable at all, with own variable and two profiles, no problem.

Enable and check the run log to see how things are actually flowing.  I have never had any delays or issues with the %PACTIVE variable.  In fact It should be faster and more reliable then a global variable set with a profile. 

Rich D

unread,
Dec 27, 2014, 1:09:34 PM12/27/14
to Tasker Google Groups Post


If you can not figure it out, paste your exported profile description with the run log results here.

To post your profile or task here...  Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export description to clipboard (not XML)

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).

Matt R

unread,
Dec 27, 2014, 11:45:55 PM12/27/14
to tas...@googlegroups.com
Is the profile name "off"?

Matt

francwalter

unread,
Dec 30, 2014, 1:36:06 PM12/30/14
to tas...@googlegroups.com
Am Sonntag, 28. Dezember 2014 05:45:55 UTC+1 schrieb Matt R:
Is the profile name "off"?

Matt

This was it! I thought all the time, that the variable %PACTIVE should contain "Proximity Off", but it contains the Profile name!!!
This was my mistake.
Corrected it and now it works, much simpler than my construct with two profiles :)
Thank You!
This is my Profile export now:

Profile: Display Off (93)
    State: Proximity Sensor
    Application: Not Kamera, Kamera...
    State: Not Call [ Type:Any Number:* ]
Enter: DisplayOff (99)
    A1: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
    A2: If [ %PACTIVE ~ *,Display Off,* ]
    A3: Secure Settings [ Configuration:Lock Device Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ]



Another thing I noticed often in the last times: when I edit a Profile this works only if I close tasker and restart it. This normal?
Second thing, sometimes really bad annoying: I work on a Action a while, close Tasker, reopen it again and all my work has gone, it is reset to a very previous version. I don't know if this behaviour is due to any setting in Tasker options, or something other weird thing I did on my phone, It is not all the time, but sometimes, I dont know when or why.


Rich D

unread,
Dec 30, 2014, 4:12:50 PM12/30/14
to Tasker Google Groups Post


> Another thing I noticed often in the last times: when I edit a Profile this works only if I close tasker and restart it. This normal?

Yes.   Most edits to tasks do not need to be saved before running in tasker but contexts definitely do need to be saved first. 

> Second thing, sometimes really bad annoying: I work on a Action a while, close Tasker, reopen it again and all my work has gone,

I do not believe this has ever happened to me. The only scenario I can think of that might cause this would be if you did not properly save out of tasker by using menu exit / save or by using the back button. Perhaps if you used the home button then if tasker is killed by android or another app i believe you would lose your edits.

Do you have tasker set to run in background in tasker preferences?  It is much more likely to be stopped by android if it is running in the background.  

francwalter

unread,
Dec 30, 2014, 4:49:54 PM12/30/14
to tas...@googlegroups.com
Am Dienstag, 30. Dezember 2014 22:12:50 UTC+1 schrieb Rich D:
> Second thing, sometimes really bad annoying: I work on a Action a while, close Tasker, reopen it again and all my work has gone,

I do not believe this has ever happened to me. The only scenario I can think of that might cause this would be if you did not properly save out of tasker by using menu exit / save or by using the back button. ...

I always leave with BACK button. I guess this does not automatically save the task or scene (it happened me sometimes in scenes too !)?
But this must be some of by me self-created issue, if you don't happened it.
It is already good to know that it is not just a setting or a wellknown problem, so I will find it eventually in my stuff :)
Thanks!

Rich D

unread,
Dec 30, 2014, 6:17:42 PM12/30/14
to Tasker Google Groups Post


> I always leave with BACK button. I guess this does not automatically save the task or scene (it happened me sometimes in scenes too !)?

Using the back button to exit tasker should definitely save all tasker data. You could try the menu / exit / save to see if it makes a difference. 

Frank Röhm

unread,
Dec 31, 2014, 7:50:59 AM12/31/14
to tas...@googlegroups.com
Am 31.12.2014 um 00:17 schrieb Rich D:
>
> ... You could try the menu / exit / save to see if it makes a
> difference.
>

I have no 'save' in the menu, there is only 'Exit', which exits
immediately, no 'save' after this menu.
I guess you mean 'Exit' which does a implicite 'save'?

Is there any menu item where I can explitely save a task, like this
would be in Windows or Mac? Here on Android it is mostly all the time
immediate saving, isnt it?


Once I will find out, what exactly is reverting from time to time my
already saved tasks or scenes, it must be something only on my device,
some constellation or other app doing this.
If it would have anything to do with some preferences in Tasker, you
would know and suggest, I am sure.

By the way, I have not checked the setting "Run in Foreground", I had
never problems with a profile not launched yet. Tasker runs all the
time, doing his schedule reliable.





Jeremy Harris

unread,
Dec 31, 2014, 3:37:36 PM12/31/14
to tas...@googlegroups.com
Do you happen to have any profiles that kill apps? I have one with a proximity context and one with a shake context. Occasionally one of those profiles is left on by accident and I end up killing tasker unintentionally while working on a task.

Probably you don't have that, but to Rich's point, the symptoms are identical to what you've described.

Rich D

unread,
Dec 31, 2014, 4:48:58 PM12/31/14
to Tasker Google Groups Post

> I have no 'save' in the menu, there is only 'Exit', which exits
> immediately, no 'save' after this menu.
> I guess you mean 'Exit' which does a implicite 'save'?

You will only see the save option if you have made changes and there is something to save.

>
> Is there any menu item where I can explitely save a task, like this

If you mean 'save and continue'  IE -save and do not exit then no, It has been asked for before but I can not recall Pents response.  It would be a very useful option.  :)

francwalter

unread,
Jan 1, 2015, 8:13:40 AM1/1/15
to tas...@googlegroups.com
Am Mittwoch, 31. Dezember 2014 22:48:58 UTC+1 schrieb Rich D:


> I guess you mean 'Exit' which does a implicite 'save'?

You will only see the save option if you have made changes and there is something to save.

OK now I see. If I have changes and press Exit from menu I get a MessageBox with Cancel, Save & Exit, and Exit (without save).
Never saw this before, exiting always with BACK Button.
So this means the saving is done on exiting. Here must be something wrong on my phone then. Maybe my System kills Tasker too fast sometimes, not letting it time to save.

@Jeremy Harris: I have no tools to kill apps running or running in background (e.g. Taskkiller etc.)


If you mean 'save and continue'  IE -save and do not exit then no, It has been asked for before but I can not recall Pents response.  It would be a very useful option.  :)


YES!
In my situation this would be a useful thing. After editing a long time a scene and not beeing sure if I close all will surely be saved, I would definetly press SAVE & DONT EXIT if available, from time to time. I am used to this from Photoshop etc. where a crash could kill an hour work easily :)
In Tasker it is not the big thing, I mostly take only five to ten minutes which I could loose but anyway its annoying then.

Frank Röhm

unread,
Jan 1, 2015, 10:47:39 AM1/1/15
to tas...@googlegroups.com
Am 01.01.2015 um 14:13 schrieb francwalter:
> ...
> @Jeremy Harris: I have no tools to kill apps running or running in
> background (e.g. Taskkiller etc.)
>

I got now at the moment some suspicion: I have the setting that a long
press on BACK kills the actual app!!!
This must it be, I guess! I don't notice that I press too long on BACK
and then I kill Tasker, giving no chance to save anything.

This is a bit what I thougt previously: I am self responsible for this
issue, home-made stuff, like always, when I have a problem and nobody
knows it :)

Thanks for the hint into the right direction.

frank
Reply all
Reply to author
Forward
0 new messages