Skip to content

xiaomi: fix wake method for midr doorbells - #2373

Open
kugaevsky wants to merge 1 commit into
AlexxIT:masterfrom
kugaevsky:xiaomi-wake-method
Open

xiaomi: fix wake method for midr doorbells#2373
kugaevsky wants to merge 1 commit into
AlexxIT:masterfrom
kugaevsky:xiaomi-wake-method

Conversation

@kugaevsky

Copy link
Copy Markdown

xiaomi: fix wake method for midr doorbells

Problem

Battery doorbells are woken with a cloud RPC before connecting. The current
call uses method: "wakeup" for every .cateye. model:

const params = `{"id":1,"method":"wakeup","params":{"video":"1"}}`

On midr.cateye.sd400 (Xiaomi Smart Doorbell 4 Pro) this method times out
the device never acks it, so the wake is a no-op and the following P2P connect
fails until the device happens to be awake.

Evidence

Same account/did, back to back against home/rpc/{did}:

method params cloud response
wakeup {"video":"1"} code: -3, message: timeout
wakeup_host {} code: 0, message: ok, result: ["ok"]

Fix

Select the wake method per model. midr.* doorbells use wakeup_host with
empty params; other .cateye. models keep the previous wakeup call (no
regression for e.g. loock.cateye.v02).

func wakeParams(model string) (method, params string, ok bool) {
	switch {
	case strings.HasPrefix(model, "midr."):
		return "wakeup_host", "{}", true
	case strings.Contains(model, ".cateye."):
		return "wakeup", `{"video":"1"}`, true
	}
	return "", "", false
}

Testing

Verified on real hardware (midr.cateye.sd400): the old call times out, the new
call returns ok and the device wakes. Other models are unchanged.

Only midr.* is claimed as verified; the switch is easy to extend as other
families are confirmed.

The generic "wakeup" RPC times out on midr.cateye.sd400 (Xiaomi Smart
Doorbell 4 Pro) — the device never acks it. These models wake with the
"wakeup_host" method and empty params instead. Other cateye doorbells
keep the previous "wakeup" call to avoid regressions.
@kugaevsky
kugaevsky force-pushed the xiaomi-wake-method branch from 2c3ba96 to 9f1bb48 Compare July 21, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant