Track everyone's sleep habits by their GM and GN notes. 🤣
Discussion
Ah that would involve indexing all the notes
How about flipping that around by using the Oura API with Nostr to automatically generate notes (events) whenever you wake up, fall asleep, or enter different sleep phases.
How it would work:
Oura API tracks your sleep activity, including when you fall asleep, wake up, and enter sleep phases (light, deep, REM).
A script or service periodically checks Oura API data.
Upon detecting a specific event (falling asleep, waking up, sleep phase transitions), it publishes a note/event to the Nostr protocol.
Key considerations:
1. Oura API
Oura provides REST endpoints for accessing sleep data.
Use GET /v2/usercollection/daily_sleep or the detailed sleep endpoint (/v2/usercollection/sleep) for more granular data.
2. Detecting Events
Regularly poll Oura's API to get updates.
Compare timestamps and sleep phase data with previously stored state to detect new events.
3. Publishing to Nostr
Use a Nostr client library like nostr-sdk, nostr-tools, or nostr-python to publish notes. I like a combination of python and Nak.
Generate a unique note each time a new sleep event occurs (e.g., “gm!,” "gn!", “dreaming! 02:37 AM”).
Neat