1. 2015 is going to be a great year for Android! Why wait??
    Samsung Galaxy Note 5 | Samsung Galaxy S6 | HTC One M9
  2. New Forum Created: Samsung Gear VR!

Tasker - trying to automatically turn off keyguard when near home wifi


  1. Scootmien

    Scootmien Well-Known Member Contributor

    Hi all

    I wonder if any Tasker gurus could help me please?

    I'm trying to create a Tasker task so that when I am connected to my home wifi network, the keyguard is automatically off

    So in essence, I am doing as follows:
    1) Context > State > Net > Wifi connected (input SSID or MAC)
    2) Task > Display > Keyguard > Set 'Off'

    Now whilst it works some of the time, most of the time it doesn't and when my screen times out and locks, I have to enter my password again. It doesn't always do this, just more often than not and definitely enough to be annoying.

    Now i've looked at the step through on wikidot for the Tasker task but I can't get it to work as it asks me to add in a second context before I add a task (which Tasker won't let me do) - Disable Keyguard When At Home - Tasker Wiki

    I realise I must be doing something fundamentally wrong but can't figure out what it is, so if anyone could lend a hand I would be appreciative please.

    Advertisement
    :
  2. UncleMike

    UncleMike Well-Known Member

    I've been doing the something similar recently, and know others have done so before, but I wanted to do it on my own and learn from the process. One thing I notice about your profile is that you're using the "Wifi Connected" context, whereas the profile in the Wiki uses "Wifi Near". If you leave Wifi on all the time, these two contexts may appear to almost identical on the surface. But if your Wifi Sleep Policy allows your Wifi to sleep when the device is off, you'll find that your Keyguard turns on each time your Wifi goes to sleep (because you're disconnecting from Wifi when Wifi sleeps).

    Also, the Tasker help indicates that Keyguard changes may not be reliable unless the screen is on and unlocked.

    What I'm doing is using the Secure Settings plugin to enable/disable the PIN lock based on Wifi connection. I found this to be unreliable with regard to locking the device after disconnecting from Wifi. So in my task that enables the PIN lock, I use Secure Settings to turn the display on for 5 seconds immediately before enabling the lock. I haven't had any problems in the past 2-3 days.

    Here are my profiles:

    Profile: Trusted Zone (184)
    State: Wifi Connected [ SSID:ssid1/ssid2 MAC:* IP:* ]
    Enter: Trusted (192)
    A1: Secure Settings [ Configuration:Clear Password/Wait For Unlock ]

    Profile: UnTrusted Zone (193)
    State: Not Wifi Connected [ SSID:ssid1/ssid2 MAC:* IP:* ]
    Enter: UnTrusted (194)
    Abort Existing Task
    A1: Wait [ MS:0 Seconds:30 Minutes:0 Hours:0 Days:0 ]
    A2: If [ %PACTIVE ~ *,untrusted zone,* ]
    A3: Secure Settings [ Configuration:Screen Dim
    5 Seconds ] If [ %SCREEN ~ off ]
    A4: Secure Settings [ Configuration:Set Pin ]
    A5: End If

    Notes:
    1. The 30 second delay allows time to reconnect, in the event that I briefly go out of range
    2. The "Wait For Unlock" makes it so that if someone finds my phone, they can't simply bring it within range of my Wifi to unlock it - it must be unlocked once while connected, or already be unlocked when it connects, then it will remain unlocked for as long as it remains connected.
    3. The reason I'm using two separate profiles, instead of a single profile with both an Enter and Exit task is that by using a single "Wifi Connected" profile, if the device is turned off while the PIN lock is disabled, and next turned on when out of Wifi range, the PIN would remain disabled (the profile would not exit during shutdown, or during startup). A single "Not Wifi Connected" profile with both an Enter and Exit task would possibly go the other way, meaning that if the device is turned off when out of range, then turned on when in range, the PIN might not be disabled (much safer than the other way, but still not ideal).
  3. Cerberus666

    Cerberus666 New Member

    I have tried this too. In my experience, two things do not work reliably, at least not on Jelly Bean:

    1. The context "Wifi connected" on its own (I have "never sleep" on, and yet at some point Tasker "forgets" that Wifi was on and the keyguard is re-enabled until I switch Wifi off and on again).

    2. The command "turn keyguard off" (often stops working all together at some point until reboot: even a Tasker short-cut on my home screen will then be unable able to turn off the keyguard).

    My work-arounds are these:

    1. I have added another profile with the context "Screen Off" + "Wifi connected" that turns the keyguard off if conditions are met. This way, the Wifi state is checked every time the phone is normally locked, which works reliably for me.

    2. I have my action "Lock Off" set to first turn the keyguard on, then off again. This is reliable, whereas only turning it off usually stops working at some point (only starts working again after reboot).
  4. scrabbley

    scrabbley Active Member

    I tried having it turn on then off again but it just stays on! The only way I can get it to work reliably is to use secure settings and use the toggle option under keyguard. Then it switches between enabled /disabled when I want it to.
  5. Deedzy

    Deedzy New Member

    My SGS2 would stay on when in Untrusted Zone after entering the pin once.
    that is no pin required after the initial pin entry.
    I removed the comma after untrusted zone

    from A2: If [ %PACTIVE ~ *,untrusted zone,* ]

    to A2: If [ %PACTIVE ~ *,untrusted zone* ]

    Seems to work properly now.
  6. shivark79

    shivark79 Member

    Hi Guys,

    Can you please help me in understanding the criterias as I am a noob in Tasker Variables (not a developer). I am using Galaxy S2, Stock ROM on ICS 4.0.3

    Parameter:
    If [ %PACTIVE ~ *,untrusted zone* ]

    I have removed the comma from the above parameter. But what is the *asterisk for? Do I have to give it as is or input a blank space or something else? I dont seem to get the pin code lock to work.

    Pls help
  7. UncleMike

    UncleMike Well-Known Member

    Asterisks are wildcards, and will match any text of any length. What the statement above is doing is checking the %PACTIVE variable (the list of active profiles maintained by Tasker) to see if untrusted zone appears in that list. The reason I originally had the profile name bracketed by commas is that it specifies a complete profile name, and will only match if a profile named untrusted zone is active. Without the second comma (at the end), it will match untrusted zone, untrusted zone1, untrusted zonephone, etc.

    If you're having trouble getting your profile to work, your best bet is to post the profile here so others can see exactly what you're doing. When I need to do this, I long-press on the profile and select Export, the Description to Email. This brings up a choice of apps to handle the exported file. I usually choose Dropbox (you'll need Dropbox installed to do this) because the file is then automatically synced with my desktop and I can easily copy/paste the profile from the exported file into the forum post. Regardless of how you get the profile into the forum post, Description is the "format" you want to export in.
  8. shivark79

    shivark79 Member

    Here is the profile that I have set:

    Profile: Trusted Zone (29)
    Priority: 8 CoolDown: 0
    State: Wifi Connected [ SSID:Tvishi MAC:* IP:* ]
    Enter: Trusted (30)
    A1: Secure Settings [ Configuration:Clear Password/Wait For Unlock Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ]

    Profile: Untrusted Zone (31)
    State: Not Wifi Connected [ SSID:Tvishi MAC:* IP:* ]
    Enter: Untrusted (32)
    Abort Existing Task
    A1: Wait [ MS:0 Seconds:0 Minutes:30 Hours:0 Days:0 ]
    A2: If [ %PACTIVE ~ *,untrusted zone* ]
    A3: Secure Settings [ Configuration:Screen Dim
    5 Seconds Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ] If [ %SCREEN ~ off ]
    A4: Secure Settings [ Configuration:Set Pin Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ]
    A5: End If

    I also tried to give a comma after untrusted zone and before asterisk but still no luck
    The *asterisk in Mac and IP are fields left blank
    The *asterisk in setting A2 are * given manually. Attached screen shot
    uploadfromtaptalk1349503505574.jpg
  9. UncleMike

    UncleMike Well-Known Member

    I think I was using the Screen Dim in Secure Settings as a troubleshooting measure at one time, but I no longer have that in my Untrusted task, but I don't see that including it would cause any issues.

    Is the profile not activating, or is it not doing what it's supposed to do when it activates?
  10. shivark79

    shivark79 Member

    I can see it as activated in the notification drop down but it does not do what it is supposed to do : (
  11. shauny13

    shauny13 Well-Known Member

    ive been at this for days, tried everything but it just will not work for me.
  12. shivark79

    shivark79 Member

    So I am not the only one who has this problem.. There has to be some kind of solution to this issue.

    PS: this worked for me

    Profile: Change Lock Style (11)
    State: Wifi Connected [ SSID:Tvishi MAC:"give your mac id here" IP:* ]
    Enter: Lock Off (12)
    A1: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
    A2: Secure Settings [ Configuration:Clear Password/Wait For Unlock Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ]

    Exit: Lock On (13)
    A1: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
    A2: Secure Settings [ Configuration:Set Pin Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ]
  13. bsandall

    bsandall New Member

    Hello

    A great thread...I'm new to Android and have two issues.

    I'm unable to find "Profile Properties" to add a Cooldown. I've long clicked on the profile but only get the menus of Profile Options not Properties.

    When using Secure Settings to set the Pin I get an error Decryption Failed.

    I'm using a new Nexus 7 3G which isn't rooted.

    Any help would be great. Thank you.

    Ben
  14. bruce73

    bruce73 Well-Known Member

    I'm trying to follow along here and have created a profile exactly as you describe, and when on my home network it activates, but it won't set my PIN again when I test it by turning off Wifi, waiting the 5 seconds and switching off/on the phone. What am I missing?

    Edit: OK, it is working now, but there is the problem UncleMike alludes to when at home and not Wifi connected (my night setting with Juice Defender). So I'm going to try his profile, but what's the verdict on inserting the second comma in [*,untrusted zone,*]? Yea or nay?

    Edit: after updating SecureSettings to the latest version, UncleMike's isn't working at all anymore. So I've changed the contexts of both profiles to WiFi Near; so far so good.
  15. electricpete

    electricpete Well-Known Member

    Properties should show up.
    Are you pressing on the profile (not the context)?
    Maybe try turning off beginner mode?
    Menu / Preferences / UI / Beginner Mode (uncheck)
    bberryhill0 likes this.
Loading...

Share This Page