Wearable integration API - Sleep as Android

When a phone needs to connect to your watch (start of tracking, alarm, ..) it first checks whether the wearable is connected. It will issue the following intent:


This is a companion discussion topic for the original entry at https://docs.sleep.urbandroid.org//devs/wearable_api.html

Is there a place to see a current list of wearables, and what features are implemented?

I’m specifically interested in which devices can be used as a backup alarm, which I imagine would use the set alarm API call. Wouldn’t necessarily need to be a smart watch or wearable; I’d use any device with this capability.

Thanks! :herb:

Thanks!

While it’s great to have this api I think it needs some improvements:

HTTP API

There’s already one, but not documented. So, it would be nice to document also the HTTP API as it’s used by SleepAsFitbit, even though it matches quite a lot the the intents API.

Alarm management

I’d love to have the support for some simple alarm management from wearables.

Captured data batch syncs

This is quite important IMHO, some devices may be able to keep apps monitoring all the night long, but not to communicate with their companion app all the times, or the companion might crash or the phone for some reason stop working (battery is over?!), or just the bluetooth communication stop.

In such cases, all the data that the wearable might have collected is just LOST.
As per this, it would be quite important to introduce APIs to allow wearables to send “catchup data” (so timestamped sensor values) whenever they want so that Sleep as Android can be able to fetch those once active, and aggregate them together.

This may also allow saving energy on the phone and wearables, as it will reduce the bluetooth traffic and the phone background activity.
Not only, you could even just record a night from your watch and then sync it with sleep as android as soon as you can (imagine you went somewhere without your phone).

At the end, while you’re sleeping you don’t care about having the data saved promptly, while you do care about having the correct results in the morning. And while it’s true that SaA is more about having a good sleep and better wake up, if something failed reading your sensors, you may still care about having the right data shown.

2 Likes

I also think time stamped sensor data support would be excellent.
It lets us bring data in that can only be collected at the end of the sleep session such as with the Oura ring. This ring turns its transmission off while it’s recording. Live capture is not possible.

Sleep bot, if I remember the product correctly also provides a collection of data that’s currently imported through the CSV format through a companion python script. And my understanding with that path of introducing the data to SaA is no calculations will be done on the data that are normally done when they come through the wearables integration API.