Skip to content

Latest commit

ย 

History

468 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Smart (Components) Toolkit for Homey

Name Change: This app was previously known as "Boolean Toolbox". The name was changed to "Smart (Components) Toolkit" to better reflect the expanded functionality beyond just boolean logic - now including state management, scene control, and flow utilities.

๐Ÿ“š Full Documentation: https://tiwas.github.io/SmartComponentsToolkit/

Advanced logic and state management for your Homey automations. Create smart devices that react to multiple inputs with customizable formulas, and manage device states with powerful capture/restore functionality.

Stable Test Homey

v1.10.30 test โ€” fixes app restarts and Logic Devices that stopped reacting, and adds background waits for Conditional Gates and capability waiters beyond Homey's 60-second Flow card limit. See the Conditional Gates and Waiter Gates guides.


๐Ÿ› ๏ธ Interactive Tools

Test and build your logic before deploying:


๐Ÿ–ฅ๏ธ Smart (Components) Toolkit Widget (experimental)

A floating, always-on-top desktop widget that lets you run Homey flows from any platform you're working on, with local favorites organized into folders and live Homey notifications surfaced as on-screen toasts.

See apps/dashboard/README.md for setup, OAuth scopes and build instructions.


๐Ÿ“ฆ Device Types

Composite Device

Combine the same capability from two or more Homey devices into one live virtual sensor, alarm, or text value.

Feature Description
Setup Visual pairing wizard - select capability โ†’ calculation โ†’ source devices
Numbers Average, minimum, maximum, sum, median
Booleans Any/all, majority, count on, percentage on
Text / time Most common, min/max, newest, circular average clock time
Flow triggers Any value change, or numeric change above a fixed/percentage threshold

๐Ÿ“š Read Composite Device guide โ†’


Logic Device

The easiest way to create boolean logic with a visual pairing wizard.

Feature Description
Setup Visual pairing wizard - select zone โ†’ device โ†’ capability
Inputs Dynamic (2-10, auto-expands based on formula)
Formulas Single formula per device
Best for Simple setups, beginners

๐Ÿ“š Read Logic Device guide โ†’


Logic Unit

Powerful device for advanced users who need multiple formulas or prefer JSON configuration.

Feature Description
Setup Quick add with manual JSON configuration
Inputs Dynamic (2-10, auto-expands based on formula)
Formulas Multiple independent formulas per device
Best for Advanced users, multi-formula needs

Note: Logic Unit X (2, 3, 4...10 inputs) are legacy devices with fixed input counts - use the new Logic Unit instead.

๐Ÿ“š Read Logic Unit guide โ†’


State Device

Capture and restore device states. Create "scenes" by storing the current state of multiple devices and applying them later with a single action.

Feature Description
Setup Visual pairing wizard - select zones and devices
Values Fixed at setup time
Use case Predefined scenes (Movie Night, Cleaning, etc.)

Key features:

  • Capture current state of multiple devices across zones
  • Apply stored state with a single flow action
  • "Reset All" option to turn off other State Devices first
  • Hierarchical execution with configurable delays

๐Ÿ“š Read State Device guide โ†’


State Capture Device

Dynamic state capture with templates, named slots, and push/pop stack operations.

Feature Description
Setup Visual pairing wizard - define template of devices/capabilities
Values Captured at runtime (not fixed)
Named states Store multiple named snapshots
Stack Push/pop for temporary state management

Key features:

  • Capture current device states to named slots at runtime
  • Push/pop stack for temporary state changes (e.g., doorbell interruption)
  • Dynamic state names with Homey tokens support
  • Max 50 named states, max 20 stack depth per device

Example use case:

WHEN: Doorbell rings
THEN: Push current state to stack
THEN: Set all lights to 100%
THEN: Pop state (restore previous) [Homey Flow delay: 5 minutes]

Use Homey's built-in Flow delay for pauses like this. Homey stops app Flow cards after 60 seconds, so the app's own Wait card is limited to 55 seconds.

๐Ÿ“š Read State Capture Device guide โ†’


Circadian Light Group (stable v1.10.16 / test v1.10.30)

Virtual light device that adjusts brightness and color temperature for a group of real lights based on time, sun position or ambient lux.

Feature Description
Schedule Per anchor: clock time / solar event / lux sensor crossing
Solar events Sunrise, sunset, civil/nautical/astronomical dawn/dusk, golden hour, blue hour, solar noon/midnight โ€” with offset and polar fallback
Light profile Per-phase dim + temperature, red mode threshold
Outdoor source Astronomical / lux sensor / Open-Meteo / MET.no / external
Per-light Enable, prewarm, allow red mode, min/max dim

