Difference between revisions of "Trigger: Battery Level"
| (One intermediate revision 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> |
| − | |||
| − | </pre> | ||
''' Options ''' | ''' 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'' | |
| + | <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 | |
| − | <pre class=" | + | Enable Wi-Fi |
| + | Enable Sync</pre> | ||
| + | <pre class="constraint-style">Constraints | ||
| + | |||
| + | Power Connected</pre> | ||
''' Notes ''' | ''' 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 ''' | ''' See Also ''' | ||
| − | * [[Constraint: | + | * [[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