Repository navigation
Controlling the Unit
Power, mode, set point, fan, swing and all the flags travel in a single command that always carries the complete state. There's no way to change just one of them on the wire.
So control() starts from the last known state, you change what you need, and send() sends everything at once:
ac.refresh(); // once, so the client knows the current state
AcState s = ac.control()
.mode(OperatingMode.COOL) // also switches the unit on
.targetTemperature(25)
.fanSpeed(FanSpeed.AUTO)
.swing(SwingMode.VERTICAL)
.preset(Preset.ECO)
.send(); // returns the state the unit confirmedCall
refresh()at least once before the first command. Otherwise the client doesn't know the current mode, and switching on without a mode throwsIllegalStateException.
| Method | Effect |
|---|---|
on(), off(), power(boolean)
|
power |
mode(OperatingMode) |
sets the mode and switches the unit on. Also clears the dry flag. Coming out of DRY, the fan goes back to auto unless you set it. |
targetTemperature(double) |
16 to 31.5 C, rounded to 0.5. Outside that range: IllegalArgumentException. |
fanSpeed(FanSpeed) |
SILENT, LOW, MEDIUM, HIGH, FULL, AUTO |
fanSpeedRaw(int) |
1 to 100 for units with a stepless fan, 102 for auto |
swing(SwingMode) |
OFF, VERTICAL, HORIZONTAL, BOTH |
preset(Preset) |
COMFORT, ECO, BOOST, SLEEP, AWAY (frost protection), NONE. Selecting one switches the others off. |
powerSaving(boolean) |
exclusive with the presets |
auxHeating(boolean) |
electric auxiliary heater |
dry(boolean) |
dries the evaporator after switching off, against mould |
smartEye(boolean) |
presence sensor |
naturalWind(boolean) |
natural wind |
anion(boolean) |
ioniser |
fahrenheitDisplay(boolean) |
the unit's display shows Fahrenheit; the API stays in Celsius |
send() |
sends and returns the confirmed state |
An AcControl is meant for one command. Get a new one from control() for the next.
For a single change:
ac.turnOn();
ac.turnOff();
ac.setMode(OperatingMode.HEAT);
ac.setTargetTemperature(21.5);
ac.setFanSpeed(FanSpeed.LOW);
ac.setSwingMode(SwingMode.OFF);
ac.setPreset(Preset.SLEEP);Each one is a control()...send() internally. If you change several things, use one control() call anyway: one command, one beep, no intermediate states.
The unit confirms every basic command with its new state, which send() returns. If no confirmation arrives within the response timeout, send() doesn't fail; it returns the requested state instead. See How it behaves.
Heat to 21 degrees in sleep mode:
ac.control().mode(OperatingMode.HEAT).targetTemperature(21).preset(Preset.SLEEP).send();Switch off and dry the evaporator:
ac.control().dry(true).off().send();Only change the fan, keep everything else:
ac.setFanSpeed(FanSpeed.HIGH);Next: Extra features
midea-ac · MIT License · Protocol based on midea-local · Not affiliated with Midea