Key features:

  • Mix-and-match anchor modes per phase (e.g. morning by clock, evening by sunset)
  • Red mode threshold: lights with color support shift to red when calculated temperature drops below threshold
  • Live tile shows calculated values regardless of on/off or paused state
  • 24 flow cards: pause-until, force red, apply temporary state, phase-changed trigger, app-level solar event trigger and more

Install via test channel: homey.app/a/no.tiwas.booleantoolbox/test/

๐Ÿ“š Read Circadian Light Group guide โ†’


๐Ÿฉบ Diagnostics and support

App Settings can generate a local diagnostic report and open a new GitHub issue with the report prefilled. The report includes app uptime, recent warnings/errors and stack traces, anonymous device counts, Circadian Light Group scheduler/member load, and available CPU, memory, and storage data. Common identifiers and secrets are redacted, nothing is uploaded automatically, and the report remains editable before submission.


๐ŸŽ›๏ธ Flow Cards (No Device Needed)

These flow cards work independently - no device setup required.

Conditional Gates

Simple GO/NO GO flow control without needing variables or devices. Gates persist in memory until changed.

Feature Description
States GO (open) or NO GO (closed)
Wait condition Pause flow until gate becomes GO (with timeout, max 55 seconds)
Background wait Wait minutes or hours for GO, then fire a trigger
Control Open/close gates from any flow

Flow Cards:

  • Gate is GO/NO GO (condition) - Check gate state instantly
  • Conditional Gate: Wait for GO (condition) - Pause until gate opens or timeout (up to 55 seconds)
  • Modify Conditional Gate (action) - Set gate to GO, NO GO, or Toggle, and/or change the timeout of waiting flows
  • Start waiting for Conditional Gate GO (action) - Start a background wait and continue immediately
  • Conditional Gate wait finished (trigger) - Fires when a background wait ends; tags opened, result (GO/TIMEOUT), waited_seconds

Homey's 60-second Flow card limit: Homey stops every app Flow card after 60 seconds. The Wait for GO condition therefore ends with an error after 55 seconds if the gate is still NO GO, even if its timeout is longer. For longer waits, use Start waiting for Conditional Gate GO together with the Conditional Gate wait finished trigger. In an Advanced Flow both cards can sit on the same canvas.

Example:

Flow 1 - Motion detected:
WHEN: Motion sensor triggered
THEN: Modify Conditional Gate "allow_lights" โ†’ GO

Flow 2 - Turn on lights:
WHEN: Door opened
AND: Gate "allow_lights" is GO
THEN: Turn on lights

Flow 3 - Disable at night:
WHEN: Time is 23:00
THEN: Modify Conditional Gate "allow_lights" โ†’ NO GO

Long wait example (turn the razor off after 2 minutes, or earlier on GO):

WHEN: Razor turned on
THEN: Modify Conditional Gate "Razor" โ†’ NO GO   (re-arm the gate)
THEN: Start waiting for Conditional Gate GO "Razor" (default: NO GO, timeout: 2 minutes)

WHEN: Conditional Gate wait finished "Razor"
THEN: Turn off Razor
      (optional: use the Result tag โ€” GO = released early, TIMEOUT = 2 minutes passed)

WHEN: <something should end the wait early>
THEN: Modify Conditional Gate "Razor" โ†’ GO

Starting the wait again for the same gate (for example when the razor is turned on again) restarts the countdown; the replaced wait does not fire the trigger.

Limitations: Gate states and pending waits live in memory. They are lost when the app restarts (update, Homey reboot, crash); a pending background wait then never fires its trigger.

๐Ÿ“š Read Conditional Gates guide โ†’


Waiter Gates

Waiter Gates let your flows pause and wait for device states to change, with YES/NO outputs:

Feature Description
Wait condition Pause flow until device capability reaches target value (max 55 seconds)
YES path Value matches (or already matched)
NO path Timeout expired before match, or a newer run with the same Waiter ID took over
Background wait Wait minutes or hours for a value, then fire a trigger

