---
title: Commands
project: IoT Platform
version: 1.0
section: development
language: en
translation: missing
license: Total.js Enterprise
url: https://totaljs.es/docs/de/iot/1-0/development/commands/
updated: 2026-11-20T06:56:13.114Z
---

# Commands

> Let people send commands to a device from its detail and handle them in the driver.

A command is an input of the driver with a small form. People send it with **Commands** in the device detail, and the driver receives it in `instance.message`.

## Define a command

Add an input with an `html` property. The HTML is the form of the command, and each field writes to one key of the payload:

```js
exports.inputs = [
	{ id: 'input', name: 'Input' },
	{ id: 'interval', name: 'Change interval', html: '<ui-component name="input" path="?.minutes" config="type:number;required:1">Minutes between readings</ui-component>' }
];
```

Inputs without `html` are not commands. The **Commands** button is available only when the driver has at least one command.

## Handle a command

`$.input` is the id of the input, and `$.data` is the payload of the form:

```js
instance.message = function($) {

	if ($.input === 'interval') {
		instance.debug('Interval changed to', $.data.minutes, 'minutes');
		// Send the new interval to the device here
		$.destroy();
		return;
	}

	// ... readings
	$.destroy();
};
```

The stream checks for new commands every five seconds and delivers each command once. How the command reaches the device, for example through an API of the device, is up to the driver.
