al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.32k stars 607 forks source link

Xiaomi Smart Camera C400 - no picture #1042

Open nicrame opened 1 year ago

nicrame commented 1 year ago

While do camera is working fine with Xiaomi Home App, there is no picture in Home Assistant. I've got account connected, and camera was added with Xiaomi Home App.

SzemiSun commented 1 year ago

same issue here. but i have motion event picture, but live stream or picture not

2023-08-12 09:13:21.421 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Added sub entity light: indicator_light-3 2023-08-12 09:13:21.425 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Got new state: {'camera_control.on': True, 'camera_control.image_rollover': 0, 'camera_control.night_shot': 2, 'camera_control.wdr_mode': False, 'glimmer_full_color-2-6': True, 'camera_control.recording_mode': 0, 'camera_control.motion_tracking': False, 'camera_control.local_storage': True, 'imi_alarm.alarm_clocks': '', 'imi_alarm.alarm_clocks_key': '', 'imi_alarm.baby_wake_switch': False, 'imi_alarm.baby_sleep_area': '', 'imi_alarm.babycry_switch': False, 'stream_status-10-9': 1, 'stream_status-9-9': 1, 'motion_detection': False, 'motion_detection.alarm_interval': 10, 'detection_sensitivity-5-3': 0, 'motion_detection_start_time-5-4': '00:00:00', 'motion_detection_end_time-5-5': '23:59:00', 'memory_card_management.status': 1, 'storage_total_space-4-2': 1024, 'storage_free_space-4-3': 0, 'storage_used_space-4-4': 1024, 'indicator_light.on': False, 'state_updater': 'lan'} 2023-08-12 09:13:21.427 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Added sub entity switch: camera_control-2.on-1 2023-08-12 09:13:21.448 DEBUG (MainThread) [custom_components.xiaomi_miot.light] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Added to hass: [{'miot_cloud_action': True}] 2023-08-12 09:13:21.541 DEBUG (SyncWorker_2) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: v2/message/v2/typelist {} result: bytearray(b'{"code":0,"message":"ok","result":{"messages":[{"msg_id":1690258307136634880,"uid":***,"type":6,"sender_uid":0,"did":"1072430531","title":"User *** is watching the livestream of 09:05 on a smart display from Xiaomi Smart Camera C400 on.","content":"Xiaomi Smart Camera C400 ","img_url":"","params":{"body":{"alertType":"","did":"1072430531","event":"stream","extra":null,"homeRoomExtra":{"homeName":"","roomName":"Living room"},"home_id":902001000924,"identify":"1072430531","model":"chuangmi.camera.039a04","msgId":"","name":"Xiaomi Smart Camera C400 ","owner_uid":***,"priority":"","time":1691823958,"us_id":0,"value":null},"devicePush":true,"model":"chuangmi.camera.039a04","type":"scene"},"is_new":1,"status":0,"ctime":1691823958,"last_modify":1691823958,"home_id":0,"home_owner":0}]}}') 2023-08-12 09:13:21.545 DEBUG (MainThread) [custom_components.xiaomi_miot.sensor] Finished fetching xiaomi_miot-mihome-message-*** data in 0.353 seconds (success: True) 2023-08-12 09:13:21.730 DEBUG (SyncWorker_1) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: https://de.business.smartcamera.api.io.mi.com/common/app/get/eventlist {'did': '1072430531', 'model': 'chuangmi.camera.039a04', 'doorBell': False, 'eventType': 'Default', 'needMerge': True, 'sortType': 'DESC', 'region': 'DE', 'language': 'en_US', 'beginTime': 1691219601000, 'endTime': 1691824402428, 'limit': 2} result: bytearray(b'{"result":"ok","retriable":false,"code":0,"data":{"thirdPartPlayUnits":[{"startDuration":0,"cut":false,"offset":0,"isCloud":false,"isRead":false,"videoStoreId":"CAMERA_VIDEO_GLACfu2VR8umUa5RmhozxK6UIJjLmFj9LB756trLo9_ckJM6TxyTL8MOZEVYRqqcZgwOqPDCRs2RL7baEACvWUVGPDPBNbOZNLs1eW_epeAGoywHQ9YM9ijz5Qa4iqWGj7avkVaO1m9YCk4GSFhxDW9NtUVUKmF0eSNGTvDn00Y9bWgrnmrxxndPdfXDXx4kkU4DcNqSnVeLOnku9WkxrseDbLfRBBo0Ojyf61Phj6MGODBjgkMb_jntcq8yCJU8eJTWyNmx4mXNVo1Av7cX_uh2pPz4soiWpKGH66XgO81SwfROeZSQq3Li0jpJdCt1kxTD8TJms9wsCKQtkofz5y71jL2YK6vI_TjPP20wLs_QDZvUcBrMZpjvY5XP2XOW4ZCO-s5qOMLkU9v5Ykf9wldKIhgSgPuguMYaQlyb88lPhDcuFAsBGBChA-jBEshE37iWY7UQgF0bGBTJsBaJTD4HW3-o5wVz_FqPJRdvUQA","eventType":"ObjectMotion","expireTime":1692426199318,"createTime":1691821394622,"isAlarm":true,"isShowImg":true,"imgStoreId":"CAMERA_IMG_GLACfu2VR8umUa5RmhozxK6UIJjLmFj9LB756trLo9_ckJM6TxyTL8MOZEVYRqqcZgwOqPDCRs2RL7baEACvWUVGPDPBNbOZNLs1eW_epeAGoywHQ9YM9ijz5Qa4iqWGj7avkVaO1m9YCk4GSFhxDW9NtUVUKmF0eSNGTvDn00Y9bWgrnmrxxndPdfXDXx4kkU4DcNqSnVeLOnku9WkxrseDbLfRBBo0Ojyf61Phj6MGODBjgkMb_jntcq8yCJU8eJTWyNmx4mXNVo1Av7cX_uh2pPz4soiWpKGH66XgO81SwfROeZSQq3Li0jpJdCt1kxTD8TJms9wsCKQtkofz5y71jL2YK6vI_TjPP20wLs_QDZvUcBrMZpjvY5XP2XOW4ZCO-s5qOMLkU9v5Ykf9wldKIhgSgPuguMYaQlyb88lPhDcuFAsBGBChA-jBEshE37iWY7UQgF0bGBTJsBaJTD4HW3-o5wVz_FqPJRdvUQA","fileId":"95031771634532352","extraInfo":"{\\"ver\\":\\"1.0.0\\",\\"alarmStart\\":true,\\"eventType\\":\\"ObjectMotion\\"}"}],"nextTime":1691821394622,"isContinue":false},"description":"\xe6\x88\x90\xe5\x8a\x9f","ts":1691824401709}') 2023-08-12 09:13:21.736 DEBUG (SyncWorker_8) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Got stream url: https://de.business.smartcamera.api.io.mi.com/common/app/m3u8?data=***&rc4_hash__=Hhh0X6lguDN1p%2Fre9ZXYPxAMpSGnQ5mdHPqg%3D&ssecurity=Nj4wyEZlTwlss%2BjoFo0N8A%3D%3D&_nonce=8Zj3nAQFFyQBrkDR&yetAnotherServiceToken=*** 2023-08-12 09:13:21.740 DEBUG (SyncWorker_8) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Got image url: https://de.processor.smartcamera.api.io.mi.com/miot/camera/app/v1/img?data=***A%3D%3D&rc4_hash__=tBt3prAfM26FVFDhQrX4M8Vs%2B9fmBbyQbAaO5Q%3D%3D&signature=8MMYjw5nphlkBvp2%2FWDo2W%2F0Xws%3D&ssecurity=Nj4wyEZlTwlss%2BjoFo0N8A%3D%3D&_nonce=vA%2FdnjzidIwBrkDR&yetAnotherServiceToken=*** 2023-08-12 09:13:36.508 DEBUG (SyncWorker_12) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: v2/message/v2/typelist {} result: bytearray(b'{"code":0,"message":"ok","result":{"messages":[{"msg_id":1690258307136634880,"uid":***,"type":6,"sender_uid":0,"did":"1072430531","title":"User *** is watching the livestream of 09:05 on a smart display from Xiaomi Smart Camera C400 on.","content":"Xiaomi Smart Camera C400 ","img_url":"","params":{"body":{"alertType":"","did":"1072430531","event":"stream","extra":null,"homeRoomExtra":{"homeName":"","roomName":"Living room"},"home_id":902001000924,"identify":"1072430531","model":"chuangmi.camera.039a04","msgId":"","name":"Xiaomi Smart Camera C400 ","owner_uid":***,"priority":"","time":1691823958,"us_id":0,"value":null},"devicePush":true,"model":"chuangmi.camera.039a04","type":"scene"},"is_new":1,"status":0,"ctime":1691823958,"last_modify":1691823958,"home_id":0,"home_owner":0}]}}') 2023-08-12 09:13:36.512 DEBUG (MainThread) [custom_components.xiaomi_miot.sensor] Finished fetching xiaomi_miot-mihome-message-*** data in 0.319 seconds (success: True) 2023-08-12 09:13:38.878 ERROR (SyncWorker_11) [miio.miioprotocol] Got error when receiving: timed out 2023-08-12 09:13:51.469 DEBUG (SyncWorker_9) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: v2/message/v2/typelist {} result: bytearray(b'{"code":0,"message":"ok","result":{"messages":[{"msg_id":1690258307136634880,"uid":***,"type":6,"sender_uid":0,"did":"1072430531","title":"User *** is watching the livestream of 09:05 on a smart display from Xiaomi Smart Camera C400 on.","content":"Xiaomi Smart Camera C400 ","img_url":"","params":{"body":{"alertType":"","did":"1072430531","event":"stream","extra":null,"homeRoomExtra":{"homeName":"","roomName":"Living room"},"home_id":902001000924,"identify":"1072430531","model":"chuangmi.camera.039a04","msgId":"","name":"Xiaomi Smart Camera C400 ","owner_uid":***,"priority":"","time":1691823958,"us_id":0,"value":null},"devicePush":true,"model":"chuangmi.camera.039a04","type":"scene"},"is_new":1,"status":0,"ctime":1691823958,"last_modify":1691823958,"home_id":0,"home_owner":0}]}}') 2023-08-12 09:13:51.470 DEBUG (MainThread) [custom_components.xiaomi_miot.sensor] Finished fetching xiaomi_miot-mihome-message-*** data in 0.278 seconds (success: True) 2023-08-12 09:14:06.501 DEBUG (SyncWorker_3) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: v2/message/v2/typelist {} result: bytearray(b'{"code":0,"message":"ok","result":{"messages":[{"msg_id":1690258307136634880,"uid":***,"type":6,"sender_uid":0,"did":"1072430531","title":"User *** is watching the livestream of 09:05 on a smart display from Xiaomi Smart Camera C400 on.","content":"Xiaomi Smart Camera C400 ","img_url":"","params":{"body":{"alertType":"","did":"1072430531","event":"stream","extra":null,"homeRoomExtra":{"homeName":"","roomName":"Living room"},"home_id":902001000924,"identify":"1072430531","model":"chuangmi.camera.039a04","msgId":"","name":"Xiaomi Smart Camera C400 ","owner_uid":***,"priority":"","time":1691823958,"us_id":0,"value":null},"devicePush":true,"model":"chuangmi.camera.039a04","type":"scene"},"is_new":1,"status":0,"ctime":1691823958,"last_modify":1691823958,"home_id":0,"home_owner":0}]}}') 2023-08-12 09:14:06.504 DEBUG (MainThread) [custom_components.xiaomi_miot.sensor] Finished fetching xiaomi_miot-mihome-message-*** data in 0.311 seconds (success: True) 2023-08-12 09:14:14.312 ERROR (SyncWorker_0) [miio.miioprotocol] Got error when receiving: timed out 2023-08-12 09:14:15.481 DEBUG (SyncWorker_5) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): camera stream: None expired: 0 2023-08-12 09:14:15.513 DEBUG (SyncWorker_12) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Got image url: https://de.processor.smartcamera.api.io.mi.com/miot/camera/app/v1/img?data=***2F4NhzX75kZWLEPKTaRAaHp8T71YGk9duyMmpPkvXpa5Pq%2Fxhj6BLwP%2FhZtCMO0TWphzEk%2BAPc92gP5YJ3EEiPtLOzwyaqQ%3D%3D&rc4_hash__=4SwrOiOjz4P1YRZHA3wrxGsgc67taUbcggEwQg%3D%3D&signature=jRGplABXl3Mw38MFKPeFF7WgS98%3D&ssecurity=Nj4wyEZlTwlss%2BjoFo0N8A%3D%3D&_nonce=GAghzyi%2BcnYBrkDS&yetAnotherServiceToken=*** 2023-08-12 09:14:15.956 DEBUG (SyncWorker_5) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/action {'params': {'did': '1072430531', 'siid': 9, 'aiid': 2, 'in': []}} result: bytearray(b'{"code":0,"message":"ok","result":{"did":"1072430531","miid":0,"siid":9,"aiid":2,"code":0,"exe_time":0,"withLatency":0}}') 2023-08-12 09:14:15.957 DEBUG (SyncWorker_5) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Call miot action {'did': '1072430531', 'siid': 9, 'aiid': 2, 'in': []}, result: {'did': '1072430531', 'miid': 0, 'siid': 9, 'aiid': 2, 'code': 0, 'exe_time': 0, 'withLatency': 0} 2023-08-12 09:14:16.351 DEBUG (SyncWorker_5) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/action {'params': {'did': '1072430531', 'siid': 9, 'aiid': 1, 'in': [1]}} result: bytearray(b'{"code":0,"message":"ok","result":{"did":"1072430531","miid":0,"siid":9,"aiid":1,"code":0,"out":["https://de21.livestreaming.io.mi.com/hlstranscoder/GC****NGY3OGNjNzMyZjZkN2E2Y2Y1MxgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8"],"exe_time":0,"withLatency":0}}') 2023-08-12 09:14:16.352 DEBUG (SyncWorker_5) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Call miot action {'did': '1072430531', 'siid': 9, 'aiid': 1, 'in': [1]}, result: {'did': '1072430531', 'miid': 0, 'siid': 9, 'aiid': 1, 'code': 0, 'out': ['https://de21.livestreaming.io.mi.com/hlstranscoder/GCBhZDM3***NzMyZjZkN2E2Y2Y1MxgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8'], 'exe_time': 0, 'withLatency': 0} 2023-08-12 09:14:16.352 DEBUG (SyncWorker_5) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Get miot camera stream from cloud: {'did': '1072430531', 'miid': 0, 'siid': 9, 'aiid': 1, 'code': 0, 'out': ['https://de21.livestreaming.io.mi.com/hlstranscoder/GCBhZDM3ODk0MGZhZmI0NGY3OG***VzZWRfXwA_H265transH264/playlist.m3u8'], 'exe_time': 0, 'withLatency': 0} 2023-08-12 09:14:20.292 DEBUG (SyncWorker_10) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/action {'params': {'did': '1072430531', 'siid': 9, 'aiid': 2, 'in': []}} result: bytearray(b'{"code":0,"message":"ok","result":{"did":"1072430531","miid":0,"siid":9,"aiid":2,"code":0,"exe_time":0,"withLatency":0}}') 2023-08-12 09:14:20.293 DEBUG (SyncWorker_10) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Call miot action {'did': '1072430531', 'siid': 9, 'aiid': 2, 'in': []}, result: {'did': '1072430531', 'miid': 0, 'siid': 9, 'aiid': 2, 'code': 0, 'exe_time': 0, 'withLatency': 0} 2023-08-12 09:14:20.702 DEBUG (SyncWorker_10) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/action {'params': {'did': '1072430531', 'siid': 9, 'aiid': 1, 'in': [2]}} result: bytearray(b'{"code":0,"message":"ok","result":{"did":"1072430531","miid":0,"siid":9,"aiid":1,"code":0,"out":["https://de22.livestreaming.io.mi.com/hlstranscoder/GCAyND***M0A_H265transH264/playlist.m3u8"],"exe_time":0,"withLatency":0}}') 2023-08-12 09:14:20.702 DEBUG (SyncWorker_10) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Call miot action {'did': '1072430531', 'siid': 9, 'aiid': 1, 'in': [2]}, result: {'did': '1072430531', 'miid': 0, 'siid': 9, 'aiid': 1, 'code': 0, 'out': ['https://de22.livestreaming.io.mi.com/hlstranscoder/GCAyNDRlOTdi***RmM2E2fXwA_H265transH264/playlist.m3u8'], 'exe_time': 0, 'withLatency': 0} 2023-08-12 09:14:20.703 DEBUG (SyncWorker_10) [custom_components.xiaomi_miot.camera] Xiaomi Smart Camera C400(chuangmi.camera.039a04): Get miot camera stream from cloud: {'did': '1072430531', 'miid': 0, 'siid': 9, 'aiid': 1, 'code': 0, 'out': ['https://de22.livestreaming.io.mi.com/hlstranscoder/GCAyNDRlOMDNjYhg***64/playlist.m3u8'], 'exe_time': 0, 'withLatency': 0} 2023-08-12 09:14:20.717 ERROR (MainThread) [homeassistant.components.camera] Error requesting stream: camera.chuangmi_039a04_8159_camera_control does not support play stream service

ValeriGYordanov commented 5 months ago

Same issue here, is there any information on this?

leon0399 commented 3 months ago
2024-05-16 19:06:55.064 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.chuangmi_039a04_ab5b_motion_event] Error from stream worker: Error demuxing stream: [Errno 1094995529] Invalid data found when processing input: 'https://ru.business.smartcamera.api.io.mi.com/common/app/m3u8?data=***'; last error log: [mov,mp4,m4a,3gp,3g2,mj2] stream 0, offset 0xc17: partial file

I've tried streaming URL from integration logs using VPC, and it works fine. That makes me think that the issue is on the stream parser side

ganmoting commented 2 weeks ago

@leon0399 I meet similar question,could you please guide me on how to grt about fixing this

leon0399 commented 2 weeks ago

@ganmoting I haven't been able to find a fix; integration is still broken for me

ganmoting commented 2 weeks ago

@leon0399 this camera similar unable living,only check the last few minute