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

新增 camera 似乎不支持小白摄像头 chuangmi.camera.ipc016 #11

Closed
womeimingzi11 opened this issue Jan 31, 2021 · 57 comments
Closed
Labels
device: camera miot-cloud Need enabled miot_cloud

Comments

@womeimingzi11
Copy link

看到最近的一次提交显示支持 camera 设备了。

然而将我的小白摄像头 chuangmi.camera.ipc016 配置到集成中之后,会显示为不可用,点击设备也没有预览。

进入日志显示 -9999。

采用 customize 设置云端登陆,设备会从不可用显示为休眠,但设备实际并不处于休眠模式。预览界面和上面保持一致。

此外配置过摄像机后,侧边栏会有登陆的提醒。

该问题是否是因为我的摄像头不支持所致?如果是这样的话,不知是否有已知兼容良好的摄像头可以选择?因为家中正巧打算购入新的设备。

@al-one
Copy link
Owner

al-one commented Feb 1, 2021

miot-spec中未发现名为start-hls-streamstart-rtsp-stream的action,因此不支持您的设备。
在我的设备isa.camera.hlc6中是支持的。

图片

@womeimingzi11
Copy link
Author

明白了,我清楚应该查看什么 miot-spec 确认了

@fboulange
Copy link

fboulange commented Feb 1, 2021

Hi, with an "isa.camera.hlc6" camera (firmware_version: 4.0.5_0105) I had to modify the /xiaomi_miot/init.py line 277 as the hardware version was not found (just modify it to 'hardware_version': 'dummy', )

Therefore I was able to see in Home Assistant an entity called "<camera_alias> Camera Control" but without any success to display image.

Should I customized this entity ? You got an example on how to get RSTP ?
Thanks (and congratulations about this MIOT integration)
Fred

@al-one
Copy link
Owner

al-one commented Feb 1, 2021

@fboulange Do you enable miot-cloud?

@fboulange
Copy link

image
@al-one Yeap I did.

@TheBisk
Copy link

TheBisk commented Feb 2, 2021

Cattura
Same problem for me,i see the entity but with no image.

@al-one
Copy link
Owner

al-one commented Feb 2, 2021

@fboulange @TheBisk I need debug logs of your camera entity.

@fboulange
Copy link

fboulange commented Feb 2, 2021

I use this in my configuration.yaml

camera:

  • platform: xiaomi_miot
    name: camerajardin
    host: 192.168.0.48
    token: 48475874726c4137594e39724c******
    model: isa.camera.hlc6

Here is the debug log

`2021-02-02 09:25:10 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for xiaomi_miot which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

2021-02-02 09:25:10 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

2021-02-02 09:25:23 DEBUG (MainThread) [custom_components.xiaomi_miot] Xiaomi Miot async_setup_entry {'entry_id': '94a21ae99011cd2f1fa05eb992025ec0', 'unique_id': '44:23:7c:e8:XX:XX', 'config': {'host': '192.168.0.48', 'token': '48475874726c4137594e39724cXXXXXX', 'name': 'CameraJardin', 'model': 'isa.camera.hlc6', 'mode': [], 'miot_type': 'urn:miot-spec-v2:device : camera : 0000A01C:isa-hlc6:1', 'miio_info': {'life': 6244, 'model': 'isa.camera.hlc6', 'token': '48475874726c4137594e39724cXXXXXX', 'ipflag': 1, 'miio_ver': '0.0.8', 'mac': '44:23:7C:E8::', 'fw_ver': '4.0.9_0112', 'hw_ver': 'Linux', 'miio_client_ver': '4.0.9', 'VmPeak': 42692, 'VmRSS': 1252, 'MemFree': 1756, 'ap': {'ssid': 'Boulange', 'bssid': '68:A3:78:D4:XX:XX', 'rssi': '-61', 'freq': 0}, 'netif': {'localIp': '192.168.0.48', 'mask': '255.255.255.0', 'gw': '192.168.0.254'}, 'miio_times': [6244, 1, 91, 6142]}, 'config_entry': <homeassistant.config_entries.ConfigEntry object at 0x7463b398>}, 'miio': {'life': 6244, 'model': 'isa.camera.hlc6', 'token': '48475874726c4137594e39724cXXXXXX', 'ipflag': 1, 'miio_ver': '0.0.8', 'mac': '44:23:7C:E8:XX:XX', 'fw_ver': '4.0.9_0112', 'hw_ver': 'Linux', 'miio_client_ver': '4.0.9', 'VmPeak': 42692, 'VmRSS': 1252, 'MemFree': 1756, 'ap': {'ssid': 'Boulange', 'bssid': '68:A3:78:D4:XX:XX', 'rssi': '-61', 'freq': 0}, 'netif': {'localIp': '192.168.0.48', 'mask': '255.255.255.0', 'gw': '192.168.0.254'}, 'miio_times': [6244, 1, 91, 6142]}}

2021-02-02 09:25:24 INFO (MainThread) [custom_components.xiaomi_miot.camera] Initializing CameraJardin Camera Control with host 192.168.0.48 (token 48475...)

2021-02-02 09:25:25 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Miot camera: CameraJardin Camera Control url: None expired: 0

2021-02-02 09:25:25 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Get miot camera stream from lan for CameraJardin Camera Control: {}

2021-02-02 09:26:25 DEBUG (MainThread) [custom_components.xiaomi_miot] Got new state from CameraJardin Camera Control: {}, updater: lan

2021-02-02 09:27:25 DEBUG (MainThread) [custom_components.xiaomi_miot] Got new state from CameraJardin Camera Control: {}, updater: lan

2021-02-02 09:28:25 DEBUG (MainThread) [custom_components.xiaomi_miot] Got new state from CameraJardin Camera Control: {}, updater: lan
`

