From 37805fbb61ba21a214ee1e03ef4a563234e8bd62 Mon Sep 17 00:00:00 2001 From: quicksilver2000 Date: Tue, 25 Aug 2026 10:15:09 +0800 Subject: [PATCH 1/2] feat: expose full motion video list for dual-lens devices Expose the full list of thirdPartPlayUnits as a new attribute motion_video_list in get_alarm_eventlist(), so devices with dual-lens cameras (e.g. M30 Pro door lock) can access both streams. Backward compatible: motion_video_latest is unchanged. --- custom_components/xiaomi_miot/camera.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_miot/camera.py b/custom_components/xiaomi_miot/camera.py index 958cb5919..4275cd8e4 100644 --- a/custom_components/xiaomi_miot/camera.py +++ b/custom_components/xiaomi_miot/camera.py @@ -227,12 +227,14 @@ async def get_alarm_eventlist(self, begin, ended=None, doorbell=False, limit=2): rls = rdt.get('data', {}).get('thirdPartPlayUnits') or [] adt = {} if rls: - fst = rls[0] or {} + fst = dict(rls[0] or {}) tim = fst.pop('createTime', 0) / 1000 adt = { 'motion_video_time': f'{datetime.fromtimestamp(tim)}', 'motion_video_type': fst.get('eventType'), 'motion_video_latest': fst, + # 通用:暴露完整事件列表(含双镜头),供自动化自行配对 + 'motion_video_list': [dict(u) for u in rls], } else: self.log.info('Camera events is empty. %s', rdt) @@ -702,4 +704,4 @@ async def stream_source(self, **kwargs): async def image_source(self, **kwargs): kwargs['crypto'] = True - return self._parent.get_motion_image_address(**kwargs) + return self._parent.get_motion_image_address(**kwargs) \ No newline at end of file From 42e3aeae85fccd9b560729eec44080b1d023ea6a Mon Sep 17 00:00:00 2001 From: quicksilver2000 Date: Tue, 25 Aug 2026 10:18:23 +0800 Subject: [PATCH 2/2] docs: use English comments --- custom_components/xiaomi_miot/camera.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/camera.py b/custom_components/xiaomi_miot/camera.py index 4275cd8e4..16c13ac48 100644 --- a/custom_components/xiaomi_miot/camera.py +++ b/custom_components/xiaomi_miot/camera.py @@ -233,7 +233,8 @@ async def get_alarm_eventlist(self, begin, ended=None, doorbell=False, limit=2): 'motion_video_time': f'{datetime.fromtimestamp(tim)}', 'motion_video_type': fst.get('eventType'), 'motion_video_latest': fst, - # 通用:暴露完整事件列表(含双镜头),供自动化自行配对 + # Expose the full event list so dual-lens devices (e.g. M30 Pro + # door lock) can access both streams and pair them by createTime. 'motion_video_list': [dict(u) for u in rls], } else: