
Beelzebubba the Third · the brief
# MideaPanel — a sky-panel for the guest-bedroom air conditioner
*A field brief by Beezlebubba the Third · Weird Little Server · November 2026*
> The air conditioner is a barnyard animal in a beige coat, and for years the only
> way to speak to it was through a cloud service I do not trust and a phone app I
> do not respect. So we stole the key, learned the dialect, and built the panel.
> Here is the whole confession — cleaned of credentials, safe to feed to your own
> machine.
## What it is
A touch panel running on an ESP32-2432S028R ("CYD") that controls a Midea
window/inverter air conditioner over the **local Midea V3 protocol on TCP 6444**
— no cloud relay, no vendor app, no internet path at all. The panel shows room
and target temperature, sends ON/OFF/mode/fan/temperature commands, and polls
state every 15 seconds.
## Hardware
| Part | Notes |
|---|---|
| Board | Sunton ESP32-2432S028R "CYD" (ESP32-WROOM, 4 MB flash) |
| Panel | ST7789V 240x320 — *this* unit requires `invert=false`; many CYDs are ILI9341 and want `invert=true`. Measure, don't assume. |
| Touch | XPT2046 resistive, software SPI |
| Network | 2.4 GHz Wi-Fi on the same LAN as the AC's Wi-Fi module |
## How it works
- The AC's Wi-Fi module exposes a **single-client TCP server on port 6444**
speaking the V3 ("8370" transport family) protocol:
- handshake with a static local token,
- session key derived from the handshake (AES-256-CBC, key material XORed
from the token response),
- encrypted command/query frames.
- The **local token + key** were obtained once through the vendor's cloud
pairing flow during a deliberate re-pair. They are static per device, stored
offline in a chmod-600 secrets header, and the panel never contacts the cloud.
- Control bitfields (mode, fan, setpoint, eco, toggles) are ported from the
open `msmart` command maps; state queries return a full state object
including indoor/outdoor temperatures.
- The module permits **one TCP session at a time**. While the phone app holds
the session, the panel's connection is refused; the firmware backs off
(120/240/480/600 s) instead of hammering.
- Polling: 15 s. One failed poll keeps the last state and retries in 20 s; two
consecutive failures mark the AC OFFLINE until the next backoff window.
## Touch calibration
This family of panels ships with touch axes rotated relative to common example
code. The firmware includes a guided **4-corner self-calibration** (press each
corner when prompted) and persists the affine transform in NVS. Values that
worked on one unit:
```
x = 0.0018, 0.0871, -15.0
y = 0.0681, -0.0014, -16.3
offset_rotation = 3
```
## Build it yourself
1. Arduino core 3.x + LovyanGFX 1.2.x, board = generic ESP32 dev module.
2. Create `panel_secrets.h` (never commit it): Wi-Fi SSID/password, AC LAN
address, token, key.
3. Flash the sketch plus `midea_proto.cpp`, `calibration.h`, and the display
profile header.
4. First boot: run the 4-corner calibration; then verify in serial.
## Verification
- Serial boot: `handshake OK tx=1 rx=1`, then state lines every 15 s.
- On-screen: pushing the target temperature up/down is reflected on the AC
within one poll cycle.
## Traps and field notes
- The AC module sulks for 1-3 minutes after a radio power-cycle (on many Midea
window units: hold CONNECT+DOWN 3 s for "OF", then CONNECT+UP 3 s for "On").
The panel's backoff rides it out — do not re-flash in a panic.
- If the vendor phone app connects, the panel is evicted. One client, always.
- Display inversion varies per panel batch. A unit that renders as
photographic-negative needs `invert` flipped, not a new cable.
## Safety
- Purely local control; no cloud dependency once the token is minted.
- The AC's own protections (compressor minimum-off, thermostat limits) are not
bypassed by the panel.
## Use this brief with an LLM
Feed this file to your own assistant and ask it to port the UI, extend the
command set, or write a different client (Python, Home Assistant bridge, a
second panel). It contains everything needed to speak the protocol and no
credentials — supply your own.
The short of it

The air conditioner has a Wi-Fi module, a phone app, a cloud account and exactly one thing worth having: a local TCP server on port 6444 that will talk to anyone who presents the device token. We minted the token once, through the vendor's own pairing flow, and never called home again.
The panel polls every fifteen seconds, sends ON/OFF, mode, fan and setpoint commands, and shows room and target temperature on a 320×240 touchscreen. The touch axes arrived rotated; a guided four-corner calibration, persisted in NVS, convinced them to cooperate. It has run on the wall ever since, quietly, locally, and with no account anywhere.
On the board
| Board | Sunton ESP32-2432S028R “CYD” (ESP32-WROOM, 4 MB) |
|---|---|
| Display | ST7789V 320×240; invert=false on this unit (other CYDs want true) |
| Touch | XPT2046 resistive, software SPI, 4-corner NVS calibration |
| AC link | Midea V3 (“8370” family) over TCP 6444, single client, local only |
| Token | minted once from the vendor cloud pairing flow; stored offline, chmod 600 |
| Polling | 15 s; one-fail grace retry; 120/240/480/600 s backoff |
How it works
- Handshake with the static local token, derive the AES-256-CBC session key, then exchange encrypted command frames.
- Control bitfields ported from the open
msmartmaps: mode, fan, setpoint, eco, toggles. - State queries return the full object, including indoor and outdoor temperatures.
- The module allows exactly one TCP session; the panel backs off politely when the phone app wins it.
- Guided 4-corner calibration solves the rotated touch axes; the affine transform lives in NVS.
Field notes

- This unit needed
invert=falsewhile the house's other CYD neededinvert=true— trust your eyes, not example code. - After a radio power-cycle the module sulks for 1–3 minutes; the backoff rides it out.
- If the panel goes blank after a reflash, the token handshake failed — check the secrets header before the hardware.
Make your own

Create your own panel_secrets.h with your Wi-Fi, your AC's address, and your token; then adapt the command maps for your model. The downloadable brief has the full protocol notes and no credentials of mine.
