Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mi 360° Home Security Camera 2K Pro (chuangmi.camera.021a04) #50

Closed
Benny2102 opened this issue Apr 8, 2021 · 20 comments
Closed

Mi 360° Home Security Camera 2K Pro (chuangmi.camera.021a04) #50

Benny2102 opened this issue Apr 8, 2021 · 20 comments
Labels
bug Something isn't working device: camera

Comments

@Benny2102
Copy link

I bought a camera. You have not created an entity. Is it possible to add?

@al-one al-one added bug Something isn't working device: camera labels Apr 9, 2021
al-one added a commit that referenced this issue Apr 9, 2021
@al-one
Copy link
Owner

al-one commented Apr 9, 2021

Try last commit: 3788f26 of master.

@Benny2102
Copy link
Author

Unfortunately, there is no success.

@al-one
Copy link
Owner

al-one commented Apr 11, 2021

1. Get Entity State Attributes

🔨 Developer tools > ℹ️ State > 🔍 Filter Entity

2. Get Debug Logs

# configuration.yaml
logger:
  default: warning
  logs:
    custom_components.xiaomi_miot: debug

⚙️ Configuration > ✍️ Logs

@Benny2102
Copy link
Author

Benny2102 commented Apr 11, 2021

That's all I found. The other devices work. 2K Camera has absolutely no entity

2021-04-11 11:40:37 DEBUG (MainThread) [custom_components.xiaomi_miot] Xiaomi cloud device: {'name': 'Mi 360° Home Security Camera 2K Pro', 'host': '192.168.0.140', 'token': '', 'model': 'chuangmi.camera.021a04', 'miot_did': '0123145679', 'miot_type': 'urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:1', 'miio_info': {'ap': {'ssid': 'WIFI', 'bssid': '00:00:00:00:00:00', 'rssi': -45}, 'netif': {'localIp': '192.168.0.140', 'gw': '', 'mask': ''}, 'fw_ver': '4.1.2_0282', 'hw_ver': '', 'mac': '11:22:33:44:55:66', 'model': 'chuangmi.camera.021a04', 'token': '...secret token...'}, 'miot_cloud': True, 'entry_id': '123asd456fgh'}

2021-04-11 11:45:00 DEBUG (MainThread) [custom_components.xiaomi_miot] Xiaomi Miot update options: {'username': '.......@.....com', 'server_country': 'de', 'user_id': 60000009, 'filter_model': 'include', 'model_list': ['mijia.camera.v3', 'philips.light.hbulb', 'chuangmi.camera.ipc019', 'chuangmi.camera.021a04'], 'filter_ssid': 'exclude', 'ssid_list': [], 'filter_bssid': 'exclude', 'bssid_list': []}

2021-04-11 11:45:00 DEBUG (MainThread) [custom_components.xiaomi_miot] Xiaomi cloud device: {'name': 'Mi 360° Home Security Camera 2K Pro', 'host': '192.168.0.140', 'token': '', 'model': 'chuangmi.camera.021a04', 'miot_did': '0123145679', 'miot_type': 'urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:1', 'miio_info': {'ap': {'ssid': 'WIFI', 'bssid': '00:00:00:00:00:00', 'rssi': -45}, 'netif': {'localIp': '192.168.0.140', 'gw': '', 'mask': ''}, 'fw_ver': '4.1.2_0282', 'hw_ver': '', 'mac': '11:22:33:44:55:66', 'model': 'chuangmi.camera.021a04', 'token': '...secret token...'}, 'miot_cloud': True, 'entry_id': '123asd456fgh'}

@al-one
Copy link
Owner

al-one commented Apr 11, 2021

Your device model chuangmi.camera.021a04 has two miot-spec version:

urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:1
urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:2

Version 1 has no actiion: start-hls-stream, but version 2 has.

Please check whether your local file custom_components/xiaomi_miot/core/miot_spec.py is consistent with the code:

sdt = {}
for v in (dat.get('instances') or []):
m = v.get('model')
o = sdt.get(m)
if o and v.get('version') < o.get('version'):
continue
v.pop('model', None)
sdt[m] = v
await store.async_save(sdt)

This code will use the highest version of miot-spec, but your log still display to use the lower version.

@Benny2102
Copy link
Author

miotcpec
This is mine. What can I do?

@al-one
Copy link
Owner

al-one commented Apr 12, 2021

Delete this local file: {hass_config}/.storage/xiaomi_miot/instances.json and restart HA.