@al-one al-one added the miot-cloud Need enabled miot_cloud label Feb 2, 2021
@al-one
Copy link
Owner

al-one commented Feb 2, 2021

Enable miot_cloud:

# configuration.yaml
homeassistant:
  customize: !include customize.yaml

xiaomi_miot:
  username: xiaomi_username
  password: xiaomi_password

# customize.yaml (Configuration > Customize > Select Entity > Add Other Attribute)
climate.xiaomi_mc5_374e: # Your entity id
  miot_cloud: true       # Enabled cloud

@fboulange
Copy link

fboulange commented Feb 2, 2021

I checked again and the miot_cloud value was "true" (double quoted)
Then now I've got this debug trace but no feed is displayed neither stilll picture

2021-02-02 18:55:41 DEBUG (SyncWorker_2) [custom_components.xiaomi_miot] Call miot action to CameraJardin Camera Control ({'did': '294068056', 'siid': 5, 'aiid': 1, 'in': [0]}), result: {'did': '294068056', 'miid': 0, 'siid': 5, 'aiid': 1, 'code': 0, 'out': ['https://cn01.livestreaming.io.mi.com/hlstranscoder/XXXXXXXXXXA1MTFmNzQ0MTMwYjVjZThlMDg0ZTEzZDI2OBgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8'], 'exe_time': 0, 'net_cost': 0, 'ot_cost': 0, 'otlocalts': 0, 'oa_cost': 0, '_oa_rpc_cost': 0}

(I changed the value for security measure)

When I copy/paste the https directly in Chome I got e 403 (cn01.livestreaming.io.mi.com access refused)
BTW I'm using CN server but live in France.

[Edit] the loveui card is displaying "Streaming" even if there is nothing
image

[Edit2] BTW your solution for camera does it need to have cloud service registration (payed) linked to our xiaomi account ?

[Edit3] I could ping cn01.livestreaming.io.mi.com without problem (resolved on 42.157.163.230)

Envoi d’une requête 'ping' sur cn01.livestreaming.io.mi.com [42.157.163.230] avec 32 octets de données :
Réponse de 42.157.163.230 : octets=32 temps=265 ms TTL=46

@al-one
Copy link
Owner

al-one commented Feb 3, 2021

"true" is ok.

Add config for xiaomi_miot:

# configuration.yaml

xiaomi_miot:
  username: xiaomi_username
  password: xiaomi_password
  server_country: de

You can use a player such as VLC to play within 5 minutes of generating the stream address.

@womeimingzi11
Copy link
Author

miot-spec中未发现名为start-hls-streamstart-rtsp-stream的action,因此不支持您的设备。
在我的设备isa.camera.hlc6中是支持的。

你好,我手头还有一个小米摄像机云台版 2K,型号是 chuangmi.camera.029a02,当前的插件是不支持该设备的。开启云端,日志提示 -9999

不过我发现,在设备调试助手这个页面中,虽然没有直接俄的 start-hls-stream,但是在 camera-stream-for-google-home 服务中,有 start-hls-stream 方法且在 camera-stream-for-amazon-alexa 服务中,有start-rtsp-stream方法,不知道这个还有没有实现的可能?

Snipaste_2021-02-03_14-48-30

@al-one
Copy link
Owner

al-one commented Feb 3, 2021

你好,我手头还有一个小米摄像机云台版 2K,型号是 chuangmi.camera.029a02,当前的插件是不支持该设备的。开启云端,日志提示 -9999

不过我发现,在设备调试助手这个页面中,虽然没有直接俄的 start-hls-stream,但是在 camera-stream-for-google-home 服务中,有 start-hls-stream 方法且在 camera-stream-for-amazon-alexa 服务中,有start-rtsp-stream方法,不知道这个还有没有实现的可能?

Snipaste_2021-02-03_14-48-30

