Repository navigation
Finding Your Units
You need three things per unit: its IP address, its device id and its protocol version. V3 units additionally need a token and a key.
java -jar midea2mqtt.jar discover-configSearching for air conditioners on the LAN (5 s)...
Wrote 2 device(s) to config.yml:
ac-153931629647397 192.168.1.50:6444 id=153931629647397 model=00000Q1A V3
ac-151732605161920 192.168.1.51:6444 id=151732605161920 model=00000Q1B V2
V3 units need 'token' and 'key' in config.yml before they work. Get them with:
java -jar midea2mqtt.jar keys --ip <IP> [--cloud msmart --user U --password P]
This broadcasts on every network interface and writes each unit it finds into the devices section of config.yml.
| Option | Default | |
|---|---|---|
--ip IP |
broadcast | ask one address directly; works across VLANs as long as UDP gets through |
--timeout N |
5 |
seconds to wait for answers |
--config FILE |
config.yml |
the file to write |
How existing entries are handled:
- A unit whose id is already in the config overwrites that entry. The device name stays, everything else is reset to defaults, including token and key.
- New units are added as
ac-<id>. You can rename them afterwards; the name is what appears in the MQTT topics. - Entries of units that weren't found are left alone.
- The example device from the first start is removed.
- Units speaking the old V1 protocol are skipped, they aren't supported.
All written units are enabled: true. V2 units work right away. V3 units are skipped by the bridge with a warning until token and key are filled in.
Only want to look? java -jar midea2mqtt.jar discover lists the units without touching the config.
V3 units only accept connections with a token and key handed out by the Midea cloud. Fetch them once:
java -jar midea2mqtt.jar keys --ip 192.168.1.50 --cloud msmart --user you@example.com --password secret--id 153931629647397 --protocol 3 --port 6444
--token 4b2f... (128 hex characters)
--key 9a1c... (64 hex characters)
Use --cloud nethome or --cloud mideaair if your unit is paired with that app. Without --cloud the tool tries the shared account Home Assistant ships with, which often works too. Every candidate is tested against the unit, so what you get is known to work.
Copy the values into the unit's entry:
devices:
ac-153931629647397:
enabled: true
host: 192.168.1.50
port: 6444
id: '153931629647397'
protocol: 3
token: 4b2f...
key: 9a1c...The cloud is never contacted again after this. Token and key stay valid until the unit is reset or paired again in the app; the app keeps working alongside the bridge.
More detail, including the other cloud options: midea-ac wiki: Finding your unit and token.
Careful: running
discover-configagain overwrites known units and empties their token and key. Keep a copy of the values, or edit the config by hand once your setup is complete.
The IP address is part of the configuration. Give every unit a fixed DHCP lease in your router.
midea2mqtt · LGPLv3 · Built on midea-ac · Not affiliated with Midea
Getting started
Using the bridge
More