Skip to content

Commands Everywhere

Tasmota has one command language, and every door into the device speaks it. The same word that toggles a relay from the web console toggles it over the serial cable, over HTTP, and over MQTT. Learn the commands once and you can drive a device from anywhere, script it from anything, and read other people's examples without translation. This chapter's command names are not from memory: the lab read them out of the master command table in the source (kTasmotaCommands in support_command.ino), and counted 114 source files that each register further command tables of their own — every driver and sensor adds its vocabulary to the same system.

The shape of a command

Commands are a name and, usually, a value:

Power ON
Power1 OFF
PulseTime1 120
Status 0
Restart 1

They are not case-sensitive. Replies come back as JSON — {"POWER1":"OFF"} — which is why scripts can consume them without screen-scraping. Commands addressed to a device that has several relays or lights take an index (Power2, Dimmer1); the forms used in the main table include the everyday set below, quoted in source order because the table itself is a fair map of what the firmware thinks matters:

Power, Backlog, Delay, Status, State, Sleep, PowerOnState, PulseTime, SetOption, Module, Template, Gpio, Pwm, IpAddress, OtaUrl, Upgrade, Restart, SerialLog, SaveData — and hundreds more from the drivers: energy calibration, sensor options, display and infrared controls.

Three of these deserve attention right away:

  • Status 0 is the device's full self-report — identity, network, MQTT, settings, state — as one JSON document. Half of all troubleshooting starts here.
  • SetOption (alias SO) is the numbered-flags drawer: dozens of small behaviours are option n, set with SetOption<n> <value>. You will meet them in documentation constantly, always by number, so keep the project's SetOption reference page bookmarked.
  • PowerOnState decides what a relay does when power returns — off, on, restore last state — a small setting that matters enormously after an outage.

Backlog: commands in a queue

Backlog prefixes a list of commands separated by semicolons, executed in order:

Backlog Power1 ON; Delay 600; Power1 OFF

(Delay counts in tenths of a second, so that is a one-minute pulse.) Backlog is how multi-step actions are stored in rules, buttons and templates: one string, no scripting required. Configuration one-liners in the documentation — setting SSID, password, MQTT host and topic in a single paste — are Backlog strings.

The four doors

  • Web console — the page from the last chapter; type, read the JSON reply.
  • HTTP — http://<device>/cm?cmnd=Power%20ON returns the same JSON to any program.
  • Serial — 115200 baud on the bench; the original door, and the one that works with no network at all.
  • MQTT — publish the command (without a value in the topic, with the value as payload) to cmnd/<topic>/Power; the reply lands on stat/<topic>/RESULT. The next chapter is built on this door.