Nifty Sleep Tracker
· vV4.5.0
About
Track Your Sleep Stages Throughout the Night:
Nifty Sleep Tracker is a simple, yet sophisticated sleep tracker app for your Garmin Watch. I wanted to create a sleep tracking app where I could view stats on my watch—both nightly results as well as best and average values over time. However, Garmin doesn't provide access to sleep data values through the general API. Therefore, creating a sleep tracker app requires building your own using sensor data.
Important: The data reported in Nifty Sleep Tracker—such as sleep score and sleep classification percentages—will not match Garmin's built-in values. Overall, Nifty Sleep Tracker is more stringent than Garmin's scoring. While other values come close to Garmin's, they won't be perfect. That said, I wasn't attempting to replicate Garmin exactly. Instead, I wanted a fun detection and classification algorithm that provides additional insights into your sleep patterns. Please note: this is not a medical-grade app. It's designed to give users fun, useful insights into their sleep.
While the app is meant to be fun, I want to acknowledge the significant work behind it. It took me a month to iron out bugs and quirks, and there may be more I haven't discovered yet. Updates will continue as development progresses. I chose a price point that reflects my time and effort fairly—not every app can be free, especially one requiring dozens of hours to reach a working version.
If you encounter issues (crashes or unexpected behavior), please contact me so I can troubleshoot. There's a Raw Data View that displays diagnostic information I can use to help resolve problems.
How It Works:
SleepTracker uses five key signals from your watch to estimate your sleep stages:
1. Heart Rate:
Monitors your heart rate throughout the night
Recognizes that different sleep stages have distinct heart rate patterns
Adapts to your personal resting heart rate for accuracy
2. Movement:
Tracks motion using your watch's accelerometer
Deep sleep typically shows minimal movement
REM and light sleep usually involve more tossing and turning
3. Sleep Consistency:
Analyzes heart rate stability throughout the night
Stable patterns often indicate deeper, more restful sleep
Variable patterns might suggest lighter sleep or disruptions
4. Stress Values:
Your stress metric is analyzed during the detection window
Both stress averages and variance support sleep detection and classification
5. Body Battery Values:
Body Battery metrics are used during the sleep detection window
Provides insight into your recovery and sleep quality
The app combines these signals to estimate your sleep stage at any moment, tracks sleep throughout the night, and gives you a complete breakdown in the morning.
Settings Changes:
Prior to version 3.6.0, the user would select their resting HR directly in the IQ settings for the app. However, this required the user to be certain of their resting HR, and overall the calculations for detection and classification were decent but in some ways limited.
Going forward, the resting HR setting has been replaced in version 3.6.0+. Now, there will be three new settings:
User Age – This is the main setting that provides the starting point for determining a resting HR value for the person. The main driving force behind the calculation comes from a max theoretical HR, and taking a base of the value. In this case, 28% of max HR is used as the base value.
Tuning Value – Has a selectable range of 1–7, but is defaulted to 3. The user can change this value if they feel their results are not exactly accurate. The higher the value, the more sensitive to sleep the app will be during the set sleep window.
Athletic Ability – Finally, there is a setting for athletic ability the user can choose from. There are four options: Basic, Intermediate, Advanced, and Professional Athlete.
What's new
V4.5.0:
-Additional Optimizations to try and speed up the Restorative view render. The view seems to slow down when rendering, as more data records are added. This isn't an issue for other views. This Update attempts to solve the issue, but may require more updates.
V4.4.0 - 4.4.9
-Changed Sleep Index Record to be cached to speed up processing some more.
V4.3.0 - 4.3.1
-Addtional Fix To Speed Up Restorative View
V4.2.3:
-Restrotive Veiw Change Test
V4.2.1 -4.2.2:
- Fix for slow processing of Restorative Data View as records increase.
V4.2.0:
- Version 4.2.0 is a major update to the backgorund processing of Sleep Tracker.
1. Fix for Out of memory issues on the Venu 3.
2. Overall a reduction in processing times. The app with now process data in the backgorund every 10 miuntes, instead of every 20. OR in case of the Venu 3 it will proccess every 5 minutes.
3. Changes to opitmize dictionary use, reducing the impact on backgorund memory.
4. New Variable on the Raw Data screen. A "M" variable has been introduced for Memory level. You should see either a "N" or "L". N for normal and "L" for low. This is just an debug variable, and simply will let me know if your device is processing frequancy.
Version V4.0.0 Update:
A new Basic View is introduced, which provides the current time in digital format, as well as sleep and wake time indicators. The Basic View also will show the most recent sleep window data in small gauges around the time elements: Green—Overall Score, Teal—Light Sleep, Blue—Deep Sleep, Gold—REM, and Red—Awake data. There is also an indicator showing if the app is in Awake or Sleep Mode.
A new Restorative Trends view was also introduced, showing the last 7 days of restorative sleep data. The restorative scores are tracked and minimum, maximum, and average values are shown below the chart.
Last Night, Profile, and Restorative views now show sleep values in hours and not minutes.
A color theme option was added to let users customize clock time, color, and other indicator colors on the Basic View.
Getting Started With Sleep Tracker
Download the app
Configure your settings:
Sleep Start Hour (0-23, 24-hour format): When you typically go to bed
Sleep End Hour (0-23): When you typically wake up
User Age- Set Your Age
Tuning Value - See above section regarding the v3.6.0 update.
Athlecitc Ability - Set your Athletic Ability Level.
Wear your device while sleeping
Check results: Open the app 20+ minutes after your sleep window ends to view results
Three views available:
Nightly View: Displays your most recent sleep data
Profile View: Shows data based on your profile and time period settings
Raw Data View: Troubleshooting view. If you contact me about issues, I'll ask for this information
A Final Note: Background Processing
This app is designed to run strictly in the background. Once downloaded and configured, close the app and keep it closed during your sleep window. You can check progress occasionally, but don't keep it open in the foreground—the app handles all detection and processing automatically every 20 minutes while running in the background, which preserves battery.
The app will process your sleep data overnight and have results ready by morning.
Navigation tips:
Touch devices (Venu, Vivoactive): Swipe up/down to scroll between screens
Button devices (Fenix 8): Use the left-side middle and lower buttons to scroll, or swipe up/down