Skip to content

Mijia ​

Main menu key: m

Local miIO (LAN) and BLE Mijia device control: detail, list, grid, groups, and device hotkeys.

Screenshots ​

Detail

mijia-detail

Device info (i)

mijia-info

HT working / Quick panel

mijia-th-workmijia-quick

Lights (brightness / CT / hue)

mijia-masterroom-onmijia-masterroom-offmijia-outsidemijia-desklamp

Fan / air fryer / plug

mijia-fanmijia-fryermijia-fryer-cookingmijia-ble-switch

Shortcuts ​

Common ​

KeyAction
ESC / GOBack to main menu
hOpen / close Help
oOn
fOff
iDevice info
t / BtnGOToggle
rRefresh status (BLE scan for sensors)
qQuick-select keymap (keyboard occupancy)
Fn + qEdit hotkey for current device
lList view
gGrid view
dGroup view
; , / ↑← · . / / ↓→Switch device / page (depends on view)
[ ]Page grid

List ​

KeyAction
Arrows / ;,. /Page
lBack to detail (or keep list nav; follow tip)
gSwitch to grid

Bottom tip example: page pN/M · arrow page · l · g

Grid ​

KeyAction
Arrow keysMove selection
[ ]Page
1–9Select cell directly
o / f / t / BtnGOOn / off / toggle

Group ​

KeyAction
, .Switch group
o / f / tGroup on / off / toggle
- = / 1 0If all members are lights: brightness / presets
rRefresh
[ ]Page group members

Quick select (q) ​

Shows the real Cardputer keyboard layout with occupied hotkeys highlighted, plus bound device names below (hotkey letter tinted in the name). If any hotkeys are configured, this page opens first when entering Mijia. No tip bar; q goes back.

KeyAction
qBack to detail
Configured a–z / 0–9Jump to device (q reserved for this page)

Hotkey edit (Fn+q) ​

KeyAction
a–z / 0–9Enter hotkey
BtnGOSave; confirm replace on conflict

Detail · by device type ​

KeyAction
- =Brightness − / +
1 / 9 / 0Brightness presets (~1% / 90% / 100%)
[ ]Color temperature (CT-capable models)
j kHue (bslamp2 / color8 / color2)

FAN_P5 (dmaker.fan.p5) ​

KeyAction
- =Speed
wOscillate
mMode
aSwing angle
1 / 9 / 0Level presets

FAN_GENERIC (model contains .fan.) ​

KeyAction
1–4Level

Air purifier F20 (dmaker.airpurifier.f20) ​

KeyAction
1–5Mode
- =Speed

AIR_FRYER ​

KeyAction
- =Temperature
[ ]Time

Temp/humidity / BLE event (SENSOR_HT · BLE_EVENT) ​

KeyAction
rBLE scan refresh

PLUG / other GENERIC ​

On/off and refresh only.

Usage ​

Configure devices ​

In config.json devices[], fill name / name_zh / id / ip / token / model, etc. BLE sensors also need mac and ble.key. You can also manage them in the Config Web UI.

Optional hotkey (a–z / 0–9, q reserved) for one-key jump; colored hotkey letters appear next to names in list / grid.

Groups go in device_groups[], members linked by device id.

View switching ​

  • Detail: full status and type-specific controls for one device
  • List l: dense browsing
  • Grid g: icon grid, good for quick on/off
  • Group d: batch control by room / scene

With no devices, the tip prompts u for setup.

Communication ​

  • Most Wi-Fi devices: LAN miIO (same subnet as Cardputer)
  • Temp/humidity, motion / remote, etc.: BLE scan of advertisements

Update mechanism ​

Like Cursor, Mijia runs miIO query / control on a FreeRTOS background task. The main loop handles keys, BLE polling, and partial redraws; never draw from the task. Grid cell refreshes are queued on the main loop.

Background task ​

ActionBehavior
Enter AppConnect WiFi → pull current device status
Switch device / pageBump gen, invalidate unfinished old work
On / off / brightnessAsync SET, write back to UI when done
Grid / groupQueue in order QUERY or batch SET for page devices
Leave AppCancel work, wait for task exit, turn off WiFi immediately, stop BLE

Single-device query timeout ~2s; late results are dropped and status shows timeout. If a task is already running, new work is staged and chained when it finishes.

Wi-Fi devices (miIO) ​

  • Entering Mijia auto-connects configured WiFi, only while Mijia is foreground; disconnects on leave.
  • Connect time is not counted in device query timeout; QUERY starts after connect.
  • After control ops (on / off / brightness), devices like air fryers get a delayed QUERY to sync lagging state.

BLE devices ​

BLE must not scan inside the background task (can crash). The main loop handles it non-blocking:

ModeTriggerNotes
Background listenAuto on enter Mijia~30s per round, rotates BLE ads into per-device cache
Focused scanDetail rInterrupts background; focuses current device ~30s; then resumes background listen

Detail shows cached reading and Xs ago age; with no cache shows listening; r forces refresh. Grid / list BLE cells use cache only, not the miIO queue.

Partial refresh ​

  • Detail: icon and right control panel redraw separately; prefer dirty regions on status change.
  • Grid: after task write-back, changed cells are queued for main-loop refresh to avoid full-page flicker.
  • Group: bottom on/off / brightness bar can partial refresh; batch ops run member order and summarize success / fail.

Local timer ​

Air fryer detail: remaining time from the device ticks locally every second in the right panel without waiting for the next QUERY.

Supported device types (model) ​

Firmware classifies by model string (see mijiaClassifyModel). The table below is by control capability; unlisted models fall into GENERIC (still on/off; matching icons if any).

TypeMatch rule (examples)Capability summaryIcon
LIGHTyeelink.light.*On/off, brightness; some CT / huesee below
FAN_P5exact dmaker.fan.p5Speed, oscillate, mode, swingfan
FAN_GENERICmodel contains .fan.Levels 1–4fan
AIR_PURIFIER_F20exact dmaker.airpurifier.f20Mode, speed, AQI, etc.airpurifier
AIR_FRYERcontains airfryer or .fryer.Temperature, timefryer
PLUGcontains .plug.On/offplug
SENSOR_HTcontains sensor_ht or .ht.BLE temp/humiditysensor_ht
BLE_EVENTcontains .motion. / .remote.BLE event device(default icon)
GENERICotherBasic on/offdefault

Light model notes ​

model traitExtra capability
yeelink.light.lamp2CT ~2500–4800 K
yeelink.light.lamp1 / lamp4CT ~2700–5000 K
contains .monoFixed CT (not adjustable)
contains bslamp2 / color8 / color2j/k hue

Config examples: yeelink.light.lamp2, miaomiaoce.sensor_ht.t2.

Device icon assets ​

Icons match model substrings (longer names first). Assets from firmware data/icon/device/:

basenameOffOnTypical model fragment
airpurifieroffonairpurifier
bslamp2offonbslamp2
lamp2offonlamp2
lightoffonfallback for models containing light
fanoffonfan
fryeroffonfryer
plugoffonplug
sensor_htoffonsensor_ht
cameraoffoncamera
cookeroffoncooker
juiceroffonjuicer
wifispeakeroffonwifispeaker
defaultoffonunmatched

Grid / list also use *_25w.png small icons; on device, same-name .rgb565 bake files are preferred for faster draw.

Sparks for M5Stack Cardputer