AutoAlarm Autoalarm stuff

Discussion in 'AutoApps' started by Wieuwzak, Jun 18, 2018.

  1. Wieuwzak

    Wieuwzak New Member

    Joined:
    Aug 13, 2017
    Messages:
    5
    Likes Received:
    0
    Hey all, how can I use autoalarm to tell me how long in hours and minutes I have before my alarm fires, but minus 8 hours and 10 minutes(sleeping time) .

    For instance: my alarm is set for 7:00 in the morning. My ideal time to go to sleep would be 22:50. How would I build a task that tells me the difference between those times in hours and minutes? I did get something working. It tells me the remaining time until ideal sleep time. However after the ideal sleep time has passed, I want to be able to see negative hours and minutes. Like if it's 23:50 it would say -1 hour and 0 minutes until bedtime.

    Can anyone help me out? Thanks!
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Use the AutoTools Time action :) Let me know if you have any trouble with it!
     
  3. Wieuwzak

    Wieuwzak New Member

    Joined:
    Aug 13, 2017
    Messages:
    5
    Likes Received:
    0
    I have been using the autotools time action. This is my test task:

    Test (126)
    A1: AutoAlarm [ Configuration:NOTE: This will not work correctly if the 'Relible Alarms' option is enabled in Tasker. No extra configuration needed Timeout (Seconds):5 ]
    A2: AutoTools Time [ Configuration:
    ---------Start Date---------
    Use Now: true
    ---------End Date---------
    Day: %day
    Hour: %hour
    Minute: %minute Timeout (Seconds):30 ]
    A3: Variable Set [ Name:%atdateshours To:%atdateshours-8 Recurse Variables:Off Do Maths:On Append:Off ]
    A4: Variable Set [ Name:%atdatesminutes To:%atdatesminutes-10 Recurse Variables:Off Do Maths:On Append:Off ]
    A5: AutoTools Toast [ Configuration:Text: You need to be in bed in:
    %atdateshours hours and %atdatesminutes minutes
    Text Color: #FFFAFAFA
    Text Size: 16
    Background Color: #FF455A64
    Gravity: Bottom
    Icon: app-icon:com.urbandroid.sleep
    Icon Size: 40
    Corner Radius: 30
    Padding: 16,4,16,4
    Long: true Timeout (Seconds):60 ]


    Let's say I run the task at 23:50. I would be an hour late to bed and it would need to say - 1 hours and 0 minutes, yet it doesn't. After the ideal sleep time(22:50) I only see illogical negative hours and minutes.

    My ideal sleep duration is 8 hours and 10 minutes. This explains the variable set - 8 and - 10. I have started using variables since yesterday so I might be missing some clean solution to this. What would you do?

    Thanks for the response!
     
    Last edited: Jun 19, 2018
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    You should follow this but instead of using the current time for the calculation use the time from AutoAlarm, and instead of adding time to the future, remove some time :)
     
  5. Wieuwzak

    Wieuwzak New Member

    Joined:
    Aug 13, 2017
    Messages:
    5
    Likes Received:
    0
    Thanks for your reply.

    However, the tutorial you linked is for when you want to add a known time to the current time.

    Here's my situation as simple explained as possible. I have one task that gives me %calculateddate = 22:50

    This is the ideal bedtime. This is the time the alarm goes off minus 8 hours and 10 minutes.

    All I want to do is calculate how many hours and minutes are between current time and %calculateddate.

    Thanks for your help!
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Wait, so you don't want to calculate the ideal bedtime? You already have it?
     
  7. Wieuwzak

    Wieuwzak New Member

    Joined:
    Aug 13, 2017
    Messages:
    5
    Likes Received:
    0
    Yes I already have that.
    it's in %atcalculateddate = 22:50. I used add time from Autotools time.

    I want the difference between current time and ideal bedtime(%atcalculateddate).
     
  8. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Ok, I think the issue is that you don't have a day on that calculated date. Try adding the date to it, then in the action to calculate the difference use the same date format to receive that date as input :)
     
  9. Wieuwzak

    Wieuwzak New Member

    Joined:
    Aug 13, 2017
    Messages:
    5
    Likes Received:
    0
    Thanks! I've incorporated the day in the calculation and decided to split my ideal bedtime into (day hour minute). Then I used time span from Autotools to calculate the difference between now and entering the three new variables as end date.

    Seems to be working for now. One more question, do you think I should incorporate (month)? Or will this work without it. Thanks for your help. Using variables opens up the door for more Tasker awesomeness :)
     
  10. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    I think it's safer if you include the full day+month+year in the date :) Glad it's working!
     

Share This Page