@Benny2102
Copy link
Author

Thank you very much. This helped. The entities were created. I only have 1 problem, no stream.

@al-one
Copy link
Owner

al-one commented Apr 13, 2021

State attributes and debug logs.

@Benny2102
Copy link
Author

2021-04-13 18:51:00 DEBUG (MainThread) [custom_components.xiaomi_miot] Xiaomi cloud device: {'name': 'Mi 360° Home Security Camera 2K Pro', 'host': '192.168.0.140', 'token': '', 'model': 'chuangmi.camera.021a04', 'miot_did': '0123145679', 'miot_type': 'urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:2', 'miio_info': {'ap': {'ssid': 'WIFI', 'bssid': '00:00:00:00:00:00', 'rssi': -45}, 'netif': {'localIp': '192.168.0.140', 'gw': '', 'mask': ''}, 'fw_ver': '4.1.2_0282', 'hw_ver': '', 'mac': '11:22:33:44:55:66', 'model': 'chuangmi.camera.021a04', 'token': '...secret token...'}, 'miot_cloud': True, 'entry_id': '123asd456fgh'}

2021-04-13 18:53:49 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Miot camera: Mi 360° Home Security Camera 2K Pro Camera Control url is empty. {'model': 'chuangmi.camera.021a04', 'lan_ip': '192.168.0.140', 'mac_address': '11:22:33:44:55:66', 'firmware_version': '4.1.2_0282', 'hardware_version': '', 'entity_class': 'MiotCameraEntity', 'miot_type': 'urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:2', 'miot_action_result': {'did': '0123456789', 'miid': 0, 'siid': 7, 'aiid': 1, 'code': -704220035, 'exe_time': 0, 'net_cost': 0, 'ot_cost': 0, 'otlocalts': 0, 'oa_cost': 0, '_oa_rpc_cost': 0}, 'stream_status': 1, 'motion_detection': False, 'motion_detection.alarm_interval': 5, 'detection_sensitivity': 1, 'motion_detection_start_time': '0:0:0', 'motion_detection_end_time': '23:59:0', 'memory_card_management.status': 0, 'storage_total_space': 15106048, 'storage_free_space': 3866624, 'storage_used_space': 11239424, 'indicator_light.on': False, 'camera_control.on': True, 'camera_control.image_rollover': 0, 'camera_control.night_shot': 2, 'camera_control.wdr_mode': False, 'glimmer_full_color': True, 'camera_control.recording_mode': 1, 'camera_control.motion_tracking': False, 'camera_control.time_watermark': True, 'state_updater': 'cloud', 'sub_entities': ['camera_control.on', 'motion_detection-5.motion_detection-1', 'indicator_light-3']}

@Benny2102
Copy link
Author

2kcam

@al-one
Copy link
Owner

al-one commented Apr 14, 2021

code: -704220035 means: action params error.
See: #11 (comment)

# customize.yaml (Configuration > Customize > Select Entity > Add Other Attribute)
camera.entity_id:
  video_attribute: 2

@Benny2102
Copy link
Author

Thank you very much. That way it works perfectly.

@khmyznikov
Copy link

khmyznikov commented Oct 11, 2021

@Benny2102 did you face an issue 500 server error when trying to view the stream from the camera?
image

@khmyznikov
Copy link

access_token: %token%
brand: chuangmi
model: chuangmi.camera.021a04
lan_ip: 192.168.0.4
mac_address: 78:8B:2A:17:AB:4F
firmware_version: 4.1.6_0309
hardware_version: ''
entity_class: MiotCameraEntity
miot_type: urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:3
camera_control.on: false
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: 1
camera_control.motion_tracking: false
camera_control.time_watermark: true
bluetooth.bluetooth_switch.error: '-4003 Property/Action/Event does not exist'
stream_status-8-9: 1
stream_status-7-9: 1
motion_detection: false
motion_detection.alarm_interval: 5
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: 0
storage_total_space-4-2: 125042688
storage_free_space-4-3: 112197632
storage_used_space-4-4: 12845056
indicator_light.on: true
state_updater: lan
sub_entities:
  - camera_control.on
  - motion_event
  - motion_detection-5.motion_detection-1
  - indicator_light-3
stream_address: ''
expire_at: '2021-10-11 17:28:57.454907'
friendly_name: Security Camera Camera Control
entity_picture: >-
  /api/camera_proxy/camera.chuangmi_021a04_ab4f_camera_control?token=%token%
