How I track my sleep
Around a month ago, I was thinking of going to sleep with my Apple Watch since Apple introduced "Sleep Score". I was curious to find out how terrible my sleep was.
For context, I go to sleep around 9-10 pm and wake up around 5-6 am. The problem is that I wake up so tired, like I ran a marathon the day before.
So the whole sleeping with Apple Watch thing ended after a week. One day I woke up so tired that the only thing I was thinking about at the moment was going to sleep for another 2 hours. What did Apple Watch think about my sleep? Score 98 out of 100 points. Hell no. That was the last time I slept with my Apple Watch.
So I started to think about how to track how long I was sleeping and how I really felt after waking up.
Shortcuts + n8n to the rescue
I started by creating a simple shortcut that:
- When started from 4 am to 3 pm, it asks how I slept on a scale from 1 - terrible to 5 - best night of my life (never happened), and I can leave a comment. After getting that info, a request to n8n is made with this data.
- When started outside this 4 am - 3 pm window, it opens the clock app so I can set alarms, and another request to n8n is made.
In n8n, I use a new feature released recently "Data tables". It's a simple implementation of a database. To be honest, before this feature I was a huge fan of n8n. Now I'm sold.
There are 2 requests made to n8n: one for "going to sleep" and another one for "waking up".

Going to sleep just creates a row in the Data table with the date of the night it applies to and the datetime of the request. As the date of the night, I store the date after midnight, so when I'm going to sleep around 10 pm on the 10th of August, the date is the 11th of August.
The wake up request just sets the datetime of waking up, as well as stores my sleep score with a little comment. The next thing this n8n workflow does is calculate how long I was asleep and sends this to me via a Telegram bot.
What's next?
For now, collecting more data. Later, I'll probably use some LLM to analyze this data, maybe with a correlation to what I eat or to my workouts.