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, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, 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
22.6k 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

Motor control

  • Widget
  • 8 installs
  • v1.0.0
  • Oct 30, 2026
  • MIT license
  • v4.2+

Start and stop a pump, fan, compressor or conveyor from the dashboard and see whether it runs. Each command goes out the way your device expects: write an attribute and read it back, or send a one-way RPC and read the state from telemetry or a read method. The power button shows Starting… until the device answers and locks while the device is offline. Add an Auto / Manual switch, sent its own way, or a running-hours counter only when you need them.

Widget Type
  • Control
Category
  • Controls

Who it’s for

The Motor control widget is for operators and technicians who start and stop pumps, fans, compressors or conveyors from a ThingsBoard dashboard and need to see at once whether the machine actually runs. They want one obvious button, the real state next to it, and no chance of sending a command to a machine that is offline or under PLC control. The question they would type is “how do I start and stop a pump from my dashboard?”

What it does

Pump 01 is stopped. An operator clicks the white power button, the widget writes running = true to the pump’s shared attributes and shows Starting… until the pump reports that it runs. The button turns green, its label changes to Stop, and the badge in the corner reads Running.

  • Starts and stops with one click, and shows Starting… or Stopping… until the device confirms the change.
  • Shows the state in the corner: Running, Stopped, No data while nothing has been read yet, or Offline.
  • Sends each command the way your device expects: start / stop as an attribute or an RPC, and the mode the same way or the other one.
  • Reads the state back from the attribute it writes, from a telemetry key, or from an RPC read method.
  • Locks every command while the device is offline, and locks start and stop while the mode is Auto.
  • Scales to any card size: a tall card puts the label under the button, a wide one puts it beside it, and a very wide one adds the mode switch to the same row.
  • Is a start / stop control, not a speed or setpoint control: it sends only true or false, and auto or manual.

How to set up

Data keys

The Motor control widget has no data keys. Like other control widgets, it works on the Target device picked in the widget’s data settings, and the keys it writes and reads are named in the settings below.

  • The state — Attribute or Timeseries, read. true, 1, on and running read as running; any other value reads as stopped. Until a value arrives the badge says No data and the button offers Start.
  • active — the server attribute ThingsBoard keeps for every device, read. When it is false the badge says Offline; without it the widget treats the device as online.
  • The mode — Attribute or Timeseries, read and written when Show Auto / Manual is on. auto locks the button; any other value leaves it free.
  • The run hours — Timeseries or Attribute, read when Run hours key is set. Without it the counter is hidden.

Start / stop

  • Send start / stop as — Write an attribute by default. Send a one-way RPC command reaches the device directly; an attribute is picked up the next time the device looks and survives a reboot.
  • Start / stop attribute — running by default. Written as true or false and read back as the state, so the widget works on any device without extra setup.
  • Start / stop scope — Shared - the device reads it by default; Server - only the platform sees it keeps the value inside ThingsBoard.
  • Start / stop RPC method — setState by default. Receives true to start and false to stop.
  • Read the state from — empty by default. The telemetry or attribute key the device reports its state in. When it is empty, the widget uses RPC method that reads the state, or else the last command it sent.
  • RPC method that reads the state — empty by default. Called once when the card loads, as a two-way command.
  • Lock when offline — on by default. Disables every command while active is false.

Auto / Manual

  • Show Auto / Manual — off by default. Adds the mode switch under the button.
  • Send the mode as — Write an attribute by default, chosen separately from start / stop. Starting by RPC and switching the mode through an attribute is a normal setup.
  • Mode attribute — mode by default. Written as auto or manual and read back as the mode.
  • Mode scope — Shared - the device reads it by default.
  • Mode RPC method — setMode by default. Receives auto or manual.
  • Read the mode from — empty by default. The key the device reports its mode in; empty shows the last mode sent.

RPC commands

These settings appear once any command goes by RPC, and apply to all of them.

  • What the device receives — An object - { “value”: true } by default, or The value alone - true.
  • Parameter name — value by default. Also the field the read method is expected to answer with.
  • Request timeout (ms) — 5000 by default.
  • Queue the command for an offline device — off by default. The platform holds the command until the device connects.

How to customize

  • To show running hours — set Run hours key, for example runHours. The counter sits under the button, or beside it on a wide card.
  • To keep the sizes fixed — turn off Scale to fit the card, on by default. A low card then moves the label beside the button so nothing overlaps.
  • To rename the card — change the widget title; the badge and the button label stay as they are.

Tips

  • Leave Read the state from empty while you wire a device up. The widget then reads back its own command, so the button already works, and you can point it at the real telemetry key later.
  • Use Server - only the platform sees it when a rule chain, not the device, acts on the command. The value never reaches the device, and the rule chain can react to the attribute update.
  • Turn on Queue the command for an offline device for devices that sleep, such as battery-powered pump controllers that wake every few minutes.

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.