开启miot_cloud后仍出现-9999是HA刚启动实例还没准备好,所有调用的还是局域网。#5 (comment)

@womeimingzi11
Copy link
Author

你好,我手头还有一个小米摄像机云台版 2K,型号是 chuangmi.camera.029a02,当前的插件是不支持该设备的。开启云端,日志提示 -9999
不过我发现,在设备调试助手这个页面中,虽然没有直接俄的 start-hls-stream,但是在 camera-stream-for-google-home 服务中,有 start-hls-stream 方法且在 camera-stream-for-amazon-alexa 服务中,有start-rtsp-stream方法,不知道这个还有没有实现的可能?
Snipaste_2021-02-03_14-48-30

开启miot_cloud后仍出现-9999是HA刚启动实例还没准备好,所有调用的还是局域网。#5 (comment)

我刚刚重新配置了一次,虽然依然不能用,不过错误代码更新了,具体如下:

2021-02-03 15:29:30 WARNING (SyncWorker_11) [custom_components.xiaomi_miot] Call miot action to 客厅摄像头 Camera Control ({'did': 371449760, 'siid': 7, 'aiid': 1, 'in': [0]}) failed: None
2021-02-03 15:29:32 WARNING (SyncWorker_0) [custom_components.xiaomi_miot] Call miot action to 客厅摄像头 Camera Control ({'did': 371449760, 'siid': 7, 'aiid': 1, 'in': [0]}) failed: None
2021-02-03 15:29:33 WARNING (SyncWorker_3) [custom_components.xiaomi_miot] Call miot action to 客厅摄像头 Camera Control ({'did': 371449760, 'siid': 7, 'aiid': 1, 'in': [0]}) failed: None
2021-02-03 15:29:35 WARNING (SyncWorker_12) [custom_components.xiaomi_miot] Call miot action to 客厅摄像头 Camera Control ({'did': 371449760, 'siid': 7, 'aiid': 1, 'in': [0]}) failed: None

我的 customize 里面的配置如下:

camera.ke_ting_she_xiang_tou_camera_control:
  miot_cloud: true
  miot_did: 371449760

configuration.yaml 中的配置如下:

xiaomi_miot:
  username: my_username
  password: my_password
  server_country: cn

siid 7 为: Camera Stream Management for Google Home
aiid 1 为: Start Camera Stream for Google
但是我还看到一个 aiid 3 为: Get Stream Configuration of Camera

@al-one
Copy link
Owner

al-one commented Feb 3, 2021

请在小米设备调试助手中执行start-hls-stream方法看看能不能获取stream-address,如果有,请在5分钟内用视频播放器如VLC试试能不能播放。

@womeimingzi11
Copy link
Author

可以获取到 stream-address,虽然轮廓什么的倒是没有问题,但是画面是绿的,不过这个应该不影响到 HA 什么。

此外,我的设备每次调用 start-hls-stream 的时候,米家都会通知用户XXX于Time在带屏音箱上观看XXX直播视频

@al-one
Copy link
Owner

al-one commented Feb 3, 2021

需要更多的HA日志

@womeimingzi11
Copy link
Author

我不确定这样的日志是否可以:

2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] 192.168.50.87:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] 192.168.50.87:54321 (ts: 1970-01-01 03:12:43, id: 1) << {'id': 1, 'result': {'life': 11563, 'uid': 1329098919, 'model': 'chuangmi.camera.029a02', 'token': '43714356423877686636444344716538', 'ipflag': 1, 'miio_ver': '0.0.8', 'mac': '78:8B:2A:D4:38:09', 'fw_ver': '4.1.2_0281', 'hw_ver': 'Linux', 'miio_client_ver': '4.1.2', 'VmPeak': 2412, 'VmRSS': 592, 'MemFree': 4072, 'ap': {'ssid': 'ASUS', 'bssid': '9C:9D:7E:42:0E:A0', 'rssi': '-24', 'freq': 2412}, 'netif': {'localIp': '192.168.50.87', 'mask': '255.255.255.0', 'gw': '192.168.50.1'}, 'config_type': 'app', 'miio_times': [11563, 0, 2, 11510]}, 'exe_time': 0}
2021-02-03 17:19:42 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x16\xcc\xcc\x0c\x00\x06l\x87' (total 16)
value = Container:
length = 32
unknown = 0
device_id = unhexlify('16cccc0c')
ts = 1970-01-05 20:56:39
offset1 = 0
offset2 = 16
length = 16
checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] Discovered 16cccc0c with ts: 1970-01-05 20:56:39, token: b'ffffffffffffffffffffffffffffffff'
省略中间其它设备的日志
2021-02-03 17:19:43 WARNING (SyncWorker_4) [custom_components.xiaomi_miot] Call miot action to 客厅摄像头 Camera Control ({'did': 371449760, 'siid': 7, 'aiid': 1, 'in': [0]}) failed: None

