Difference between revisions of "Constraint: AND / OR / XOR / NOT"

 
Line 1: Line 1:
<span style="color: #0E9549; font-size: 24px;">'''About this constraint '''</span>
+
<pre class="header-style">This constraint lets you combine other constraints using AND, OR, XOR, or NOT logic.</pre>
  
This constraint may be used to perform logical operators on any child constraints that are added to this constraint.
+
''' Options '''
  
To add child constraint(s) tap the constraint in the edit macro screen and select the 'add constraint' option. All child constraints will appear indented directly under this constraint.
+
* '''AND''': All nested constraints must be true
<br/>
+
* '''OR''': At least one nested constraint must be true
 +
* '''XOR''': Exactly one nested constraint must be true
 +
* '''NOT''': Invert the result of the nested constraints
  
When several constraints are used, they are linked by an implicit AND i.e. ALL the constraint conditions have to be TRUE for the action to execute.
+
''' Example '''
  
If you need a more sophisticated logic, you can link the constraints with logical operators:
+
''Example 1: Enable DND only when it is late and Wi-Fi is disconnected''
<br/>
+
  <pre class="trigger-style">Triggers
  
<span style="color: #0E9549; font-size: 24px;">'''AND logic operator (by default)'''</span><br/>
+
Screen On/Off - Screen On</pre>
 +
  <pre class="action-style">Actions
  
ALL constraint conditions below this operator have to be TRUE. If no other logical operators are needed, this one is not necessary.
+
Priority Mode / Do Not Disturb (Priority Only)</pre>
 +
  <pre class="constraint-style">Constraints
  
<span style="color: #0E9549; font-size: 24px;">'''OR logic operator '''</span><br/>
+
AND
 +
- Time of Day (22:00-06:00)
 +
- Wifi State (Disconnected)</pre>
  
AT LEAST ONE of the constraint conditions below this operator has to be TRUE.
+
''' See Also '''
  
<span style="color: #0E9549; font-size: 24px;">'''XOR (XOR = eXclusive OR)'''</span><br/>
+
* [[Constraint: Time of Day|Time of Day Constraint]]
 
+
* [[Constraint: Wifi State|Wifi State Constraint]]
ONE AND ONLY ONE of the constraint conditions below this operator has to be TRUE.
 
 
 
 
 
<span style="color: #0E9549; font-size: 24px;">'''Logical operator NOT '''</span><br/>
 
 
 
NEGATION of the constraint condition attached i.e. the constraint has NOT to be TRUE for the action to execute.
 
 
 
All these constraints and operators can be nested to get even more sophisticated conditions.
 

Latest revision as of 10:56, 9 January 2026

This constraint lets you combine other constraints using AND, OR, XOR, or NOT logic.

Options

  • AND: All nested constraints must be true
  • OR: At least one nested constraint must be true
  • XOR: Exactly one nested constraint must be true
  • NOT: Invert the result of the nested constraints

Example

Example 1: Enable DND only when it is late and Wi-Fi is disconnected

Triggers

Screen On/Off - Screen On
Actions

Priority Mode / Do Not Disturb (Priority Only)
Constraints

AND
- Time of Day (22:00-06:00)
- Wifi State (Disconnected)

See Also