3

How can I execute a tasker task only after a certain condition has been true for a certain time?

Normally a profile executes its task as soon as all conditions are met. I want to delay this activation, until the conditions have stayed true for some time.

E.g.

  • do something after the screen has been continuously off or on for 10 minutes
  • do something after wifi xy has not been near for 10 minutes
  • do something after cell towers x,y,z have not been near for 10 minutes.

2 Answers 2

0

A mix of Wait, Variable Search and If-Else should suffice here.

Tasker maintains a variable named Profiles Active, denoted by %PACTIVE.

Profiles Active (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.

(Emphasis mine)

You can use Wait action to wait for N amount of time and then check whether your profile is active or not. If not active, exit out of the task, else, continue.

You may begin your task with these actions:

  1. Task → Wait → configure it
  2. Variables → Variable Set:

    • Name: %ActiveProfiles
    • To: %PACTIVE
  3. Variables → Variable Search Replace:

    • Variable: %ActiveProfiles
    • Search: ,PROFILE_NAME,
    • tick Ignore Case
    • Store Matches In: %CurrentProfile

    Replace PROFILE_NAME with the name of your profile. A profile's name must be setup manually.

  4. Task → If: %CurrentProfile1 Isn't Set
  5. Task → Stop

    Alternatively, put any action that notifies you that the profile deactivated in the mean time.

  6. Task → Else
  7. Setup the actions you want be executed if the profile remains active after N amount of time.
2
  • This approach has issues. The first issue is that I'm not making any checks on the fact that for the amount of time I'm waiting, the profile may have deactivated and activated multiple times. I'll see what I can do.
    – Firelord
    Commented Feb 10, 2016 at 23:15
  • For the obvious issue here: setup an Exit Task and stop the Enter Task from it. Problem solved.
    – Firelord
    Commented Feb 10, 2016 at 23:30
0

What I do with success :

myprofile 1 →

what I want for activation

Task 1 Delay →

  1. Wait x time to comfirm activation
  2. Set %variable_Active = 1
  3. Wait 1 second
  4. Set %variable_Active = 0

=== AND ===

myprofileActivate →

  1. %variable_Active == 1
  2. %myprofile is active

Task 1 Actions →

what I want to see done

1
  • Welcome on the Android SE! I see your answer is a little bit cryptic, could you please explain for the future readers, exactly what are you doing?
    – peterh
    Commented Jan 11, 2021 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .