Skip to main content
Category: Controls · Sends commands: yes · Reads data: no

Mental model

A Switch is a light switch. It holds a state — on or off — and sends a command each time you flip it. Unlike a Button (a one-shot), a Switch represents a persistent state your device should be in.

When to use it

  • Turn something on and keep it on (a relay, a fan, a mode)
  • Any binary state the user sets and the device holds

Settings

General

  • Widget Title / ID
  • Initial state — ON or OFF at load
  • ON text / OFF text · ON label / OFF label — the state text and labels
  • Show text labels · show icon · icon size

Style

Status color, label color, container shape (pill / rounded / square), plus the common border/font/background controls.

Triggers

A Switch usually needs two triggers — one for on, one for off. Events:

Example — toggle a relay

Triggers:
Firmware (Arduino):

Reflecting real device state

To make the Switch show the device’s actual state (not just what the user tapped), push the state back from firmware to the Switch’s widget ID:

Script API example

The same interactions from a dashboard script:

Triggers in full

Wiring the on/off commands.

Button

For one-shot actions instead of state.