IoT Automation

Tasmota MQTT Commands Cheat Sheet: cmnd, stat and tele Topics Explained

A practical reference to Tasmota's cmnd, stat and tele topics and the commands you will actually use, with ready-to-send examples for any MQTT client or the ConnectMQ web client.

Reference card listing tasmota mqtt commands next to a smart plug and a laptop terminal
Run this on your own MQTT brokerGet a private, managed MQTT broker on the Free plan and start from ready-made code samples.
Try it free Code samples No card required

This Tasmota MQTT commands cheat sheet collects the topics and commands you will use every day to switch, query and tune Tasmota devices from any MQTT client. You will learn how the cmnd, stat and tele prefixes fit together, which payloads each command expects, and how to send them from a terminal, a script or the ConnectMQ web client.

How Tasmota MQTT Topics Are Built

Every Tasmota topic follows the Full Topic template, which defaults to %prefix%/%topic%/. The command name is appended at the end. With a device whose Topic is plug1:

Prefix Direction Example topic Purpose
cmnd You to device cmnd/plug1/POWER Send a command
stat Device to you stat/plug1/RESULT JSON response to a command
stat Device to you stat/plug1/POWER Plain power state after any change
tele Device to you tele/plug1/STATE Periodic state (uptime, Wi-Fi, power)
tele Device to you tele/plug1/SENSOR Periodic sensor and energy readings
tele Device to you tele/plug1/LWT Online / Offline, retained Last Will

Two rules cover most mistakes. First, commands always go to cmnd; publishing to stat does nothing. Second, an empty payload on a command topic queries the current value without changing it.

If your Full Topic adds a prefix, for example home/%prefix%/%topic%/, every topic in this sheet gains that prefix: home/cmnd/plug1/POWER. If you have not set up MQTT on the device yet, start with the Tasmota MQTT setup guide.

Sending Tasmota MQTT Commands

You can send every command in this sheet three ways.

From a terminal with mosquitto clients. On the free public MQTT broker, use a unique prefix in your Full Topic, such as connectmq/demo/k4w9ra/%prefix%/%topic%/:

mosquitto_pub -h broker.connectmq.com -p 1883 -i cli-k4w9ra \
  -t 'connectmq/demo/k4w9ra/cmnd/plug1/POWER' -m 'ON'

From the ConnectMQ web client. In the portal, open the in-browser MQTT client, subscribe to home/stat/plug1/#, then publish to home/cmnd/plug1/POWER with payload TOGGLE. The live topic explorer shows the RESULT reply next to the original state topic.

From code. Any MQTT library works; here is Python with paho-mqtt 2.x:

import paho.mqtt.client as mqtt

PREFIX = "connectmq/demo/k4w9ra"

client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="py-k4w9ra")
client.connect("broker.connectmq.com", 1883, keepalive=30)
client.loop_start()
info = client.publish(f"{PREFIX}/cmnd/plug1/POWER", "TOGGLE", qos=1)
info.wait_for_publish()
client.loop_stop()
client.disconnect()

Power and Relay Commands

Command Payload Effect
POWER ON, OFF, TOGGLE Switch relay 1
POWER empty Query relay 1
POWER2 ... POWER8 same Multi-channel devices, one per relay
POWER0 ON, OFF Switch all relays at once
POWER BLINK, BLINKOFF Start or stop blinking
PowerOnState 0-5 Relay state after power-up: 0 off, 1 on, 2 toggle, 3 last saved (default)
PulseTime1 0-64900 Auto-off timer: 1-111 in 0.1 s steps, above 111 subtract 100 for seconds
PowerRetain 0 / 1 Publish stat/.../POWER as retained

PulseTime is the safe way to build a "run for N minutes" switch. For example, PulseTime1 400 turns the relay off 300 seconds after it turns on, even if the network drops in between.

PowerRetain 1 is useful for dashboards that start after the device, because the last power state is delivered immediately on subscribe. Do not retain command topics; a retained cmnd/.../POWER ON would switch the relay back on after every reconnect.

Telemetry and Status Commands

Command Payload Effect
TelePeriod 10-3600 Seconds between tele/STATE and tele/SENSOR messages (default 300)
TelePeriod empty Query the interval, or force an immediate telemetry message
Status 0 All status information in one response
Status 2 Firmware version and build
Status 5 Network: IP, gateway, MAC
Status 6 MQTT host, port, client and user
Status 8 Current sensor readings
Status 11 Current state, like tele/STATE
SensorRetain 0 / 1 Publish tele/SENSOR as retained

