https://sleep.urbandroid.org/documentation/integration/ifttt/ shows rem event as webhook ( * fires when we estimate the start of REM phase)
I’d like to have possibility for light ( * fires when we estimate the start of Light phase) and deep ( * fires when we estimate the start of Deep phase) sleep also. Or maybe even better: gosleep ( * fires when we estimate the start of the first sleep phase after starting the sleep tracker)
I will add them to the next beta during the next week.
Word of warning though - the deep and light phases in realtime may be less accurate, and most probably will not be the same as phases in the final hypnogram.
The reason is simple - in the morning we have all data for the whole night and can compute the sleep phases from them, while in realtime we have to predict what will happen.
Great! The reason for this is that I want to send a command to the (squeezebox) radio to sleep in 15 minutes (gradually decrease the volume in 15 minutes) when SleepAsAndroid detects I’m asleep. I will let you know if this works fine or not after a week of testing.
Ha @jiri-urbandroid, any chance the update will go live in a beta release someday soon?
Regards,
Stephan
Hi @Stephan_van_der_Plas, I believed that we already did add it but now checking through the files I was wrong! Sorry for that, I’m adding deep sleep start and light sleep start right now.
Hello Jiri,
Is somewhere documented what webhooks you addes in the latest beta release so I can use it? When I google release notes, I do not find the beta releases, and the release notes function in the app itself doesn’t work (only a white screen with some links, no info.)
Hi @jiri-urbandroid, could you please give me the names of the new webhooks? I cannot find it in documentation.
Regards,
Stephan
Bumping this question. I’d really like to make use of these webhooks.
Heh, this has been full of unfulfilled promises on my end. I did not actually add the webhooks in the end.
We discussed this internally afterwards (and I’m sorry I didn’t let you know about that) and concluded that it would be quite an overhead for the app to send a web request every time a sleep phase start is estimated. That would be many times per night, we would always need to turn on wifi etc.
So as a compromise, if you agree, we’re adding a broadcast intent to be sent when the phase starts (see the https://sleep.urbandroid.org/documentation/developer-api/intents-and-content-providers/ docs).
You can catch this event with Tasker, optionally do some further logic, and then send a request to IFTTT.
Deep sleep phase started
com.urbandroid.sleep.TRACKING_DEEP_SLEEP_AUTO
Light sleep phase started
com.urbandroid.sleep.TRACKING_LIGHT_SLEEP_AUTO
React to Sleep as Android events with Tasker
Event -> System -> Intent (previously Misc -> Intent received) and add one of the Intents described above.
For example you can start you weather app when alarm is dismissed, by listening for the com.urbandroid.sleep.alarmclock.ALARM_ALERT_DISMISS_AUTO intent.
You can also use other automation apps that are able to listen to a broadcast intent such as Automate.
NOTE: The intents will be present in the next beta sometime during this week.