Repository navigation
Installation
- Java 21 or newer (use the version your
simplyConfigurationbuild targets, if that is newer) - Maven 3.x to build
- A running MQTT broker, e.g. Mosquitto
- A machine on the same network as the air conditioners
git clone https://github.com/LinzN/midea2mqtt.git
cd midea2mqtt
mvn clean packageThe dependencies (midea-ac, simplyConfiguration) come from the MirraNET repository, which is already declared in the pom.xml. Paho and org.json come from Maven Central.
The build produces:
target/
├── midea2mqtt.jar # the bridge
└── lib/ # all libraries it needs
The jar finds the libraries through its manifest, in the lib folder next to the jar. When you move the bridge to another place, copy midea2mqtt.jar and the whole lib folder together.
java -jar midea2mqtt.jarThe bridge reads config.yml from the working directory and creates it with defaults if it doesn't exist. Use another file with --config:
java -jar midea2mqtt.jar --config /etc/midea2mqtt/config.ymlBefore the first real start, put your units into the config: see Finding your units.
| Command | |
|---|---|
java -jar midea2mqtt.jar [--config FILE] |
run the bridge |
java -jar midea2mqtt.jar discover-config [--ip IP] [--timeout N] [--config FILE] |
find units and write them into the config |
java -jar midea2mqtt.jar discover |
list units on the LAN, config stays untouched |
java -jar midea2mqtt.jar keys --ip IP [...] |
fetch token and key of a V3 unit |
java -jar midea2mqtt.jar status / set / watch ... |
talk to a unit directly, without MQTT |
Everything except the first two is the midea-ac command line tool, which you can use through the same jar.
Example layout: jar and lib in /opt/midea2mqtt, config in the same folder.
# /etc/systemd/system/midea2mqtt.service
[Unit]
Description=midea2mqtt bridge
After=network-online.target
Wants=network-online.target
[Service]
User=midea2mqtt
WorkingDirectory=/opt/midea2mqtt
ExecStart=/usr/bin/java -jar /opt/midea2mqtt/midea2mqtt.jar --config /opt/midea2mqtt/config.yml
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now midea2mqtt
journalctl -u midea2mqtt -fThe bridge shuts down cleanly on systemctl stop: it marks all devices and itself offline on MQTT and disconnects from the units. If the broker isn't reachable at startup, it keeps retrying every 10 seconds, so the start order of broker and bridge doesn't matter.
midea2mqtt · LGPLv3 · Built on midea-ac · Not affiliated with Midea
Getting started
Using the bridge
More