Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] sleep cycle based alarm #351

Open
J4gQBqqR opened this issue Jan 2, 2023 · 8 comments
Open

[feature request] sleep cycle based alarm #351

J4gQBqqR opened this issue Jan 2, 2023 · 8 comments
Labels
up for grabs Nobody is working on this at the moment

Comments

@J4gQBqqR
Copy link

J4gQBqqR commented Jan 2, 2023

Would you consider adding a sleep cycle based alarm clock?

Not sure if this repo accepts feature request or this feature is out of scope of the app. If this is the case, please close the issue.

@vmiklos
Copy link
Owner

vmiklos commented Jan 2, 2023

Feature requests are fine, don't worry. :-)

Would this be about something like: my preferred sleep length is 8 hours, I'm awake for 16 hours, alarm to signal it's time to go to bed?

@vmiklos vmiklos added the needinfo Further information is requested label Jan 3, 2023
@J4gQBqqR
Copy link
Author

J4gQBqqR commented Jan 3, 2023

This feature would be like, I would like to wake up at around 6 am, no later than 7 am, no earlier than 5:45 am.

Please detect my sleep cycle and wake me up (alarm clock actually) while I am in the shallowest sleep cycle, better to be around 6 am instead of the middle time point of 5:45 and 7 (which is 6:23 am). If I keep sleeping until 7 am, wake me up no matter what.

@J4gQBqqR
Copy link
Author

J4gQBqqR commented Jan 3, 2023

This would definitely require some historical statics on sleep cycle to define what level of sensor response is "shallowest sleep cycle". Then I can imagine using a very basic hypothesis testing based on the mean and variance to predict/detect/verify sleep cycle and trigger the alarm clock based on the set time frame.

If the "around 6 am" requirement is too hard to configure, this feature request can also be relaxed to, "I would like to wake up between 5:45 and 7am. Please wake me up gentally while I am not in deep sleep."

@vmiklos
Copy link
Owner

vmiklos commented Jan 4, 2023

Ah, I see. Fine. I have no plans to implement something like this myself, but let's keep it open, I'm not against a PR that does this. I'm more interested in the "timer that counts average" piece. :-)

@vmiklos vmiklos added up for grabs Nobody is working on this at the moment and removed needinfo Further information is requested labels Jan 4, 2023
@Mrnofish
Copy link

Mrnofish commented Apr 11, 2023

Pretty much you need some way to track the user's movements, either through a wearable device, or another sleep tracking device of some kind.

While a number of devices exist on the market for this very purpose, some of which are easier to interface with and others definitely less, the phone itself can be turned into a sleep tracking device using some cleverness:

  1. apps used to instruct the user to place their smartphone under the pillow or otherwise in their bed, and then use the accelerometers and/or other sensors to track the user movevments. I'm not sure how popular is this anymore, TBH, last time I tried it was definitely not very accurate, it had some significant potential drawbacks, and probably has fallen out of fashion, now that wearables are a dime a dozen.

  2. Urbandroid came up with a "sonar" function that uses the phone's microphones and speakers as a sonic radar.

Implementing an actigraph and interfacing with the devices is not exactly a walk in the park and definitely not a small amount of work.

@LinuxinaBit
Copy link

Would this be about something like: my preferred sleep length is 8 hours, I'm awake for 16 hours, alarm to signal it's time to go to bed?

Maybe this is a better idea, just to keep it simple.

If you integrate this with a built-in alarm with a slow volume increase + vibration, snooze button customization/limiter, and maybe that increasing screen brightness trick, it might be almost as good.

@derkrasseleo
Copy link

There is also the approach of SleepCycle, which essentially just listens for movement noise, which they replaced the accelerometer method with. The question is if this feature goes too far for this app when the goal (at least according to the website) is to not drain battery..

@vmiklos
Copy link
Owner

vmiklos commented Apr 20, 2024

It does go too far if this happens by default. If somebody wants to add this in a way that you need to explicitly opt in, that may be OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
up for grabs Nobody is working on this at the moment
Projects
None yet
Development

No branches or pull requests

5 participants