Changes

2,506 bytes added ,  Yesterday at 19:46
no edit summary
Line 1: Line 1: −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">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.</pre>
This trigger will fire when the phone determines that you have fallen asleep of woken up (as specified).
     −
This trigger relies on Android's activity recognition feature to determine when you fall asleep and when you wake up. This may not be accurate on some devices.
+
''' Options '''
   −
To help find a setting that works well for your own device and scenarios you can tweak the awake and sleep thresholds. If you find that the trigger is firing when you don't expect it to, you should try adjusting the thresholds until you find values that work well for you.
+
* '''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)
   −
It's recommend to use this trigger in conjunction with a time of day constraint so it can only fire around the time that you typically go to bed/wake up. Without this you may get false triggers such as when you put your phone down and leave the room for some time you may be classified as being asleep.
+
''' Requirements '''
</pre>
+
 
 +
* Activity Recognition permission (Android 10+)
 +
* Google Play Services
 +
 
 +
''' Examples '''
 +
 
 +
'''Example 1: Bedtime routine'''
 +
 
 +
Automatically configure your phone when you fall asleep:
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Sleep: Fell Asleep</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Do Not Disturb: Enable
 +
Screen Brightness: 0%
 +
WiFi: Disable</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Time of Day: 9:00 PM - 6:00 AM</pre>
 +
 
 +
'''Example 2: Morning wake up'''
 +
 
 +
Start your morning routine when you wake up:
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Sleep: Woke Up</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Do Not Disturb: Disable
 +
Speak Text: "Good morning, the time is [hour]:[minute]"
 +
Launch Application: Weather App</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Time of Day: 5:00 AM - 10:00 AM</pre>
 +
 
 +
'''Example 3: Sleep tracking'''
 +
 
 +
Log your sleep patterns:
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Sleep: Fell Asleep</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Set Variable: [sleep_start] = [hour]:[minute]
 +
Log to file: "Fell asleep at [hour]:[minute]"</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Time of Day: 8:00 PM - 3:00 AM</pre>
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Sleep: Woke Up</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Set Variable: [wake_time] = [hour]:[minute]
 +
Log to file: "Woke up at [hour]:[minute]"</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Time of Day: 4:00 AM - 12:00 PM</pre>
 +
 
 +
''' 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 '''
 +
 
 +
* [[Constraint:_Time_of_Day|Time of Day Constraint]]