Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read and how they find the site, so we can improve it (Google Analytics).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Command button

  • Widget
  • v1.0.0
  • Sep 1, 2026
  • MIT license
  • v4.2+ | Built-in

Allows single-click commands to devices or updates to attributes/time series. Settings enable definition of the on-click action and condition when the button is disabled. Supports multiple layouts and custom styles for different states.

Widget Type
  • Control
Category
  • Controls

Who it’s for

Anyone who needs a dashboard to do one thing on demand — reboot a gateway, trigger a calibration, acknowledge a state, write a setting. The action is momentary and has no on and off: the operator presses once and something happens on the device.

What it does

The Command button sends a single configured action when clicked. That action can call an RPC method on the device, set an attribute, or write a time series value, so the same button reboots a controller or records a manual reading depending only on how it is configured.

  • One click, one action — no state to keep in sync, which is what makes this the right control for anything momentary.
  • Three kinds of action: an RPC method, an attribute write, or a time series write, chosen per button.
  • The value sent can be a constant or computed by a function, so a button can stamp the current time or derive a payload rather than always sending the same thing.
  • A separate disabled condition greys the button out from an attribute, a telemetry key, an RPC result or an alarm status, so an unsafe command can be blocked while a condition holds.
  • Persistent RPC is supported with a polling interval, for devices that acknowledge asynchronously.
  • The Command button reflects nothing back: it shows no device state, so a control that must also indicate whether the thing is on belongs on a switch or a status tile.

How to set up

Data keys

The Command button takes no data keys — what it sends comes from its configured action.

AttributeScopeOperationDescription
Configured keyShared / ServerWriteWith On click set to Set attribute, the button writes this key in the chosen scope. Add time series writes a telemetry key instead.
MethodDirectionParametersSent when
Configured methodOne-way or two-way, as configuredConstant or returned by a convert functionWith On click set to Execute RPC, on every click

Behavior

SettingDefaultEffect
On clickUnsetThe action performed — Execute RPC, Set attribute or Add time series
ValueConstantWhat is sent; a Convert value function can compute it instead
Disabled stateUnsetAn action deciding when the button is greyed out
RPC request timeoutPlatform defaultHow long a two-way call waits
RPC request persistentOffFor devices acknowledging asynchronously, with a polling interval

Configure the disabled state for anything that should not be pressed twice or pressed in the wrong condition. A button with no disabled rule is always pressable, and the device is the only thing standing between an operator and a repeated command.

How to customize

  • To choose what the click does — set On click to Execute RPC, Set attribute or Add time series, then fill in the method or key.
  • To send something computed — supply a Convert value function instead of a constant, which is how a button stamps a timestamp or builds a payload.
  • To block the command under a condition — configure the Disabled state action against an attribute, a key, an RPC result or an alarm status.
  • To support a slow device — turn on RPC request persistent and set the polling interval.
  • To fail faster on an unreachable device — lower the RPC request timeout.
  • To label the action — set the button’s appearance text to the verb the operator would use.

Tips

  • Label the button with what happens, not with the mechanism. Reboot gateway tells an operator what they are about to do; Send RPC tells them only that something will be sent.
  • Put a status tile or an LED beside any button whose command has a visible effect. A momentary button gives no feedback by design, and without an indicator an operator has no way to distinguish a command that worked from one that timed out.

Share Your Widget with the Community

Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.