Bug with exit task

77 views
Skip to first unread message

Nors233

unread,
Jun 24, 2020, 2:07:25 PM6/24/20
to Tasker

I noticed a bug where the exit task will not run if you are using the time condition.

Steps to reproduce:

  1. Set profile with time from 1:00pm to 1:05pm

  2. Put any task you want ( I just toggle bluetooth)

  3. Turn phone off at 1:03pm

  4. Wait after 1:05pm then turn it back on

It will not trigger the exit task after your phone starts up past the time.

Here's a similar one with charging state:

  1. Create a profile that triggers when phone is charging.

  2. Set tasks to toggle bluetooth.

  3. Charge the phone (bluetooth should turn on)

  4. Turn off the phone (leaving it plugged in)

  5. Unplug the phone

  6. Turn the phone on

Philip Schaffer

unread,
Jun 24, 2020, 6:10:30 PM6/24/20
to Tasker
Just to make sure we understand what you are stating.  When you say "Turn the phone off" are you actually powering down the phone or just turning the screen off?  If you are powering down the phone, then what you are describing is correct behavior.  Tasker doesn't natively save Profile states during a reboot.  There are ways around this if it's really necessary using Global variables, but that's not the default behavior.

Matteo Chirco

unread,
Jun 24, 2020, 6:55:57 PM6/24/20
to tas...@googlegroups.com
Yes i am actually powering down the phone. Is this something that can be fixed by the developer or what are workarounds?
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/hS-bWrOWvDU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/80f0035f-b7a2-4ae5-8729-068d6784c0c5o%40googlegroups.com.

Philip Schaffer

unread,
Jun 24, 2020, 7:07:14 PM6/24/20
to Tasker
First of all, it's not broken and it's not a bug so what you are asking for would be an enhancement that you would need to suggest to the developer.

As for a work around, in general terms, you could have your profile (Let's call this Profile A) that you want to persist across a phone reboot set a Global variable upon entry and clear that variable upon exit.  Then, with another Profile (Profile B) use a Profile Active context to check Profile A and a Variable Value context to check that the variable and the Profile A status match, if they don't then perform the appropriate action depending on the state of Profile A.
To unsubscribe from this group and all its topics, send an email to ta...@googlegroups.com.

Philip Schaffer

unread,
Jun 24, 2020, 7:10:28 PM6/24/20
to Tasker
Another possible work around would be to create a Profile using Device Boot as the context.  Then just use the enter tasks to look at the state of your various Profiles and duplicate their exit tasks it they are not active.

Matteo Chirco

unread,
Jun 24, 2020, 7:23:47 PM6/24/20
to tas...@googlegroups.com
Thanks. I hope the developer takes note of this feature and adds it in a future version. 
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/64665e67-6cd7-423c-b3b5-07855bc7db21o%40googlegroups.com.

Jimmy Jimmy

unread,
Jun 24, 2020, 11:45:15 PM6/24/20
to Tasker
One solution is NOT to use the exit task. But create a 2nd profile by inverting the original one. This way, you have two profiles, one for enter and one for exit. When you reboot and Tasker restarts, the invert profile will become active and the task will be run. I have this set up for most of my state profiles.

Nors233

unread,
Jun 25, 2020, 12:49:12 AM6/25/20
to Tasker
I think the issue with this is that EVERYTIME i start the phone then the task will be ran. Whereas I would just like to check it once . It could also cause a potential with interfering with other profiles too. 

Nors233

unread,
Jun 25, 2020, 1:05:48 AM6/25/20
to Tasker

Is this what you mean?

Screenshot_20200624-220057_Tasker.jpg

Screenshot_20200624-220111_Tasker.jpg

When BtEnter runs. I set a global variable %Bedtime to 1. At the end of the exit task I set it to 0.



On Wednesday, June 24, 2020 at 4:07:14 PM UTC-7, Philip Schaffer wrote:

Jimmy Jimmy

unread,
Jun 25, 2020, 9:01:13 AM6/25/20
to Tasker
Check it once is the same as running the entry task, isn't it?

Philip Schaffer

unread,
Jun 25, 2020, 9:55:47 AM6/25/20
to Tasker
That looks like it should work.  That said, Jimmy Jimmy's solution would work just as well without having to set a Global variable.  The particulars of what you are actually doing in your enter and exit tasks and how that interacts with other profiles you may have might influence what method you choose to use.

Nors233

unread,
Jun 25, 2020, 12:36:18 PM6/25/20
to Tasker
Which task should have the higher priority?

Nors233

unread,
Jun 25, 2020, 1:17:13 PM6/25/20
to Tasker
I just tried it and it didnt work. For some reason %Bedtime was set to 0, but the task didnt run.

Philip Schaffer

unread,
Jun 25, 2020, 1:52:44 PM6/25/20
to Tasker
Not sure why it isn't working for you.  Maybe you Restore set to yes?  You might try this:

Profile: Boot (122)
    Restore: no
    Event: Device Boot
    Enter: Boot (129)
    Abort Existing Task
    A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] 
    A2: If [ %PACTIVE !~R Bedtime ]
    A3: Perform Task [ Name:BtExit Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off Local Variable Passthrough:Off Limit Passthrough To: ] 
    A4: End If 

