Difference between revisions of "Trigger: Battery Level"

 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<pre class="header-style">
+
<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:'''<br/>
 
Don't forget that a trigger fires once at the exact time the event occurs. So, in the below examples, it will only fire when battery level goes down from 21% to 20% or up from 29% to 30%.<br/>
 
<br>
 
'''Example Usage #1:'''<br/>
 
If the battery level decreases to 20% lower the screen brightness.
 
<pre class="trigger-style">
 
Triggers
 
  
Battery (<=20%)</pre>
+
''' Options '''
<pre class="action-style">
 
Actions
 
  
Screen Brightness 25%
+
* '''Increase/Decrease''' - Trigger fires when battery reaches a specific threshold
</pre>
+
** '''Increases to''' - Fires when battery level rises to or above the specified percentage
 +
** '''Decreases to''' - Fires when battery level falls to or below the specified percentage
 +
* '''Any Change''' - Trigger fires whenever the battery level changes
  
<br>
+
''' Configuration '''
'''Example Usage #2:'''<br/>
 
If the battery level increases to 30% increase the screen brightness.
 
<pre class="trigger-style">
 
Triggers
 
  
Battery (>=30%)
+
When selecting "Increase/Decrease" mode, you can specify the threshold:
</pre>
 
<pre class="action-style">
 
Actions
 
  
Screen Brightness 75%
+
* Use the slider to set a battery percentage from 0% to 100% (default is 50%)
</pre>
+
* Alternatively, select a variable to dynamically determine the threshold level
 +
* Choose whether to trigger on increases or decreases
  
</pre><br>
+
''' Variable Support '''
 +
 
 +
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.
 +
 
 +
''' 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]]

Latest revision as of 21:40, 5 January 2026

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.

Options

  • Increase/Decrease - Trigger fires when battery reaches a specific threshold
    • Increases to - Fires when battery level rises to or above the specified percentage
    • Decreases to - Fires when battery level falls to or below the specified percentage
  • Any Change - Trigger fires whenever the battery level changes

Configuration

When selecting "Increase/Decrease" mode, you can specify the threshold:

  • Use the slider to set a battery percentage from 0% to 100% (default is 50%)
  • Alternatively, select a variable to dynamically determine the threshold level
  • Choose whether to trigger on increases or decreases

Variable Support

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.

Examples

Example 1: Low Battery Warning

Triggers

Battery <= 15%
Actions

Enable Power Saving Mode
Notification: Battery is low - 15% remaining

Example 2: Resume Normal Mode When Charged

Triggers

Battery >= 80%
Actions

Disable Power Saving Mode
Enable Wi-Fi
Enable Sync
Constraints

Power Connected

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