Automation - Sleep as Android

sleep_tracking_started …​ sleep_tracking_stopped …​ sleep_tracking_paused …​ sleep_tracking_resumed …​ alarm_snooze_clicked You have snoozed a ringing alarm. alarm_snooze_canceled You have a canceled an alarm that is currently snoozed. time_to_bed_alarm_alert Fires when you get a bedtime notification. alarm_alert_start Fires when alarm starts. We are sending the following values: value1: UNIX timestamp of the alarm start time, example: "1582719660934" value2: alarm label, example: "label" (Any tabs and newline characters in the label will be removed before sending) alarm_alert_dismiss Fires when you dismiss alarm (after you solve CAPTCHA, if it’s set). alarm_skip_next Fires when you tap dismiss an alarm from notification before it actually rings. rem Fires when we estimate the start of REM phase. smart_period Fires 45 minutes before the smart wakeup period starts. lullaby_start Fires when lullaby starts playing. lullaby_stop Fires when lullaby is stopped (either manually or automatically). lullaby_volume_down Fires when we detect you fell asleep and starting lowering the volume of lullabies. deep_sleep Fires when we detect you going into deep sleep phase. Warning: This may result in lots of events during the night and may not exactly fit the resulting sleep graph as we can only detect phases reliably from whole-night data. light_sleep Fires when we detect you going into light sleep phase. Warning: This may result in lots of events during the night and may not exactly fit the resulting sleep graph as we can only detect phases reliably from whole-night data. awake Fires when we detect you woke up. not_awake Fires when we detect you fell asleep. apnea_alarm Fires when we detect a significant dip in your oxygen levels. antisnoring Fires when antisnoring is triggered. sound_event_snore Fires when we detect snoring. sound_event_talk Fires when we detect talking. sound_event_cough Fires when we detect coughing. sound_event_baby Fires when we detect baby cry. sound_event_laugh Fires when we detect laughter.

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

The docs state that events sometimes pass values onto services. For example “alarm_alert_dismiss” passes two variables, a timestamp and the label of the alarm. However I cannot get Tasker to see these variables. Is Sleep as Android correctly sending variables to Tasker, or am I incorrectly setting this up? I tried to use them with the “evtprm” variable as discussed in the Tasker documentation.

For what it’s worth, it appears if you snooze, then tap on the notification to stop the alarm you will only receive the event name in the json data. When I dismiss it without snoozing I see the expected values:

{"value1":"1618972080000","value2":"Test","event":"alarm_alert_dismiss"}

I need an event that gets triggered before an alarm starts to ring by a fixed time. The smart_period event works for this purpose, but only if sleep tracking is enabled. Is there a possibility for such an event? Maybe smart_period event can still be triggered even thought sleep tracking is not enabled?

Hello @casablanca, I’m adding the intent com.urbandroid.sleep.alarmclock.SHOW_SKIP_NEXT_ALARM_ACTION_AUTO… this will be send exactly 1 hour before the next alarm is triggering…

This will be available to enable in Settings > Automation > Events…

Hope that helps…

Forgot to mention that this will appear in the next BETA version of the app which I will be releasing probably today or tomorrow…

1 Like