Button

Button

Sends a command to your device when pressed. Use it for one-shot actions — reboot, open, run a calibration — as opposed to a Switch, which represents an on/off state.

Live preview · sample data

Settings

FieldWhat it does
Command or URLThe text sent to your device when pressed. Can also be a URL to open instead
Button textThe label on the button
IconAn optional icon, chosen from a picker
Icon LocationStart, End, Top or Bottom, relative to the text
StyleContained (filled), Outlined, or Text (no border)
Wait for statusShow a spinner until the device reports back
ColorThe button colour
Admin onlyHide it from everyone who isn’t an admin of the device — see Sharing a device

Handling the command

The value in Command or URL arrives in your firmware’s receivedCommand callback:

.receivedCommand = [](JsonDoc doc) {
    String cmd = doc["data"];
    if (cmd == "reboot") {
        ESP.restart();
    }
},

The text must match what you typed in the button exactly — it’s compared as-is.

Wait for status

With this on, the button shows it’s working until the device reports its status again, so you get feedback rather than wondering whether the press registered. It suits actions that take a moment.

If your firmware never reports back after handling the command, the button will appear stuck — either leave the setting off, or report status at the end of the action:

sc.sendStatusWithSocket();