Changes

no edit summary
Line 1: Line 1: −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">The Light Sensor trigger fires when the ambient light level transitions above or below a specified threshold value. The trigger activates on the transition between states, not continuously while in a particular state.</pre>
This trigger can be used to invoke a macro when the light level transitions from below a certain level to above, or vice versa. Note that the trigger will only fire on the transition between the above/below state and will not fire again until the transition happens again.
     −
By default this trigger will only work when the screen is off.
+
''' Options '''
There is an option that can be set via the settings -> trigger options -> light sensor that will enable the trigger to function when the screen is off.
+
 
</pre>
+
* '''Light Level (lux)''': The threshold light level in lux units. The current ambient light level is displayed in the configuration dialog for reference.
* '''''It is strongly recommended not to use this feature as it will causes significant battery drain as it requires to keep the CPU on in order to function.'''''
+
 
 +
* '''Direction''':
 +
** '''Decreases to''': Trigger fires when the light level drops from above the threshold to at or below it
 +
** '''Increases to''': Trigger fires when the light level rises from below the threshold to at or above it
 +
 
 +
''' Settings '''
 +
 
 +
In MacroDroid Settings under Trigger Options > Light Sensor, you can configure:
 +
* '''Background Scan Rate''': How often to check the light level when the screen is off (in minutes). Set to 0 to disable background scanning.
 +
 
 +
''' Examples '''
 +
 
 +
''Example 1: Increase Brightness in Dark Environment''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Light Sensor - Decreases to 50lx</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Set Brightness - Auto Brightness: OFF
 +
Set Brightness - Level: 100%</pre>
 +
 
 +
Sets screen brightness to maximum when the ambient light drops below 50 lux.
 +
 
 +
''Example 2: Toggle Night Mode Based on Light''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Light Sensor - Decreases to 100lx</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Set Variable - night_mode = true
 +
Enable Macro - Night Mode Settings</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Time of Day: 6:00 PM - 11:00 PM</pre>
 +
 
 +
Activates night mode when it gets dark in the evening.
 +
 
 +
''' Notes '''
 +
 
 +
* The trigger only fires on transitions - it will not fire again until the light level crosses the threshold in the opposite direction.
 +
* By default, the light sensor only operates when the screen is on.
 +
* Enabling background scanning (screen off operation) will cause significant battery drain as it requires keeping the CPU active.
 +
* The minimum time between sensor checks is 500 milliseconds to prevent excessive processing.
 +
* This trigger requires the device to have a light sensor. It will not appear on devices without one.
 +
* Light values are measured in lux (lx). Typical values:
 +
** Direct sunlight: 10,000+ lx
 +
** Overcast day: 1,000-2,000 lx
 +
** Office lighting: 300-500 lx
 +
** Living room: 50-300 lx
 +
** Twilight: 10-50 lx
 +
** Full moon: 0.1 lx
 +
 
 +
''' Battery Warning '''
 +
 
 +
Enabling background light sensor scanning (when the screen is off) is strongly discouraged as it will cause significant battery drain. Only use this feature if absolutely necessary and you understand the battery impact.
 +
 
 +
''' See Also '''
 +
 
 +
* [[Trigger:_Proximity_Sensor|Proximity Sensor Trigger]]
 +
* [[Action:_Set_Brightness|Set Brightness Action]]