上述 WARNING 会重复多次
每次点击摄像头,就会多一个该 Waning

我的状态也是可以看到实例信息:如下
Snipaste_2021-02-03_17-28-50

@womeimingzi11
Copy link
Author

对了,如果我从 HomeKit 里面的摄像头调用,会产生如下日志,不知是否有帮助:

2021-02-03 17:30:33 ERROR (Thread-9) [pyhap.hap_server] Failed to process request for: /resource
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pyhap/hap_server.py", line 275, in dispatch
getattr(self, self.HANDLERS[self.command][path])()
File "/usr/local/lib/python3.8/site-packages/pyhap/hap_server.py", line 673, in handle_resource
image = self.accessory_handler.accessory.get_snapshot(image_size)
File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 544, in get_snapshot
return acc.get_snapshot(info)
File "/usr/src/homeassistant/homeassistant/components/homekit/type_cameras.py", line 450, in get_snapshot
asyncio.run_coroutine_threadsafe(
File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 164, in async_get_image
raise HomeAssistantError("Unable to get image")
homeassistant.exceptions.HomeAssistantError: Unable to get image
2021-02-03 17:30:33 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2021-02-03 17:30:33 ERROR (MainThread) [pyhap.camera] [e67ad7e0-b981-42ec-83db-778f09551a8a] Failed to start/reconfigure stream, deleting session.

@al-one
Copy link
Owner

al-one commented Feb 3, 2021

我不确定这样的日志是否可以:

2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] 192.168.50.87:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] 192.168.50.87:54321 (ts: 1970-01-01 03:12:43, id: 1) << {'id': 1, 'result': {'life': 11563, 'uid': 1329098919, 'model': 'chuangmi.camera.029a02', 'token': '43714356423877686636444344716538', 'ipflag': 1, 'miio_ver': '0.0.8', 'mac': '78:8B:2A:D4:38:09', 'fw_ver': '4.1.2_0281', 'hw_ver': 'Linux', 'miio_client_ver': '4.1.2', 'VmPeak': 2412, 'VmRSS': 592, 'MemFree': 4072, 'ap': {'ssid': 'ASUS', 'bssid': '9C:9D:7E:42:0E:A0', 'rssi': '-24', 'freq': 2412}, 'netif': {'localIp': '192.168.50.87', 'mask': '255.255.255.0', 'gw': '192.168.50.1'}, 'config_type': 'app', 'miio_times': [11563, 0, 2, 11510]}, 'exe_time': 0}
2021-02-03 17:19:42 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x16\xcc\xcc\x0c\x00\x06l\x87' (total 16)
value = Container:
length = 32
unknown = 0
device_id = unhexlify('16cccc0c')
ts = 1970-01-05 20:56:39
offset1 = 0
offset2 = 16
length = 16
checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] Discovered 16cccc0c with ts: 1970-01-05 20:56:39, token: b'ffffffffffffffffffffffffffffffff'
省略中间其它设备的日志
2021-02-03 17:19:43 WARNING (SyncWorker_4) [custom_components.xiaomi_miot] Call miot action to 客厅摄像头 Camera Control ({'did': 371449760, 'siid': 7, 'aiid': 1, 'in': [0]}) failed: None

上述 WARNING 会重复多次
每次点击摄像头,就会多一个该 Waning

我的状态也是可以看到实例信息:如下
Snipaste_2021-02-03_17-28-50

miot_cloud 没有开启成功。如果开启成功。日志中应该会找到updater: cloud,也不会去调用python-miio,请确认下。

@fboulange
Copy link

fboulange commented Feb 3, 2021

  username: xiaomi_username
  password: xiaomi_password
  server_country: fr

Thanks @al-one !

The country FR was not working.
So I've checked that the only European server is Germany and not France therefore what I did is :

  • remove my camera from Xiaomi CN server within Mi Home app
  • Log out / Log in in Mi Home app using France as location (before I used China)
  • Add my camera within Mi Home app so it will be on European server
  • Find out my new camera Token on this Germany (de) server
  • Modifiy my configuration.yaml to server_country: de and using my DE camera token.
  • Restart HA

And voila
image

It is not really smooth but at least I've got a feed !
Now I've got to find out how to use it to send to my Google Nest display :)

@womeimingzi11
Copy link
Author

我不确定这样的日志是否可以:

2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] 192.168.50.87:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] 192.168.50.87:54321 (ts: 1970-01-01 03:12:43, id: 1) << {'id': 1, 'result': {'life': 11563, 'uid': 1329098919, 'model': 'chuangmi.camera.029a02', 'token': '43714356423877686636444344716538', 'ipflag': 1, 'miio_ver': '0.0.8', 'mac': '78:8B:2A:D4:38:09', 'fw_ver': '4.1.2_0281', 'hw_ver': 'Linux', 'miio_client_ver': '4.1.2', 'VmPeak': 2412, 'VmRSS': 592, 'MemFree': 4072, 'ap': {'ssid': 'ASUS', 'bssid': '9C:9D:7E:42:0E:A0', 'rssi': '-24', 'freq': 2412}, 'netif': {'localIp': '192.168.50.87', 'mask': '255.255.255.0', 'gw': '192.168.50.1'}, 'config_type': 'app', 'miio_times': [11563, 0, 2, 11510]}, 'exe_time': 0}
2021-02-03 17:19:42 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x16\xcc\xcc\x0c\x00\x06l\x87' (total 16)
value = Container:
length = 32
unknown = 0
device_id = unhexlify('16cccc0c')
ts = 1970-01-05 20:56:39
offset1 = 0
offset2 = 16
length = 16
checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
2021-02-03 17:19:42 DEBUG (MainThread) [miio.miioprotocol] Discovered 16cccc0c with ts: 1970-01-05 20:56:39, token: b'ffffffffffffffffffffffffffffffff'
省略中间其它设备的日志
2021-02-03 17:19:43 WARNING (SyncWorker_4) [custom_components.xiaomi_miot] Call miot action to 客厅摄像头 Camera Control ({'did': 371449760, 'siid': 7, 'aiid': 1, 'in': [0]}) failed: None

上述 WARNING 会重复多次
每次点击摄像头,就会多一个该 Waning
我的状态也是可以看到实例信息:如下
Snipaste_2021-02-03_17-28-50

miot_cloud 没有开启成功。如果开启成功。日志中应该会找到updater: cloud,也不会去调用python-miio,请确认下。

可是没道理这样呀,空调伴侣 MCN02 和小爱音箱均通过 miot_cloud 参数成功链接,我应该如何确认这一点呢?

@al-one
Copy link
Owner

al-one commented Feb 3, 2021

可是没道理这样呀,空调伴侣 MCN02 和小爱音箱均通过 miot_cloud 参数成功链接,我应该如何确认这一点呢?

[custom_components.xiaomi_miot] Got new state from ... updater: cloud
启动HA并运行几分钟后检查日志中该实体的updater是否为cloud。

@karolzamosc
Copy link

Many thanks for your work @al-one. I have one problem and one question:

  1. After opening the tab with camera cast I have this error:
    error_ha

  2. Every time I open a tab with camera cast I got a push notification from Mi Home app that someone is watching a camera cast... I am using a Imilab cams app to watch this cameras too but I have no push notifications then...

@TheBisk
Copy link

TheBisk commented Feb 3, 2021

Hi, now i see somethnig, but all is green...maybe we are near the goal
image

@karolzamosc
Copy link

@TheBisk I have same screen with cams that has a weak wi-fi connection...

@womeimingzi11
Copy link
Author

womeimingzi11 commented Feb 3, 2021 via email

@al-one
Copy link
Owner

al-one commented Feb 7, 2021

@valdi-sudo This component doesn't support your cameras (chuangmi.camera.ipc016 / chuangmi.camera.ipc017), because it doesn't have start-hls-stream or start-rtsp-stream in miot-speg.org.

chuangmi.camera.ipc016
chuangmi.camera.ipc017

@minnenratta
Copy link

太棒了!终于成功了!

I have the same problem. Can you tell me how you solved this?
In whitch file I must insert this video attributes from the post before?
(The Translator dont show the full text in english/german)
Thank You.

@genericmann
Copy link

Also have the same "data type not valid" problem with chuangmi.camera.ipc019

2021-02-18 21:27:27 INFO (MainThread) [custom_components.xiaomi_miot.camera] Initializing XiaomiCamera Camera Control with host 192.168.1.172 (token 4a5a6...)
2021-02-18 21:27:27 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Miot camera: XiaomiCamera Camera Control url: None expired: 0
2021-02-18 21:27:27 DEBUG (SyncWorker_6) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot spec: action, params: {'did': 311361412, 'siid': 4, 'aiid': 1, 'in': [1]} to cloud failed: {"code":-8,"message":"data type not valid","result":null} None
2021-02-18 21:27:27 WARNING (SyncWorker_6) [custom_components.xiaomi_miot] Call miot action to XiaomiCamera Camera Control ({'did': 311361412, 'siid': 4, 'aiid': 1, 'in': [1]}) failed: None
2021-02-18 21:27:27 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Get miot camera stream from cloud for XiaomiCamera Camera Control: {}
2021-02-18 21:27:34 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Miot camera: XiaomiCamera Camera Control url: None expired: 0
2021-02-18 21:27:34 DEBUG (SyncWorker_0) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot spec: action, params: {'did': 311361412, 'siid': 4, 'aiid': 1, 'in': [1]} to cloud failed: {"code":-8,"message":"data type not valid","result":null} None
2021-02-18 21:27:34 WARNING (SyncWorker_0) [custom_components.xiaomi_miot] Call miot action to XiaomiCamera Camera Control ({'did': 311361412, 'siid': 4, 'aiid': 1, 'in': [1]}) failed: None
2021-02-18 21:27:34 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Get miot camera stream from cloud for XiaomiCamera Camera Control: {}

