Skip to content

MQTT Topics

Niklas Linz edited this page Oct 3, 2026 · 1 revision

MQTT topics

<base> is mqtt.baseTopic (default midea2mqtt), <device> is the entry name from config.yml.

Published by the bridge

Topic Retained Content
<base>/bridge/status yes online / offline. Also the MQTT last will, so the broker sets it to offline if the bridge dies
<base>/<device>/availability yes¹ online / offline: whether the unit answers
<base>/<device>/state yes¹ full state as JSON, see Reading state
<base>/<device>/state/<key> yes¹ single value as plain text, only with publishAttributes: true
<base>/<device>/capabilities yes¹ supported modes, temperature limits and features, JSON
<base>/<device>/error no why a command failed, JSON

¹ with retain: true (the default)

Subscribed by the bridge

Topic Payload
<base>/<device>/set JSON object with one or more keys, see Sending commands
<base>/<device>/set/<key> a single value as plain text, e.g. set/mode ← cool
<base>/<device>/get anything; refreshes the unit now and publishes state and capabilities

Messages for device names that aren't configured are ignored.

Availability

Two topics together tell you whether a unit can be controlled:

  • bridge/status is offline when the bridge is stopped or has crashed.
  • <device>/availability is offline when the bridge runs but the unit doesn't answer.

After a crash the broker only updates bridge/status (through the last will); <device>/availability keeps its last value. Check both. Home Assistant can do that with two availability topics and availability_mode: all, see Home Assistant.

Retained commands

Publish commands without the retain flag. A retained command would be delivered again on every reconnect and switch the unit back to an old state, so the bridge ignores retained messages on set and get and logs a warning.

If you published one by accident, delete it by publishing an empty retained message to the same topic:

mosquitto_pub -t midea2mqtt/livingroom/set -r -n

The broker passes the empty message on to the bridge once, which answers with a harmless "payload is not a JSON object" on the error topic.

Example session

# watch everything
mosquitto_sub -v -t 'midea2mqtt/#'

# switch off
mosquitto_pub -t midea2mqtt/livingroom/set -m '{"power": false}'

# same, as a single value
mosquitto_pub -t midea2mqtt/livingroom/set/power -m off

# refresh now
mosquitto_pub -t midea2mqtt/livingroom/get -m 1

Clone this wiki locally