Best way to log daily data using tasker

129 views
Skip to first unread message

Vinícius Monteiro

unread,
Jun 3, 2014, 12:06:41 PM6/3/14
to tas...@googlegroups.com
Hi, I've been using tasker for some time now and I'm trying to make a project that helps me adjust my sleeping hours. I try to get 8h sleep daily but sometimes I sleep more and most of the times I sleep less. I know this is not exactly how the body's clock works but I want to do it just for the sake of doing.

Anyway, I'm using a couple of profiles to check, on unlock, if 4 hours passed since the last time I unlocked my phone (using %TIMES), then it pops up a notification asking me if I was asleep. If I answer no it resets the clock, if I don't answer or dismiss the notification it will trigger a snooze profile that will ignore this "wake up" and keep logging since the last lock.

The problem is I don't know how to log the Yes answer. I thought of using google spreadsheet with HTTP Post but I don't want tasker just to log my sleep time, I want it to be able to show me my monthly (last 30 days) and weekly (last 7 days) deficit whenever I wake up so I can adjust for the next time.

Does write file gives me this freedom or should I try to use arrays? Or maybe should I use a google spreadsheet and parse the source?


I never used arrays before, only in simple split variable. Also I never messed up with write files or parsed html but I've read about it and seems to be simple (albeit tiring) enough. What do you guys suggest? Thank you :)

Jacob Klein

unread,
Jun 3, 2014, 1:00:55 PM6/3/14
to tas...@googlegroups.com
You could write each day to a txt file.
Example, my to-do list backups every morning to a txt file and made it to keep only so many days of backups (so the file didn't go out of control)

I built a restore that reads the last one and spits it back into my to-do list.

I won't give you my work, but can give you advise, as it's personal to me, and self built is always better and easier for someone to understand.

What I would do in your situation is make it so when you hit yes, it writes all you want (date, time, etc...) to a text file (on a new line each time)

And then build a system that shows it back to you. Whether it's a widget on your homescreen that pops up a scene, an autonotification that show's you the last weeks worth of data, it's up to you man.

You could also verywell do this in arrays and it may be easier for you to do. But if your going to have an array 30 variables long, it's going to take a hell of a long time to process. Up to you on what you want and I hope this helps.

Vinícius Monteiro

unread,
Jun 3, 2014, 2:55:37 PM6/3/14
to tas...@googlegroups.com
It does, thank you :) I'll try it with txt files.

If anyone else has suggestions please feel free to reply.



--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Matt R

unread,
Jun 3, 2014, 3:15:05 PM6/3/14
to tas...@googlegroups.com
If you solely want to use this data in Tasker, I think arrays are the way to go.  Simply use the array push action to add the daily number of hours of sleep to a global Tasker array.  Then it's easy enough to make a for loop that will add up 7 or 30 days worth.

Matt

Danielo515

unread,
Jul 4, 2014, 9:38:46 AM7/4/14
to tas...@googlegroups.com
If you feel confident with JavaScript the best option in my opinion is to use JavaScript Objects and save them into a JSON file. 
You will save yourself A LOT of parsing and splitting work, and it is more reliable than tasker variables.
Reply all
Reply to author
Forward
0 new messages