@al-one
Copy link
Owner

al-one commented Feb 19, 2021

Also have the same "data type not valid" problem with chuangmi.camera.ipc019

#17 (comment)

@skip78
Copy link

skip78 commented Feb 25, 2021

I checked again and the miot_cloud value was "true" (double quoted)
Then now I've got this debug trace but no feed is displayed neither stilll picture

2021-02-02 18:55:41 DEBUG (SyncWorker_2) [custom_components.xiaomi_miot] Call miot action to CameraJardin Camera Control ({'did': '294068056', 'siid': 5, 'aiid': 1, 'in': [0]}), result: {'did': '294068056', 'miid': 0, 'siid': 5, 'aiid': 1, 'code': 0, 'out': ['https://cn01.livestreaming.io.mi.com/hlstranscoder/XXXXXXXXXXA1MTFmNzQ0MTMwYjVjZThlMDg0ZTEzZDI2OBgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8'], 'exe_time': 0, 'net_cost': 0, 'ot_cost': 0, 'otlocalts': 0, 'oa_cost': 0, '_oa_rpc_cost': 0}

(I changed the value for security measure)

When I copy/paste the https directly in Chome I got e 403 (cn01.livestreaming.io.mi.com access refused)
BTW I'm using CN server but live in France.

[Edit] the loveui card is displaying "Streaming" even if there is nothing
image

[Edit2] BTW your solution for camera does it need to have cloud service registration (payed) linked to our xiaomi account ?

[Edit3] I could ping cn01.livestreaming.io.mi.com without problem (resolved on 42.157.163.230)

Envoi d’une requête 'ping' sur cn01.livestreaming.io.mi.com [42.157.163.230] avec 32 octets de données :
Réponse de 42.157.163.230 : octets=32 temps=265 ms TTL=46

Can you help me, I don't understant how you solved it. I have exactly the same problem

@HepoH3
Copy link

HepoH3 commented Apr 1, 2021

I believe that your problem is h265 codec. Modern browsers except safary doesn't support it. If you try to open this card on the ha companion app, you'll be able to see the stream.

@chrisis2
Copy link

Hi,
I have a very similar error for camera isa.camera.hlc6 integrated with Home Assistant (preview of camera not available).

obraz

I have following errors in log:

obraz

2021-04-15 21:27:52 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Miot camera: kamera Camera Control url: None expired: 1618514548728.5745
2021-04-15 21:27:53 DEBUG (SyncWorker_0) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/action {'params': {'did': '373627529', 'siid': 5, 'aiid': 1, 'in': [2]}} result: {"code":0,"message":"","result":{"did":"373627529","miid":0,"siid":5,"aiid":1,"code":0,"out":["https://de28.livestreaming.io.mi.com/hlstranscoder/GCA4Y2U4ZDk0ZjFkODk0MmJkYWVjMjFlMzliYTBhOTA3NhgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8"],"exe_time":0,"net_cost":0,"ot_cost":0,"otlocalts":0,"oa_cost":0,"_oa_rpc_cost":0}}
2021-04-15 21:27:53 DEBUG (SyncWorker_0) [custom_components.xiaomi_miot] Call miot action to kamera Camera Control ({'did': '373627529', 'siid': 5, 'aiid': 1, 'in': [2]}), result: {'did': '373627529', 'miid': 0, 'siid': 5, 'aiid': 1, 'code': 0, 'out': ['https://de28.livestreaming.io.mi.com/hlstranscoder/GCA4Y2U4ZDk0ZjFkODk0MxxxxxxxxzliYTBhOTA3NhgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8'], 'exe_time': 0, 'net_cost': 0, 'ot_cost': 0, 'otlocalts': 0, 'oa_cost': 0, '_oa_rpc_cost': 0}
2021-04-15 21:27:53 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Get miot camera stream from cloud for kamera Camera Control: {'did': '373627529', 'miid': 0, 'siid': 5, 'aiid': 1, 'code': 0, 'out': ['https://de28.livestreaming.io.mi.com/hlstranscoder/GCA4Y2U4ZDkxxxxxxxxMmJkYWVjMjFlMzliYTBhOTA3NhgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8'], 'exe_time': 0, 'net_cost': 0, 'ot_cost': 0, 'otlocalts': 0, 'oa_cost': 0, '_oa_rpc_cost': 0}
2021-04-15 21:27:53 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2813076960] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 18, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 585, in ws_camera_stream
url = await _async_stream_endpoint_url(hass, camera, fmt=msg["format"])
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 708, in _async_stream_endpoint_url
stream = await camera.create_stream()
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 370, in create_stream
self.stream = create_stream(self.hass, source, options=self.stream_options)
File "/usr/src/homeassistant/homeassistant/components/stream/__init__.py", line 71, in create_stream
hass.data[DOMAIN][ATTR_STREAMS].append(stream)
AttributeError: 'dict' object has no attribute 'append'
2021-04-15 21:27:58 DEBUG (SyncWorker_3) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/prop/get {'params': [{'did': '373627529', 'siid': 4, 'piid': 1}, {'did': '373627529', 'siid': 2, 'piid': 1}, {'did': '373627529', 'siid': 2, 'piid': 2}, {'did': '373627529', 'siid': 2, 'piid': 3}, {'did': '373627529', 'siid': 2, 'piid': 4}, {'did': '373627529', 'siid': 2, 'piid': 5}]} result: {"code":0,"message":"","result":[{"did":"373627529","siid":4,"piid":1,"value":1,"code":0},{"did":"373627529","siid":2,"piid":1,"value":true,"code":0,"updateTime":1618511850},{"did":"373627529","siid":2,"piid":2,"value":0,"code":0,"updateTime":1618514878},{"did":"373627529","siid":2,"piid":3,"value":0,"code":0,"updateTime":1618514878},{"did":"373627529","siid":2,"piid":4,"value":true,"code":0,"updateTime":1618514878},{"did":"373627529","siid":2,"piid":5,"value":2,"code":0,"updateTime":1618514878}]}
2021-04-15 21:27:58 DEBUG (MainThread) [custom_components.xiaomi_miot] Got new state from kamera Camera Control: {'stream_status': 1, 'camera_control.on': True, 'camera_control.image_rollover': 0, 'camera_control.night_shot': 0, 'camera_control.time_watermark': True, 'camera_control.recording_mode': 2, 'state_updater': 'cloud', 'sub_entities': ['camera_control.on']}
2021-04-15 21:27:59 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 498, in get
return await self.handle(request, camera)
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 533, in handle
return await camera.handle_async_mjpeg_stream(request)
File "/config/custom_components/xiaomi_miot/camera.py", line 219, in handle_async_mjpeg_stream
await stream.close()
File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 158, in close
await self._loop.run_in_executor(None, _close)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 153, in _close
self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe

Can you please help me diagnose?

@y04551b11
Copy link

怎么添加摄像头啊 看了一圈 没看懂

@stevechen1970
Copy link

請問當前版本支持chuangmi.camera.ipc019 嗎? 我遇到的問題是, 串流影片只能看前幾分鐘, 之後串流影片就一直停留在同一時間點不再更新. 嘗試很多設置的改變, 但是一直無法解決串流沒法持續更新的問題, 請問哪裡設置有誤嗎? 謝謝.

access_token:
brand: chuangmi
model: chuangmi.camera.ipc019
lan_ip: 192.168.20.11
mac_address:
firmware_version: 4.0.9_0426
hardware_version:
entity_class: MiotCameraEntity
miot_type: urn:miot-spec-v2:device:camera:0000A01C:chuangmi-ipc019:1
miot_action_result:
did: '322619315'
miid: 0
siid: 4
aiid: 1
code: -704220025

stream_address:
expire_at: 2021-10-30 16:15:20.949613
miot_error: null
camera_control.on: true
camera_control.image_rollover: 0
camera_control.night_shot: 0
camera_control.time_watermark: true
camera_control.wdr_mode: false
glimmer_full_color-2-6: true
camera_control.recording_mode: 3
camera_control.motion_tracking: false
stream_status-3-1: 1
state_updater: cloud
sub_entities: camera_control.on, motion_event
miot_action_error: -704220025 The number of action parameters does not match
friendly_name: Mi Home Security Camera 360° 1080P Camera Control
entity_picture: /api/camera_proxy/camera.chuangmi_ipc019_c396_camera_control?token=
supported_features: 3

@PrzemekSkw
Copy link

PrzemekSkw commented Oct 31, 2021

Hello, I also have that camera and don't see video. It looks OK in HA
Screenshot_20211031_204407

Screenshot_20211031_204500

I have that error in log:

Logger: custom_components.xiaomi_miot.camera
Source: custom_components/xiaomi_miot/camera.py:306
Integration: Xiaomi Miot Auto (documentation, issues)
First occurred: 20:36:46 (12 occurrences)
Last logged: 20:47:46

