Changes

no edit summary
Line 1: Line 1: −
<pre style="background-color: #EEEEEE; color: Black; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">The Battery Level trigger fires when the battery level increases or decreases to a selected level, or on any battery level change. This is useful for automating power-saving features or notifications based on battery status.</pre>
When the battery % increases or decreases, this trigger will fire. The trigger can be configured to trigger on any change or when the battery % increases or decreases to a certain level.</pre>
  −
'''HINT:'''<pre style="background-color: #EEEEEE; color: Black; border-radius: 10px; padding: 10px;">
  −
Don't forget that a trigger fires once at the exact time the event occurs. So, in the above examples, it will only fire when battery level goes down from 16% to 15% or up from 14% to 15% (respectively from 31% to 30% or from 29% to 30%)
  −
</pre>
  −
'''Example Usage:'''<br/>
  −
If the battery level decreases to 20% enable battery saving mode (this action requires adb hack or root)
  −
</pre>
  −
<pre style="background-color: red; color: white; border-radius: 10px; padding: 10px;">
  −
Triggers
     −
Battery (<=20%)
+
''' Options '''
</pre><br>
  −
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
  −
Actions
     −
Battery saver ON
+
* '''Increase/Decrease''' - Trigger fires when battery reaches a specific threshold
</pre><br>
+
** '''Increases to''' - Fires when battery level rises to or above the specified percentage
<pre style="background-color: green; color: white; border-radius: 10px; padding: 10px;">
+
** '''Decreases to''' - Fires when battery level falls to or below the specified percentage
Constrains
+
* '''Any Change''' - Trigger fires whenever the battery level changes
    +
''' Configuration '''
   −
</pre><br>
+
When selecting "Increase/Decrease" mode, you can specify the threshold:
'''Example Usage:''' If the battery level increases to 30% disable battery saving mode (this action requires adb hack or root)<br/>
  −
<pre style="background-color: red; color: white; border-radius: 10px; padding: 10px;">
  −
Triggers
     −
Battery (>=30%)
+
* Use the slider to set a battery percentage from 0% to 100% (default is 50%)
</pre><br>
+
* Alternatively, select a variable to dynamically determine the threshold level
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
+
* Choose whether to trigger on increases or decreases
Actions
     −
Battery saver OFF
+
''' Variable Support '''
</pre><br>
  −
<pre style="background-color: green; color: white; border-radius: 10px; padding: 10px;">
  −
Constrains
      +
You can use an integer variable to specify the battery threshold instead of a fixed value. This allows for dynamic thresholds that can be changed at runtime.
   −
</pre><br>
+
''' Examples '''
 +
 
 +
''Example 1: Low Battery Warning''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Battery <= 15%</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Enable Power Saving Mode
 +
Notification: Battery is low - 15% remaining</pre>
 +
 
 +
''Example 2: Resume Normal Mode When Charged''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Battery >= 80%</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Disable Power Saving Mode
 +
Enable Wi-Fi
 +
Enable Sync</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Power Connected</pre>
 +
 
 +
''' Notes '''
 +
 
 +
* The trigger only fires once when the level transitions to the new state, not on every subsequent level change where the condition remains true
 +
* For example, if you set "decreases to 20%", the trigger fires when battery drops to 20%, but not again at 19%, 18%, etc. until the battery first rises above 20% again
 +
* The trigger listens for the system broadcast ACTION_BATTERY_CHANGED
 +
* Some devices may not report every 1% change but may report in intervals such as 5% or 10%
 +
* The "Any Change" option is useful for logging or monitoring battery drain patterns
 +
 
 +
''' See Also '''
 +
 
 +
* [[Constraint:_Battery_Level|Battery Level Constraint]]
 +
* [[Trigger:_Battery_Temperature|Battery Temperature Trigger]]