This trigger will fire when the phone determines that you have fallen asleep or woken up (as selected). This trigger relies on Android's activity recognition feature to determine when you fall asleep and wake up and may not be very accurate on some devices. You can adjust the awake/asleep thresholds to find a value that works best for your device.

Options

  • Fell Asleep - The trigger fires when Android's activity recognition determines you have fallen asleep
  • Woke Up - The trigger fires when Android's activity recognition determines you have woken up
  • Awake Threshold - Confidence level below which you are considered awake (0-100)
  • Asleep Threshold - Confidence level above which you are considered asleep (0-100)

Requirements

  • Activity Recognition permission (Android 10+)
  • Google Play Services

Examples

Example 1: Bedtime routine

Automatically configure your phone when you fall asleep:

Triggers

Sleep: Fell Asleep
Actions

Do Not Disturb: Enable
Screen Brightness: 0%
WiFi: Disable
Constraints

Time of Day: 9:00 PM - 6:00 AM

Example 2: Morning wake up

Start your morning routine when you wake up:

Triggers

Sleep: Woke Up
Actions

Do Not Disturb: Disable
Speak Text: "Good morning, the time is [hour]:[minute]"
Launch Application: Weather App
Constraints

Time of Day: 5:00 AM - 10:00 AM

Example 3: Sleep tracking

Log your sleep patterns:

Triggers

Sleep: Fell Asleep
Actions

Set Variable: [sleep_start] = [hour]:[minute]
Log to file: "Fell asleep at [hour]:[minute]"
Constraints

Time of Day: 8:00 PM - 3:00 AM
Triggers

Sleep: Woke Up
Actions

Set Variable: [wake_time] = [hour]:[minute]
Log to file: "Woke up at [hour]:[minute]"
Constraints

Time of Day: 4:00 AM - 12:00 PM

Confidence Threshold Configuration

Android's sleep detection provides a confidence value from 0 to 100:

  • 0 = Definitely awake
  • 100 = Definitely asleep

You can adjust the thresholds to fine-tune detection:

  • Awake Threshold - If confidence drops below this value, you're considered awake
  • Asleep Threshold - If confidence rises above this value, you're considered asleep

If you're experiencing false triggers:

  • Increase the asleep threshold if it triggers too easily
  • Decrease the awake threshold if it triggers wake-up too easily

Notes

  • It is strongly recommended to use this trigger in conjunction with a Time of Day constraint to avoid false triggers during the day (for example, when you put your phone down and leave the room)
  • Sleep detection accuracy varies significantly between devices
  • The trigger uses Google's Activity Recognition API for sleep segment detection
  • Battery impact should be minimal as the system manages the sleep detection
  • The Activity Recognition permission must be granted for this trigger to function
  • Some devices may not support sleep segment detection

See Also