Skip to content

Fix Xiaomi Smart Doorbell 4 Pro dual-camera events - #2901

Open
wmgylc wants to merge 1 commit into
al-one:masterfrom
wmgylc:agent/fix-sd400-dual-camera
Open

Fix Xiaomi Smart Doorbell 4 Pro dual-camera events#2901
wmgylc wants to merge 1 commit into
al-one:masterfrom
wmgylc:agent/fix-sd400-dual-camera

Conversation

@wmgylc

@wmgylc wmgylc commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • expose both cloud camera channels for midr.cateye.sd400
  • keep channel 10 on the existing downward-facing doorbell camera entity
  • add channel 0 as a separate main-camera entity
  • reuse the integration's existing snapshot and MJPEG proxy behavior

Root cause

The Xiaomi Smart Doorbell 4 Pro returns paired entries in thirdPartPlayUnits: channel 0 is the main camera and channel 10 is the downward-facing camera. The integration previously consumed only the first event, which is why only the downward-facing view was exposed.

Implementation

The event-list helper can now optionally retain the latest event for each channel while preserving its existing return value and default behavior. The model-specific camera path consumes that channel map, keeps channel 10 on the current entity, and creates one BaseSubEntity camera for channel 0.

The change is scoped to midr.cateye.sd400; all other camera models continue using the existing first-event behavior. Event dictionaries are copied before normalization so the cloud response is not mutated.

中文说明

本 PR 修复米家智能可视门铃 4 Pro(midr.cateye.sd400)在 Home Assistant 中只能看到下视摄像头的问题。该设备的云端事件会同时返回两个通道:0 为主摄像头,10 为下视摄像头;修改后会分别显示为两个摄像头实体,并已在真实设备上验证快照及 MJPEG 动态画面。

Validation

  • python -m pytest -q tests/test_camera_channels.py — 1 passed
  • Python compilation check
  • git diff --check
  • Home Assistant restart with both camera entities available
  • Both snapshot endpoints return 200 image/jpeg
  • Both camera proxy streams return 200 multipart/x-mixed-replace

Tested on hardware with:

  • Home Assistant 2025.6.3
  • Xiaomi Miot Auto 1.1.4
  • midr.cateye.sd400

Fixes #2675

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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.

小米可视门铃4Pro缺少主摄像头视频流

1 participant