Logic

Logic blocks enable decision-making in your scripts. Use these blocks to compare values, create conditional behaviors, combine multiple conditions, and control program flow based on device states.

value

A boolean constant that represents true or false. Use this block to provide boolean values to conditions, comparisons, or variables.

Parameters:

  • Value (Boolean): Select true or false

Returns:

  • Boolean: #t for true, () for false (Lisp values)

Example:

Set initial values

if

Executes code conditionally based on whether a condition is true. This is the fundamental building block for creating decision-based behavior in your scripts.

Parameters:

  • Condition (Boolean): The condition to evaluate

Example:

Send event if button was clicked

Adding else if and else Clauses

The basic if block can be extended with additional conditions and fallback logic. Click the gear icon to open the configuration panel:

Drag else if and else blocks from the left panel to build your conditional logic. You can add multiple else if clauses but only one else clause. Reorder or remove clauses as needed, then click the gear icon to close:

comparison

Compares two values using mathematical or equality operators. Use this to check sensor thresholds, compare states, or validate ranges.

Parameters:

  • Left Value (Number): The first value to compare

  • Operator: Choose from = (equal), (not equal), < (less than), > (greater than), (less or equal), (greater or equal)

  • Right Value (Number): The second value to compare

Returns:

  • Boolean: #t (true) if the comparison is satisfied, () (false) otherwise

Example:

Check humidity and send event when it is too high

and

Returns true only if both conditions are true. Use this to combine multiple requirements that must all be satisfied.

Parameters:

  • Input A (Boolean): The first condition

  • Input B (Boolean): The second condition

Returns:

  • Boolean: #t (true) if both inputs are true, () (false) otherwise

Example:

Multiple condition check

or

Returns true if at least one condition is true. Use this when any of several conditions should trigger an action.

Parameters:

  • Input A (Boolean): The first condition

  • Input B (Boolean): The second condition

Returns:

  • Boolean: #t (true) if at least one input is true, () (false) otherwise

Example:

Humidity alert

not

Inverts a boolean value, turning true into false and false into true. Use this to reverse conditions or check for the opposite of a state.

Parameters:

  • Input (Boolean): The boolean value to invert

Returns:

  • Boolean: #t (true) becomes () (false), and vice versa

Example:

Toggle state by button click

Last updated