Repository navigation
Error Handling
Niklas Linz edited this page Oct 3, 2026
·
1 revision
All network methods throw IOException. The library's own exceptions extend it, so you can catch only what you care about.
| Exception | Meaning | What to do |
|---|---|---|
MideaException.Authentication |
V3 handshake rejected | Token or key is wrong, or the unit was paired again and has new ones. Fetch them again, see Finding your unit and token. Retrying won't help. |
MideaException.Timeout |
the unit didn't answer the basic status query | Check the IP and that the unit is online. Maybe raise responseTimeout. |
MideaException.Protocol |
a packet couldn't be decoded or had a bad signature | Handled internally with a reconnect. If it keeps happening, look at the --debug output. |
MideaCloudException |
the cloud refused a request |
code() has the error number. Check credentials and which app the unit is paired with. |
other IOException
|
network problem, connection dropped | The client already reconnected and retried once before throwing. |
try {
ac.setTargetTemperature(23);
} catch (MideaException.Authentication e) {
// credentials are no longer valid
} catch (IOException e) {
// unit currently unreachable
}These fail right away, without any network traffic:
| Exception | When |
|---|---|
IllegalArgumentException |
set point outside 16 to 31.5, fan speed outside 1 to 102, missing or invalid DeviceConfig values |
IllegalStateException |
switching on while the mode is unknown; call refresh() first or set a mode |
UnsupportedOperationException |
setFreshAir() on a unit without a fresh air module |
If a command goes out but the unit doesn't confirm it in time, nothing is thrown. The client keeps the requested state, and the next refresh() shows what the unit really did. See How it behaves.
Next: Command line tool
midea-ac · MIT License · Protocol based on midea-local · Not affiliated with Midea