This is how it'll look in the end:
When you're home (in my case connected to my wifi network) the screen will not lock itself when turned off like you can see in the beginning of the video where it turns off and on again.
When you're not home (in my case disconnected from my wifi network) when you turn off your screen it'll get locked instantly.
IMPORTANT: You need at least AutoTools 1.0.1 to make this work which at the time of this writing was in beta. Get the beta here if needed.
STEP 1 - DISABLE OPTION TO LOCK SCREEN WITH POWER BUTTON
Go to your Android settings and disable the option to lock instantly when you press the power button. This is crucial to make this profile to work correctly or else the screen would look whenever you pressed the power button at home.
STEP 2 - DONT LOCK AT HOME
You can set this value to what you feel is appropriate to your use. 7200 seconds is 2 hours, but you can set it higher if needed.
- Create a new Tasker profile with the Wifi Connected state condition and set the SSID to the one of your Wifi connection at home
- In the entry task add an AutoTools Secure Settings action and set Automatic Lock (under Lock Screen) to 7200 seconds
STEP 3 - LOCK SCREEN RIGHT AWAY WHEN NOT HOME
This will make your device lock itself right away when the screen is turned off.
- Add an exit task to the profile and add another AutoTools Secure Settings action and set Automatic Lock (under Lock Screen) to 0 seconds
- Not In video: You can optionally add a Tasker System Lock action after the action above to make sure that when you walk out of your house the screen is locked right away and you don't accidentally leave it on in your pocket or bag.
STEP 4 - TEST
As you can see when I'm connected to the wifi network the screen doesn't lock, but when I disconnect it locks right away.