Repository navigation
MQTT Topics
<base> is mqtt.baseTopic (default midea2mqtt), <device> is the entry name from config.yml.
| 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)
| 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.
Two topics together tell you whether a unit can be controlled:
-
bridge/statusisofflinewhen the bridge is stopped or has crashed. -
<device>/availabilityisofflinewhen 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.
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 -nThe 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.
# 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 1midea2mqtt · LGPLv3 · Built on midea-ac · Not affiliated with Midea
Getting started
Using the bridge
More