Matteo Chirco

unread,
Jun 25, 2020, 3:49:08 PM6/25/20
to tas...@googlegroups.com
It seems the variable is not getting saved across reboots. 
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/ec44ab0f-2f77-4025-b53b-5cc753a30f50o%40googlegroups.com.

Philip Schaffer

unread,
Jun 25, 2020, 4:06:06 PM6/25/20
to Tasker
More likely the variable is getting changed prior to the reboot.  I use Globals extensively to hold configuration parameters as well as statuses of various things I want to carry across a reboot and they never clear as a result of a reboot.  Does the Global have any data in it after the reboot or is it empty?  If it has data, that's what it was at the time of the reboot.

Matteo Chirco

unread,
Jun 25, 2020, 4:24:33 PM6/25/20
to tas...@googlegroups.com
   These are what my tasks does. The only places I change the variable are in here. Before the task ends I made sure the variable said 1, then rebooted the phone after the task, and it said 0. 

 Profile: Bedtime (19)
    Priority: 15 Restore: no
    Time: From 12:00AM Till  1:19PM
    State: Not Power [ Source:Any ]
    Enter: BtEnter (16)
    A1: Variable Set [ Name:%Bedtime To:1 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
    A2: Display Brightness [ Level:0 Disable Safeguard:On Ignore Current Level:Off Immediate Effect:Off ]
    A3: Location Mode [ Mode:Off ]
    A4: Auto-Sync [ Set:Off ]
    A5: Mobile Data [ Set:Off ]
    A6: Custom Setting [ Type:System Name:sip_key_feedback_vibration Value:0 Use Root:Off Read Setting To: ]
    A7: [X] AutoWear Settings [ Configuration:Brightness: 0
    Execute Now: true
    Name: Settings Timeout (Seconds):100 Continue Task After Error:On ]
    A8: Bluetooth [ Set:Off ]
   
    Exit: BtExit (14)
    A1: Beep [ Frequency:8000 Duration:1000 Amplitude:50 Stream:3 ]
    A2: [X] Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] If [ %Bedtime ~ 1 & %PACTIVE !~R Bedtime ]
    A3: Display Brightness [ Level:120 Disable Safeguard:Off Ignore Current Level:Off Immediate Effect:Off ]
    A4: Bluetooth [ Set:On ]
    A5: [X] WiFi [ Set:On ]
    A6: Auto-Sync [ Set:On ]
    A7: Location Mode [ Mode:Battery Saving ]
    A8: Mobile Data [ Set:On ]
    A9: Custom Setting [ Type:System Name:sip_key_feedback_vibration Value:1 Use Root:Off Read Setting To: ]
    A10: [X] AutoWear Settings [ Configuration:Brightness: 150
    Execute Now: true
    Name: Settings Timeout (Seconds):100 Continue Task After Error:On ]
    A11: Variable Set [ Name:%Bedtime To:0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
   
    Profile: Bedtime Helper (12)
    Priority: 9 Restore: no
    State: Not Profile Active [ Name:Bedtime ]
    State: Variable Value  [ %Bedtime ~ 1 ]
    Enter: BtExit (14)
    A1: Beep [ Frequency:8000 Duration:1000 Amplitude:50 Stream:3 ]
    A2: [X] Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ] If [ %Bedtime ~ 1 & %PACTIVE !~R Bedtime ]
    A3: Display Brightness [ Level:120 Disable Safeguard:Off Ignore Current Level:Off Immediate Effect:Off ]
    A4: Bluetooth [ Set:On ]
    A5: [X] WiFi [ Set:On ]
    A6: Auto-Sync [ Set:On ]
    A7: Location Mode [ Mode:Battery Saving ]
    A8: Mobile Data [ Set:On ]
    A9: Custom Setting [ Type:System Name:sip_key_feedback_vibration Value:1 Use Root:Off Read Setting To: ]
    A10: [X] AutoWear Settings [ Configuration:Brightness: 150
    Execute Now: true
    Name: Settings Timeout (Seconds):100 Continue Task After Error:On ]
    A11: Variable Set [ Name:%Bedtime To:0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
    
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/hS-bWrOWvDU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.

Philip Schaffer

unread,
Jun 25, 2020, 4:40:48 PM6/25/20
to Tasker
If it's 1 before the reboot and 0 after, then something is changing it.  Maybe set a Global like %LastBoot to the current time in the BtExit task to verify if the BtExit task did or didn't run.  I would probably add a Stop BtEnter task to BtExit as well in case there is some sort of race condition happening.
To unsubscribe from this group and all its topics, send an email to ta...@googlegroups.com.

Nors233

unread,
Jun 25, 2020, 5:33:09 PM6/25/20
to Tasker
I put in rhe %LastBoot variable, and it did change after reboot, but for some reason my other tasks aren't executing.
I think I might've discovered another bug. When I rebooted the phone at the EXACT time when the profile is supposed to end, it was still showing as active in Tasker, 2 minutes past the active times.

20200625_143231.jpg

Rich D

unread,
Jun 26, 2020, 6:19:31 AM6/26/20
to Tasker Google Groups Post
The best way to debug these types of issues is with the run log. Menu, more, run log.  It has a filter you can use for your variable to see exactly what times and it is getting set. 

Rich D

unread,
Jun 26, 2020, 6:29:47 AM6/26/20
to Tasker Google Groups Post
I also think you want to remove the exit task from the original profile and just let the helper task take care of running the exit task alone. The way you have it set up now it looks like the exit task will  run twice. 

Nors233

unread,
Jun 26, 2020, 1:16:04 PM6/26/20
to Tasker

Here is my Run Log screen

Screenshot_20200626-101119_Tasker.jpg

Nors233

unread,
Jun 26, 2020, 1:20:30 PM6/26/20
to Tasker
My variable got set to 0 again , but %Bedtime didn't change


On Wednesday, June 24, 2020 at 11:07:25 AM UTC-7, Nors233 wrote:

Nors233

unread,
Jun 26, 2020, 5:39:18 PM6/26/20
to Tasker
So I've discovered another thing. I've disabled all the profiles but left Bedtime enabled. When I turn the phone off I notice the variable %Bedtime gets immediately set to 0, but it ignores my other tasks. So in a way , the exit task is running , but it ignores my other actions.


On Wednesday, June 24, 2020 at 11:07:25 AM UTC-7, Nors233 wrote:

Rich D

unread,
Jun 26, 2020, 7:43:25 PM6/26/20
to Tasker Google Groups Post
I thought this sounded familiar.. This is a bug.  I reported a while ago but João was on vacation and the I think I lost track of it. Your Run log shows the profile going inactive when the device shutdown but it does not show the exit task running but it does run but will only run certain actions , such as the variable set.  See my post about the bug here. 







joaomgcd

unread,
Jun 30, 2020, 11:33:27 AM6/30/20
to Tasker
Hi. Sorry for the late response.

Just to clarify, the reason for it not running all actions is probably because the phone is shutting down and Tasker is killed before it has the chance to complete everything.

Does this happen on any kind of profile or just timed profiles?

Rich D

unread,
Jun 30, 2020, 12:30:34 PM6/30/20
to Tasker Google Groups Post

Just to clarify, the reason for it not running all actions is probably because the phone is shutting down and Tasker is killed before it has the chance to complete everything

I believe there is more to it than that. Please check the bug report I posted here.


Does this happen on any kind of profile or just timed profiles?

From what I can tell it is with any state profile. 

Nors233

unread,
Jun 30, 2020, 12:59:43 PM6/30/20
to Tasker
Its not that tasker doesn't have a chance to complete. But rather it doesn't complete it at all.

This example happens too. Turn off the phone leaving the cable connected. Unplug it and reboot it. Bluetooth should turn off but it doesn't.

Profile: BT Off When Charging (27)
Restore: no
State: Power [ Source:Any ]
Enter: Anon (28)
A1: Bluetooth [ Set:On ]

Exit: Anon (29)
A1: Bluetooth [ Set:Off ]

Nors233

unread,
Jun 30, 2020, 1:32:02 PM6/30/20
to Tasker
In other words, if any profile goes into the exit state while the phone is powered off, it will not execute the next time the phone is rebooted.

Jimmy Jimmy

unread,
Jul 1, 2020, 3:21:47 AM7/1/20
to Tasker
Yes, this is how it behaves. Tasker has no control over when it is killed when the phone shuts down manually. Some exit tasks will finish but some will not. If you want to make sure all exit tasks finish before the phone shuts down, you will need to shut down your phone via Tasker.

Nors233

unread,
Jul 10, 2020, 5:40:34 PM7/10/20
to Tasker
@Joao , I hope you could implement a workaround or solution for this

João Dias

unread,
Sep 29, 2020, 5:33:01 AM9/29/20
to tas...@googlegroups.com
Ok, I'm taking another look at this now. Sorry for the long delay. Will update with findings.

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Reply all
Reply to author
Forward
0 new messages