Flow Cards:

  • Wait until device capability becomes value (condition) - Waits with timeout (up to 55 seconds)
  • Start waiting until device capability becomes value (action) - Start a background wait and continue immediately
  • Capability wait finished (trigger) - Fires for a Waiter ID when a background wait ends; tags matched, result (MATCHED/TIMEOUT), value, waited_seconds
  • Control waiter gate (action) - Enable/disable/stop a waiter by ID (also background waits; stopping never fires the trigger)
  • Wait (action) - Simple delay up to 55 seconds (use Homey's built-in Flow delay for longer pauses)

Homey's 60-second Flow card limit: Homey stops every app Flow card after 60 seconds. The Wait untilโ€ฆ condition therefore ends with an error after 55 seconds if the value has not arrived, even with a longer or no timeout. For longer waits, use Start waiting until device capability becomes value with a fixed Waiter ID plus the Capability wait finished trigger for that ID. Starting again with the same Waiter ID restarts the wait. Pending waits are in memory and are lost when the app restarts.

Long wait example:

WHEN: Kettle turned on
THEN: Start waiting until Kettle onoff becomes false (timeout: 10 minutes, id: kettle_boil)

WHEN: Capability wait finished "kettle_boil"
AND:  the "Value matched" tag is Yes   (Homey Logic card; No = timeout)
THEN: Send notification "Water is ready"

๐Ÿ“š Read Waiter Gates guide โ†’


Evaluate Expression

Range checking and value mapping with AND/OR logic.

  • Check if a value is within a range (e.g., temperature between 18-22ยฐC)
  • Use AND/OR logic for complex conditions
  • Returns output value and error message tokens

Example: Check if temperature is comfortable (18-24ยฐC):

  • Input: temperature token
  • Rules: 18,24 (min, max)
  • Operators: โ‰ฅ AND โ‰ค

๐Ÿ“š Read Flow Cards reference โ†’


๐Ÿš€ Quick Start

1. Add a Device

Logic Device (recommended for beginners):

  • Go to Devices โ†’ Add Device โ†’ Smart (Components) Toolkit โ†’ Logic Device
  • Follow the pairing wizard to select inputs
  • Configure formula in device settings

Other devices:

  • Logic Unit, State Device, State Capture Device - same process, different wizards

2. Write Formulas (Logic devices)

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

Operators: AND, OR, XOR, NOT (plus &, |, ^, !)

3. Use in Flows

WHEN: Formula [motion_detected] changed to TRUE
THEN: Turn on lights

๐Ÿ“š Read complete setup guide โ†’


๐ŸŽฎ Flow Cards

Triggers (WHEN)

  • Formula result changed to TRUE/FALSE
  • Formula timed out
  • State changed (Logic Device only)
  • State was captured/applied (State Capture Device)
  • Conditional Gate wait finished (Conditional Gates)
  • Capability wait finished (Waiter Gates)

Conditions (AND)

  • Formula result is...
  • Formula has timed out
  • Gate is GO / NO GO (Conditional Gates)
  • Conditional Gate: Wait for GO (Conditional Gates, max 55 seconds)
  • Captured state exists (State Capture Device)
  • Stack is empty / Stack depth is... (State Capture Device)
  • Wait until device capability becomes value (Waiter Gates, max 55 seconds)

Actions (THEN)

  • Set input value for formula
  • Evaluate formula / Re-evaluate all
  • Evaluate expression (Range checking)
  • Apply state (State Device)
  • Capture/Apply/Delete state, Push/Pop/Peek/Clear stack (State Capture Device)
  • Modify Conditional Gate (Conditional Gates)
  • Start waiting for Conditional Gate GO (Conditional Gates, background wait)
  • Start waiting until device capability becomes value (Waiter Gates, background wait)
  • Control waiter gate (Waiter Gates)
  • Wait (Simple delay, max 55 seconds)

๐Ÿ“š See all flow cards โ†’


๐Ÿ’ก Key Features

Dynamic Input Expansion

Start with 2 inputs, grow to 10 automatically:

{"expression": "A AND B AND C AND D"}
// Device auto-expands to 4 inputs!

First Impression Mode

Lock inputs at first value for sequence-based logic:

{"firstImpression": true, "timeout": 30}

Multiple Independent Formulas (Logic Unit only)

Each formula maintains its own input states:

[
  {"id": "day_mode", "expression": "A AND B"},
  {"id": "night_mode", "expression": "A OR B"}
]

JSON Auto-Formatting

Paste ugly JSON, get beautiful formatting on save. Works in all settings fields.


๐Ÿ“š Documentation


๐Ÿค Support & Community

Support Development

If this app makes your life easier, consider buying me a coffee โ˜•

PayPal


๐Ÿ“„ License & Credits

Created by Lars Kvanum (@Tiwas)

This app is provided as-is. Use at your own risk.


Smart (Components) Toolkit - Smarter automations with advanced logic and state management ๐Ÿš€

About

Attempting to create boolean logic ports for Homey

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages