The MacroDroid Variable Change trigger fires when a MacroDroid variable is set to a certain value. This trigger monitors both global and local variables, allowing you to create reactive macros that respond to changes in variable state. The trigger fires once when the condition is first met, not repeatedly while the condition persists.

Options

Variable Selection

First, select which variable to monitor from the list of available global and local variables. Variables can be of the following types:

  • String
  • Integer
  • Decimal
  • Boolean
  • Dictionary (with key selection)
  • Array (with index selection)

Trigger Mode

  • Specific Value Change - Fire when the variable changes to a specific value matching certain criteria
  • Any Value Change - Fire whenever the variable value changes to any new value

Comparison Options by Variable Type

Boolean Variables:

  • True
  • False

Integer/Decimal Variables:

  • Equal to (=) - Fires when the value equals the specified number
  • Not equal to (!=) - Fires when the value does not equal the specified number
  • Greater than (>) - Fires when the value becomes greater than the specified number (fires once on transition)
  • Less than (<) - Fires when the value becomes less than the specified number (fires once on transition)

For numeric comparisons, you can specify:

  • A fixed numeric value
  • Another variable's value
  • A mathematical expression

String Variables:

  • Equals (=) - Fires when the string exactly matches the specified text
  • Not equals (!=) - Fires when the string does not match the specified text
  • Contains - Fires when the string contains the specified text as a substring
  • Excludes - Fires when the string does NOT contain the specified text

Additional String Options

  • Enable regular expression matching - Use regex syntax for pattern matching
  • Ignore case - Perform case-insensitive comparison (disabled when regex is enabled)

Wildcard Matching

When not using regex, wildcards can be used in string matching:

  • Asterisk (*) - Matches zero or more characters
  • Question mark (?) - Matches exactly one character

Examples

Example 1: Announce when counter reaches 100

Triggers

MacroDroid Variable Change: counter = 100
Actions

Speak Text: Counter has reached 100

Example 2: React to status variable containing "error"

Triggers

MacroDroid Variable Change: status contains error
Actions

Notification: Error detected in status

Notes

  • For greater than (>) and less than (<) comparisons, the trigger only fires once when the value transitions into this state, not on subsequent updates where the same condition is still met
  • Local variables are only monitored for the macro they belong to
  • Dictionary and array variables allow you to monitor specific keys or indices
  • Magic text can be used in string comparison values
  • Expression evaluation is supported for numeric comparisons (e.g., using mathematical formulas)

See Also