Beeminder Forum

How to Automate Bedtime Before 12:30 am?

I have an Android phone and Sleep As Android. I don’t want to track hours slept. What I want to track is my beeminder /bedbefore_1230am, “in bed, lights out, no electronics from 12:30 am to 6 am”.

The gold standard would be to compare sleep as Android begin and end sleep times to validate adherence. However, I can take an approximation of this. For example, if sleep as Android marks the beginning of my sleep before 12:30 am, then count that as success, and if I open my phone for YouTube after that, I’ll manually count that as a fail.

2 Likes

Sleep as Android has Tasker integration, so you can run a task whenever Sleep as Android thinks you fall asleep or your alarm goes off; then it’s relatively simple to use the Beeminder API to automatically create datapoints from Tasker. You could also set it up to detect if you use your phone during the night when you should be asleep.

I can write up some more details of how I have my sleep-tracking automation set up if that would be helpful. Tasker’s not the easiest app to get started with, but there are some good tutorials online. (there are a bunch of other similar automation apps, but Tasker is the most maintained and probably most popular one)

2 Likes

That’s great info, thanks! I have tasker installed on my phone but… I don’t recall… maybe I have to hook my phone up to a computer and do some adb command on every reboot to give tasker greater permissions to integrate with sleep as Android?

Also, tasker was slowing down my phone. I stopped pursuing that angle for one or both of the above reasons. But I might try again. I could buy a dedicated Android device just for this one task, as it’s very important for me to gain control over my bedtime sleep schedule, for once and for all. I wouldn’t mind having to run an adb command on a dedicated device.

My only concern is automating the “now is the sleep lights out time”, not the staying asleep portion, as that’s currently not an issue for me. I could probably get by having an iot nightlight that I turn off as a signal “I’m going to sleep now”, and have beeminder register a data point from that.

I’m in control of myself enough that once I do that, I’m not going to turn the light back on. Well… on second thought… I say that now, but who knows what my future self will try to do to undermine myself in the longer run a months or years down the road, haha.

1 Like

I don’t know whether or not that’s necessary for integrating Tasker with Sleep as Android, but the permissions process itself is more convenient than it used to be. The maintainer of Tasker has created a stand-alone Windows/Mac/Linux app that grants permissions to Tasker. You still need to connect the Android device to your computer via USB but you don’t need to install ADB and write commands on the command-line.

(I’m a huge fan of the command-line in general but also a huge fan of this lovely new app.)

2 Likes