Tasker to proximity screen
off
If you are using
proximity screen off pro or smart screen off, you may know how convenient it is
to automate our lives via built-in proximity sensor.
Now I am going to
show you how tasker done this job to replace proximity screen off pro.
Before all of it,
just a reminder, you may go to tasker preference interface, and click on the
tab of monitor, then pull down the screen, you will find the option for
proximity sensor, “No” means proximity sensor will shut off when the screen
turns off, back on when the screen turns on. I guess it might avoid any
unnecessary loss for the sensor since you may prefer saving more battery.
Profile 1:
(proximity screen off 1)
Context-state-sensor-proximity
sensor
Action-variable-variable
set-name %Proximity, to On
Exit action-
variable-variable set-name %Proximity, to Off
Profile 2:
(proximity screen off 2)
Context
1-state-sensor-proximity sensor
Context
2-state-display-display orientation, portrait
# if you
are playing some game which requires full screen in landscape, this profile
would not interrupt.
Context
3-state-phone-call, type-any, invert # this action is to
avoid the situation while incoming or outgoing call occurs.
Context
4-state-app-not camcorder, camera, flashlight
# for some specific apps, you might not want
to be interrupted as well. Eg. Like you are using flashlight.
Action 1-task-wait
5 seconds # give you 5 seconds to
avoid some unexpected cases.
Action 2-display-system
lock, if %Proximity~On # 5 seconds later if it is still being fired, then system
lock the phone.
Works great! Thanks!
ReplyDeleteI am glad I can help.
DeleteEnjoy !
Cathy
Hey I noticed the proximity sensor stays on constantly with this version. I modified it a bit to only turn it on after the device is upside down and not in any restricted apps.
DeleteHere's a link to the modified version on Reddit: http://www.reddit.com/r/tasker/comments/1m4rrq/how_to_have_your_screen_turn_off_when_you_put/
Side note: You've made the sidebar!
Hi, Chris Register,
Deleteto turn the proximity sensor off while the screen is off, you just need to go to tasker preference and the monitor tab and pull down to find the proximity snsor option, and switch it to No, which means you don't want to keep sensor working while the screen is off.
I have already mentioned this attention in the post, if you noticed.
Have fun!
Cathy
Stupid question, but can I just copy and paste this into taker?
ReplyDeleteHi,
Deletesorry, you cannot copy and paste it. do it step by step, please.
Cathy
Hi! This works, but for a while only. I don't know but Tasker will see that the proximity sensor is active even if there's nothing in front of it. This usually happens after a couple of hours. I've tested the sensor if it's fauly but it's working as intended(tested via other proximity app). When I re install tasker, it works as intended then the problem happens again.
ReplyDeleteAny ideas?
Thanks!
Hi,
Deletewhat specific version of tasker are you using? i suspect it is due to the tasker version installed in your phone is malfunctioning.
Cathy
Hi,
ReplyDeleteBoth profile have same name?
Hi,
Deletesorry about that, you may rename it as any other characters as you like.
Cathy
I've tried my own brand of this and had some issues so I gave yours a shot and I'm still running into to the same problem. Basically, if put your hand in front of the sensor for 2 seconds, remove it for a second or two, and then cover it again for 2 seconds, the screen goes out. I'm trying to find a way that the 5 second count will reset whenever the sensor is clear. That way the sensor needs to be covered for 5 consecutive seconds. I tried using a Stop task when exiting but that doesn't work either. The only thing I found that works fairly well is to split the Wait task into five 1 second waits instead of one 5 second wait. This gives the exit tasks time to run before the time is up. Any other suggestions?
ReplyDeleteHi,
Deletei get a little bit confused of your question.
covered 2 seconds then undo 1 second, then re-covered 2 seconds, that sounds like a little bit joking.
i didn't say it is not possible, just think it could rarely happen. right?
however, if you insist, i guess counting the sensor covered time is the final solution for you.
e.g. when the profile is active, mark a timestamp, then if the profile turns into inactive, exit task, mark another timestamp, then you are able to count if it is running time is up to 5 seconds or not.
of course, to be more convenient, you may use python sl4a script instead.
Cathy
I did it like this: I have a counter variable, which is increased every time the proximity sensor is not blocked any more. And I have a variable, which is set to this value when the proximity sensor is blocked. Then it waits 4 seconds (or how long you like) and locks the screen if the counter equals the second variable and the proximity sensor is still blocked.
DeleteCan you make pictures? I dont know where to put these commands
ReplyDeleteHi,
Deleteit is not that much difficult indeed.
get some time, read my entries, then tell yourself you can.
Cathy
Pent's suggestion which requires only 1 profile:
ReplyDeleteProfile: 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.
Suggestion is posted at https://groups.google.com/d/msg/tasker/WtjpvFd6P5s/EpovFLlNcbcJ
Thank you,
ReplyDeleteI can not two actions in profile 2.
Only one action to profile 2.
How to possible two action?
Hi,
Deleteexcuse me, i get sorta confused of your comment.
could you please explain it a little bit detailed?
i will see what i can do for you.
Cathy
Hi there, thanks for the manual. I cannot, however, add more than 3 "States" to a single profile. After adding "Context 3-state-phone-call, type-any, invert" I cannot add another "State"-context. It seems like a software limitation. I'm on the latest version of Tasker as of today. Any idea if anything can be done, besides dropping one of the components? Thanks in advance.
ReplyDeleteI'm sorry, I've seen that the "Application" context is not under "State" (any more?) but a seperate context in the menu, which allowed me to include all the contexts.
DeleteAnother question I've got: I have created only 1 profile, and skipped the "if %Proximity~On" part in Action 2. In fact, I've simplified this rule down to the following:
[Context 1] + [Context 2] + [Context 3] + [Context 4] => [Action 1] + [display-system lock]
It works like expected. Am I missing something with this simplified set of rules? What?
Once again I found the answer myself a minute after posting the question. Sorry for spamming you!
DeleteThanks for the manual!