Getting Started with Boolean Toolbox

Create your first logic device in under 5 minutes

What You'll Build

In this guide, you'll create a simple motion-activated light that only works when it's dark outside.

IF (Motion Detected) AND (Dark Outside)
THEN Turn On Lights

1

Add Your First Device

  1. 1. Open Homey app โ†’ Navigate to Devices
  2. 2. Tap Add Device โ†’ Select Boolean Toolbox
  3. 3. Choose device type:
    • Logic Device - Recommended for beginners (visual setup, single formula)
    • Logic Unit - For advanced users (JSON config, multiple formulas)
  4. 4. Give it a descriptive name like "Motion Light Controller"

๐Ÿ’ก Tip

Start with Logic Device if you're new to Boolean Toolbox. It has a visual pairing wizard that makes setup easier.

2

Configure Your Inputs

For our example, we need two inputs:

Input A: Motion Sensor

Browse to your motion sensor โ†’ Select alarm_motion capability

Input B: Lux Sensor

Browse to your light sensor โ†’ Select measure_luminance capability

๐Ÿ’ก Tip

Don't have a lux sensor? Use a virtual device or connect to weather data. You can also start with just motion detection!

3

Write Your First Formula

Go to device settings and configure the formula:

[
  {
    "id": "motion_and_dark",
    "name": "Motion & Dark",
    "expression": "A AND B",
    "enabled": true,
    "timeout": 60,
    "firstImpression": false
  }
]

Understanding the Formula

  • id: Unique identifier for this formula
  • name: Human-readable name
  • expression: The boolean logic (A AND B means both must be true)
  • enabled: Formula is active
  • timeout: Wait max 60 seconds for all inputs
  • firstImpression: Don't lock inputs at first value

โšก Quick Start

For motion only (without lux sensor), use: "expression": "A"

4

Test Your Logic

Use the Boolean Logic Emulator to verify your expression works correctly:

Testing Checklist

  • โœ… Test with A=true, B=true (should be TRUE)
  • โœ… Test with A=true, B=false (should be FALSE)
  • โœ… Test with A=false, B=true (should be FALSE)
  • โœ… Test with A=false, B=false (should be FALSE)
5

Create Your First Flow

Now connect your logic device to actual actions:

WHEN

Formula [motion_and_dark] changed to TRUE

AND

(no conditions needed)

THEN

Turn on [Living Room Lights]

๐Ÿ’ก Pro Tip

Create a second flow that turns lights OFF when the formula changes to FALSE. This creates automatic lighting control!

Common Logic Patterns

Simple Motion Detection

"expression": "A"

Light turns on when motion detected

Motion AND Dark

"expression": "A AND B"

Light only turns on when motion detected AND it's dark

Any Sensor Triggered

"expression": "A OR B OR C"

Alert if ANY of multiple sensors trigger

Home AND Night (with NOT)

"expression": "A AND NOT B"

Someone home (A) but NOT daytime (B) = Night mode

Complex Condition

"expression": "(A OR B) AND C AND NOT D"

(Motion OR Door) AND Dark AND NOT Away Mode

Available Operators

Operator Alternative Description Example
AND & Both must be true A AND B
OR | At least one must be true A OR B
XOR ^ Exactly one must be true A XOR B
NOT ! Inverts the value NOT A

๐Ÿš€ What's Next?

Learn More

Try Advanced Features

  • โ†’ Multiple formulas per device
  • โ†’ First Impression mode
  • โ†’ Timeout detection
โ†‘ Back to top