Sleep monitor - time variable.

Discussion in 'Tasker' started by Shaun Wray, Dec 19, 2015.

  1. Shaun Wray

    Shaun Wray New Member

    Joined:
    Dec 16, 2015
    Messages:
    20
    Likes Received:
    3
    I wanted to create a tasker profile to monitor the amount of time I sleep.

    My trigger would be, placing my phone face down on the bed next to me. This would turn $Facedown to `On', and set $Sleepstart to $TIME. In the event I choose to look at my phone before actually going to sleep, I decided to add five minutes to the face down orientation time THEN begin the sleep time monitor.

    There are two profiles. 1.) detect face down and set $Sleepstart to $TIME and $Facedown to On.
    2.) If $Facedown matches On AND the current time is $Sleepstart + 5 minutes, then $Asleep is On.

    Exit task being when I wake up and turn my phone over. And $Waketime is set to $TIME, and $Totalsleep = $Waketime - SleepStart. Then the results are written to a log file of my choice.

    The problem I encountered, was the variable addition. I was never able to have that condition satisfied (current time being five minutes ahead of $Sleepstart - when my phone was turned over).

    Any ideas?

    Thank you!

    Shaun
     
  2. MikeW

    MikeW Member

    Joined:
    Feb 16, 2015
    Messages:
    113
    Likes Received:
    9
    Go into the properties for the first profile and add a five-minute Cooldown. Then you can eliminate the second profile completely and have %Asleep set by the first profile. ( I assume your exit task also clears %Facedown...)

    Or you could just add the Cooldown to the second profile and remove the +5-minute time context.
     
    Last edited: Dec 19, 2015
  3. Shaun Wray

    Shaun Wray New Member

    Joined:
    Dec 16, 2015
    Messages:
    20
    Likes Received:
    3
    Excellent, thank you. I used your idea of the cooldown period, if I in fact understood how you meant it.

    I used facedown as a trigger for the first profile, and the first action in the task i a 4 minute 'wait' function. Followed by a $Facedown On. That triggers a second profile in which I set the sleeptime, and sleepdate. The exit task for that is setting the waketime and performing the subtraction of (waketime-sleeptime)+24.00, followed by writing that information to a file.

    Works perfectly. Thank you for your assistance. I'm still trying to figure out a way to do it with one profile, but no matter, it functions well enough.

    Shaun
     
  4. MikeW

    MikeW Member

    Joined:
    Feb 16, 2015
    Messages:
    113
    Likes Received:
    9
    Glad you got it working.
     

Share This Page