| Line 1: |
Line 1: |
| − | <pre style="background-color: #ACC8E5; color: #112A46; 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:''' | + | ''' Options ''' |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> | + | |
| − | 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 16% to 15% or up from 14% to 15% (respectively from 31% to 30% or from 29% to 30%)</pre>
| + | * '''Increase/Decrease''' - Trigger fires when battery reaches a specific threshold |
| − | <br>
| + | ** '''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 |
| | + | 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]] |