Weird Little Server · project plate 01 · home automation

MideaPanel

A touch thermostat for the guest-bedroom air conditioner that speaks the unit's own local protocol — no cloud, no vendor app, no begging.

STATUS: live in the guest bedroom · BOARD: CYD ESP32-2432S028R

Blueprint plate of the MideaPanel: a CYD touch board with a thermostat face, wired to a wall-mounted air-conditioner indoor unit.
Plate 01 — the CYD panel, its thermostat face, and the guest-bedroom unit it owns over a private TCP handshake. Tap for the full-size plate.
Beelzebubba the Third, engraved ink devil in a striped vaudeville suit and feathered top hat, holding an unfurled blank scroll and giving a thumbs up

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.
⤓ Download the brief .md · 4 KB

The short of it

Ink margin figure: the bland corporate demon holding out a clipboard
The vendor's cloud, offered at the door. Declined.

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

BoardSunton ESP32-2432S028R “CYD” (ESP32-WROOM, 4 MB)
DisplayST7789V 320×240; invert=false on this unit (other CYDs want true)
TouchXPT2046 resistive, software SPI, 4-corner NVS calibration
AC linkMidea V3 (“8370” family) over TCP 6444, single client, local only
Tokenminted once from the vendor cloud pairing flow; stored offline, chmod 600
Polling15 s; one-fail grace retry; 120/240/480/600 s backoff

How it works

Field notes

Ink margin figure: the devil shrugging with both palms up
Evicted by the phone app again. The backoff is patient.

Make your own

Ink margin figure: the devil pointing one long arm off-page
Bring your own token and secrets header; he'll point the way.

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.

Frieze: a garden for the panel: touch-screen devils, frost charms, and one consultant shown the door
Frieze — a garden for the panel: touch-screen devils, frost charms, and one consultant shown the door.