Responses to Status arrive on stat/<topic>/STATUS, STATUS2 and so on, depending on the number. Short TelePeriod values are handy while testing, but a few hundred devices reporting every 10 seconds adds up. Pick the slowest interval that still serves your dashboard.

Light and Dimmer Commands

Command Payload Effect
Dimmer 0-100 Brightness in percent
Color FF8800 or 255,136,0 RGB colour
CT 153-500 Colour temperature in mireds (cold to warm)
HSBColor 30,100,80 Hue, saturation, brightness
Fade 0 / 1 Smooth transitions on or off
Speed 1-40 Fade speed

Configuration Commands

Command Example payload Notes
Topic plug1 Device topic; triggers a restart
FullTopic home/%prefix%/%topic%/ Topic template; triggers a restart
GroupTopic1 kitchen Extra topic the device listens on for commands
MqttHost / MqttPort broker.connectmq.com / 8883 Broker address
MqttUser / MqttPassword YOUR_USERNAME Use 0 to clear
MqttClient YOUR_CLIENT_ID Must be unique per broker
SetOption103 1 TLS on builds that include it
SetOption19 0 / 1 0 for the Tasmota integration in Home Assistant, 1 for legacy MQTT discovery
Timezone 99 or +02:00 99 uses daylight-saving rules

Group topics make bulk control easy: every device with GroupTopic1 kitchen reacts to cmnd/kitchen/POWER OFF. The built-in default group topic is tasmotas. If your devices share a broker with other people, change it to something unique, otherwise a stray cmnd/tasmotas/... could reach your devices.

Encrypted connections have their own requirements, covered in the Tasmota MQTT TLS guide.

Maintenance Commands

Command Payload Effect
Restart 1 Reboot
Upgrade 1 Start an OTA upgrade from OtaUrl
OtaUrl URL Firmware source for upgrades
WebServer 0, 1, 2 Disable, user mode, admin mode
WebPassword text Protect the web UI
Reset 1 Factory reset, use with care

Running Several Commands with Backlog

Backlog runs a list of commands separated by semicolons, which you can also send over MQTT:

mosquitto_pub -h broker.connectmq.com -p 1883 -i cli-k4w9ra \
  -t 'connectmq/demo/k4w9ra/cmnd/plug1/Backlog' \
  -m 'Power ON; Delay 50; Power OFF'

Delay uses 0.1 second units, so Delay 50 waits five seconds. Backlog is the cleanest way to push a whole configuration to a fleet of devices without visiting each web UI.

Rules: Commands Triggered on the Device

Rules let a device react without any server. A classic example publishes a custom message when the relay changes:

Rule1 ON Power1#State DO Publish home/events/plug1 {"power":"%value%"} ENDON
Rule1 1

Publish from a rule sends to any topic you like, which is handy when another system expects a specific format.

Quick Reference Checklist

  1. Send commands to cmnd/<topic>/<Command>; read replies on stat/<topic>/RESULT.
  2. Empty payload means "query", not "turn off".
  3. Watch tele/<topic>/LWT for availability.
  4. Retain state topics if dashboards need it; never retain commands.
  5. Use unique client IDs, topics and group topics on shared brokers.

Run Your Tasmota Devices on ConnectMQ

Testing on the public broker is fine, but a private broker keeps strangers away from your relays. A hosted MQTT broker from ConnectMQ gives every device its own credentials, a live topic explorer for checking replies, and TLS on port 8883 for ESP32 builds. Create a free Serverless broker at app.connectmq.com with no credit card, and see the IoT automation guide for project ideas.

Frequently Asked Questions

What is the difference between cmnd, stat and tele in Tasmota?

cmnd is where you send commands, stat carries replies and state changes, and tele carries periodic telemetry and the Online/Offline availability message.

How do I check a Tasmota device's state without switching it?

Publish an empty payload to the command topic, for example cmnd/plug1/POWER. The device answers on stat/plug1/RESULT.

How do I send several Tasmota commands in one MQTT message?

Publish to cmnd/<topic>/Backlog with commands separated by semicolons, for example Power ON; Delay 50; Power OFF.

Why are my Tasmota commands ignored?

Usually the topic is wrong: commands must use the cmnd prefix and match the device's Full Topic exactly, including any extra prefix and letter case.

Related articles

Zigbee2MQTT Setup Guide: From Coordinator to Dashboard

Install Zigbee2MQTT with Docker, configure the coordinator and MQTT connection, pair and rename devices, control them over MQTT and view their states on a dashboard, testing first on a free public broker.

7 min read

All articles →

Your private MQTT broker is a few clicks away

Create an account, get your broker credentials and connect your first device — no servers to install, patch or scale.