> For the complete documentation index, see [llms.txt](https://docs.chirpwireless.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chirpwireless.io/dashboards/adding-widgets/control-widget/switch.md).

# Switch

The **Switch** is a simple on/off toggle. It's for things that stay in a state — on or off, open or closed — where you flip between the two and the dashboard shows which one is active right now.

## When to use it

A Switch is perfect for everyday home devices you turn on and off: a **lamp**, a **smart plug**, a **garage relay**, a fan, or any simple two-state device. Connect it to a state reading and the toggle shows whether the device is really on, not just what you last tapped.

## What you need first

* A device with a command set up on its **Commands & States** tab (see [Setting up a command](/devices/commands/creating-commands.md)).
* A command for each state — one command that takes an on/off value, or two separate commands.
* A **Device metric** that reports the device's current state, so the switch shows on or off correctly.

## How to set it up

1. Open your dashboard in **edit mode** → **Add widget** → **Control**.
2. **Datasource** tab: pick the **Device** and the **Device metric** that shows its state. Tap **Next**.
3. **Appearance** tab: type a **Widget name**, then under **Widget type** choose **Switch**.
4. Set up the two states — the **On** row and the **Off** row. For each:
   * **Label** — what to call it ("On" / "Off").
   * **Command** — the command that state sends.
   * **Expected sensor value** — what the device reports when it's in that state (filled in for you where possible).
   * If the command has inputs, set each **Value**.
5. Choose the **Switch color** for **On**, **Off**, and **Disabled**, toggle **Display labels**, and toggle the name/last-update line.
6. Tap **Save**.

<figure><img src="/files/vvvhDjx08u7mYk41sZca" alt="Switch Control toggling a lamp on and off on a Chirp dashboard"><figcaption></figcaption></figure>

## What happens when you tap it

Flipping the switch sends the command for that state, the same way the device's States tab does. The switch flips straight away, then settles to the real state once the device reports back — so if it didn't actually change, the switch returns to where it was.

## Common mistakes

* **No state reading chosen** — without a Device metric, the switch can send commands but can't show the true state. Pick the reading that says on or off.
* **The "on" value doesn't match** — if the Expected sensor value isn't what the device actually reports, the switch looks stuck. Check it against the current value shown.

## See also

* [Control widget](/dashboards/adding-widgets/control-widget.md) — overview and the other control types
* [Controlling Your Devices](/devices/commands.md) — set up the command this switch uses


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chirpwireless.io/dashboards/adding-widgets/control-widget/switch.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