Niania Camera Control: camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1635104626000, 'isContinue': True}, 'description': '成功', 'ts': 1635709427430}
Niania Camera Control: camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1635104686000, 'isContinue': True}, 'description': '成功', 'ts': 1635709487430}
Niania Camera Control: camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1635104746000, 'isContinue': True}, 'description': '成功', 'ts': 1635709547421}
Niania Camera Control: camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1635104806000, 'isContinue': True}, 'description': '成功', 'ts': 1635709607517}
Niania Camera Control: camera events is empty. {'result': 'ok', 'retriable': False, 'code': 0, 'data': {'thirdPartPlayUnits': [], 'nextTime': 1635104866000, 'isContinue': True}, 'description': '成功', 'ts': 1635709667531}

I add that entry to my configuration.yaml:

#=======================
#     CAMERA XIAOMI
#======================
xiaomi_miot:
  username: xxxxxxxxxxxxxxxxxx
  password: xxxxxxxxxxxxxxxxxx
  server_country: de

What can I do to make it work?
Regards.

@al-one
Copy link
Owner

al-one commented Nov 1, 2021

@PrzemekSkw You can enable the Home surveillance assistant in the Mihome APP, and then use another camera entity camera.chuangmi_ipc016_xxxx_motion_event under the device.

#206 (comment)

@PrzemekSkw
Copy link

PrzemekSkw commented Nov 1, 2021

Thanks for answer but that don't help. Still don't have any picture from camera. I can turn it OFF and ON with switch.
In Developers tools looks like that:

camera.chuangmi_ipc016_aa6d_camera_control
Niania | idle | 
access_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
brand: chuangmi
model: chuangmi.camera.ipc016
lan_ip: 192.168.0.11
mac_address: 5D:A5:0C:89:AB:6D
firmware_version: 164.1.6_0407
hardware_version:  
entity_class: MiotCameraEntity 
miot_type: urn:miot-spec-v2:device:camera:0000A01C:chuangmi-ipc016:1 
camera_control.on: true 
camera_control.image_rollover: 0 
camera_control.night_shot: 0 
camera_control.time_watermark: true 
camera_control.wdr_mode: false 
glimmer_full_color-2-6: false 
camera_control.recording_mode: 3 
camera_control.motion_tracking: false 
state_updater: cloud 
sub_entities: camera_control.on 
friendly_name: Niania 
entity_picture: /api/camera_proxy/camera.chuangmi_ipc016_aa6d_camera_control?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
supported_features: 1

Regards

@FrancYescO
Copy link

FrancYescO commented Nov 3, 2021

i have the same issue and cannot get the image from mine chuangmi.camera.ip026c, logs and developer tools are similar

image

i've also tried this #173 (comment) but it does not help

@PrzemekSkw
Copy link

Hi @al-one is there a plans to make my Imilab camera (CMSXJ16A, chuangmi.camera.ipc016) works, to get live stream? I still have no live stream only switch button to turn on/off camera.
Regards

@FrancYescO
Copy link

FYI i have same issue also with chuangmi.camera.ipc017

@imnbug
Copy link

imnbug commented Dec 27, 2021

智能门铃是不能实时查看吗

@FrancYescO
Copy link

After enabling Home surveillance assistant on chuangmi.camera.ipc016c i was able to get a screenshot of the camera (still not stable... sometime it just loads a broken image) live stream URL is shown in the developer options... but trying to get a live stream is still not working:
image

@doktordoc1
Copy link

I get video, butt keeps only for about 10 sec, then goes from begining, over and over again

@ductu3590
Copy link

ductu3590 commented Mar 27, 2023

In # configuration.yaml

homeassistant: 
  customize: !include customize.yaml
xiaomi_miot:
  username: xiaomi_username #Replaced with my account
  password: xiaomi_password #Replaced with my account
  server_country: cn

I live in Vietnam and use "CN" server in Mihome app settings
In /config/customize.yaml:

camera.chuangmi_ipc019_a4a9_camera_control:
  video_attribute: 1 
  keep_streaming: true

But it can't display the video stream, please help me. Where did I go wrong? My camera: Chuangmi.ipc019

Logger: homeassistant.components.stream.stream.camera.chuangmi_ipc019_a4a9_camera_control
Source: components/stream/init.py:434
Integration: Stream (documentation, issues)
First occurred: 08:30:00 (3 occurrences)
Last logged: 08:30:34

Error from stream worker: Error opening stream (HTTP_FORBIDDEN, Server returned 403 Forbidden (access denied)) https://cn01.livestreaming.io.mi.com/hlstranscoder/GCBkZDNiNTY1MmQ3YmQ0MGFlOWI2MDM5ODQ5OGI4MjU1NhgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8

@iQuadro
Copy link

iQuadro commented Jan 14, 2024

Hello please help me, my camera model is chuangmi.camera.039a04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
device: camera miot-cloud Need enabled miot_cloud
Projects
None yet
Development

No branches or pull requests