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
| Field | What it does |
|---|---|
| Command or URL | The text sent to your device when pressed. Can also be a URL to open instead |
| Button text | The label on the button |
| Icon | An optional icon, chosen from a picker |
| Icon Location | Start, End, Top or Bottom, relative to the text |
| Style | Contained (filled), Outlined, or Text (no border) |
| Wait for status | Show a spinner until the device reports back |
| Color | The button colour |
| Admin only | Hide 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();