supported_features: 3

@khmyznikov
Copy link

@al-one maybe you can give some tips?

@al-one
Copy link
Owner

al-one commented Oct 14, 2021

@khmyznikov No idea for live streaming.
But you can enable the Home surveillance assistant in the Mihome APP, and then use another camera entity camera.chuangmi_021a04_xxxx_motion_event under the device.

@ilyabrussenko
Copy link

ilyabrussenko commented Apr 23, 2023

Hello, @al-one!

I have some issue with this cam camera.chuangmi_021a04 (MJSXJ06CM).
I want to streaming video from cam to HA.

Ffmpeg with url https://ru.livestreaming.io.mi.com/hlstranscoder/GCA1NmI3MTFiYTBlYfXwA_H265transH264/playlist.m3u8 got this error:
image
image

Here is my entity info:
access_token: %token%
model_name: chuangmi.camera.021a04
brand: chuangmi
frontend_stream_type: hls
model: chuangmi.camera.021a04
lan_ip: 192.168.1.135
mac_address: 94:F8:27:22:46:1F
entity_class: MiotCameraEntity
miot_type: urn:miot-spec-v2:device:camera:0000A01C:chuangmi-021a04:3
miot_action_result:
did: '1034451098'
miid: 0
siid: 7
aiid: 1
code: 0
out:
-- > --
https://ru.livestreaming.io.mi.com/hlstranscoder/GCA1NmI3MTFiYTBlYfXwA_H265transH264/playlist.m3u8
exe_time: 0
withLatency: 0

camera_control.on: true
camera_control.image_rollover: 0
camera_control.night_shot: 2
camera_control.wdr_mode: true
glimmer_full_color-2-6: true
camera_control.recording_mode: 0
camera_control.motion_tracking: false
camera_control.time_watermark: true
bluetooth.bluetooth_switch: true
stream_status-8-9: 1
stream_status-7-9: 1
motion_detection: false
motion_detection.alarm_interval: 5
detection_sensitivity-5-3: 1
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: 0
storage_free_space-4-3: 0
storage_used_space-4-4: 0
indicator_light.on: false
state_updater: cloud
sub_entities: motion_detection-5.motion_detection-1, indicator_light-3
entity_picture: /api/camera_proxy/camera.chuangmi_021a04_461f_camera_control?token=%token%
friendly_name: Mi 360° Home Security Camera 2K Pro Camera Control
supported_features: 3

Tested some tips with customize.yaml, dont work. :(
Please help :)

@ilyabrussenko
Copy link

adding some logs:

Logger: custom_components.xiaomi_miot.camera
Source: custom_components/xiaomi_miot/camera.py:306
Integration: Xiaomi Miot Auto (documentation, issues)
First occurred: 20:07:14 (16 occurrences)
Last logged: 20:22:14

Mi 360° Home Security Camera 2K Pro(chuangmi.camera.021a04): camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1681654689000, 'isContinue': True}, 'description': '成功', 'ts': 1682259489680}
Mi 360° Home Security Camera 2K Pro(chuangmi.camera.021a04): camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1681654749000, 'isContinue': True}, 'description': '成功', 'ts': 1682259549644}
Mi 360° Home Security Camera 2K Pro(chuangmi.camera.021a04): camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1681654809000, 'isContinue': True}, 'description': '成功', 'ts': 1682259609652}
Mi 360° Home Security Camera 2K Pro(chuangmi.camera.021a04): camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1681654869000, 'isContinue': True}, 'description': '成功', 'ts': 1682259669738}
Mi 360° Home Security Camera 2K Pro(chuangmi.camera.021a04): camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1681654934000, 'isContinue': True}, 'description': '成功', 'ts': 1682259734758}

Logger: homeassistant.components.stream.stream.camera.chuangmi_021a04_461f_camera_control
Source: components/stream/init.py:434
Integration: Stream (documentation, issues)
First occurred: 20:07:33 (14 occurrences)
Last logged: 20:22:45

Error from stream worker: Error opening stream (ERRORTYPE_111, Connection refused) https://ru.livestreaming.io.mi.com/hlstranscoder/GCA1NmI3MTFiYT_H265transH264/playlist.m3u8

@dimppk
Copy link

dimppk commented Jan 25, 2024

Hej, any success with this camera? Have same issues with streaming..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working device: camera
Projects
None yet
Development

No branches or pull requests

5 participants