-
-
Notifications
You must be signed in to change notification settings - Fork 585
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 issues #166
Comments
Camera device model: chuangmi.camera.021a04
Full entity:
Also sometimes in logs (UPD Fixed in master):
UPD Looks like the stream are working few minutes (via URL), but not in HA I was able to open the stream with VLC and it's working fine https://de09.livestreaming.io.mi.com/hlstranscoder/xxxxxx_H265transH264/playlist.m3u8 With FFmpeg
|
|
@al-one thanks, updated from master, error is fixed, but stream still not work (same 403 from ffmpeg) |
|
Camera device model: chuangmi.camera.ipc019 camera-stream-for-google-home is present https://home.miot-spec.com/spec?type=urn%3Amiot-spec-v2%3Adevice%3Acamera%3A0000A01C%3Achuangmi-ipc019%3A1 stream_http_status and stream_http_reason attributes in entity state: not present ffmpeg test results:
full entity:
I usually get this in the logs:
|
service: xiaomi_miot.call_action
data:
entity_id: camera.mi_jia_xiao_zhi_camera_control
siid: ? # Get from https://home.miot-spec.com/spec?model=brand.camera.your
aiid: 1
params:
- 0
throw: true
ffmpeg -v warning -y -protocol_whitelist file,http,https,rtp,udp,tcp,tls,crypto -i 'https://cn.livestreaming.io.mi.com/hlstranscoder/XXXXXX_H265transH264/playlist.m3u8' -an -c:v mjpeg -f mpjpeg xiaomi_camera_video |
@deneraraujo Thanks! But unfortunately, ffmpeg -v warning -y -protocol_whitelist file,http,https,rtp,udp,tcp,tls,crypto -i 'https://cn.livestreaming.io.mi.com/hlstranscoder/XXXXXX_H265transH264/playlist.m3u8?yetAnotherServiceToken=YourServiceTokenHere' -an -c:v mjpeg -f mpjpeg xiaomi_camera_video |
@al-one I update my comment about chuangmi.camera.021a04 UPD Looks like the stream are working few minutes (via URL), but not in HA I was able to open the stream with VLC and it's working fine https://de09.livestreaming.io.mi.com/hlstranscoder/xxxxxx_H265transH264/playlist.m3u8 With FFmpeg
the result file xiaomi_camera_video has > 37 Mb there are multiple images in it starting from the header
UPD2 After few success attempts it starts giving 403 again, so it seems that there's some protection
|
Agree with this comment. I can't see the camera stream but I have set up a notification on motion with picture and that is working (returning a notification with a picture), which hints to the fact that the stream works for a few seconds/minutes not long enough for HA to capture the stream but enough to capture a snapshot. Has mentioned on other comments version 0.3.8 is working fine, unfortunately it stopped working on subsequent versions. |
@vitaliy-sk Thank you very much ! This is the reason why the Xiaomi api request is successful but the camera entity cannot obtain the stream address. I fixed it in the latest commit: 1f96a67 |
🎉 Support motion video for camera and cateye !Upgrade to v0.4.x. # customize.yaml
camera.your_entity_id:
use_motion_stream: true # 在主实体开启回放,猫眼默认已开启
sub_motion_stream: true # 为回放视频单独生成一个camera实体
motion_stream_slice: -1 # 视频切片文件索引,-1表示最后一个切片文件,0表示第一个 How to enable ? (Please use Google Translate) |
After the update, I got this on log:
Edit: In this version, when I try to call the service xiaomi_miot.call_action, I have a "BrokenPipeError".
|
Upgrade HA to v2021.4.0+.
Test the stream address via ffmpeg. |
Upgrade |
@al-one Sorry, my mistake. |
Are there other changes in the API that could have affected this integration? this new version v0.4.0b0 is a bit buggy for me, so I reverted to the version 0.3.8 that has always been working for me but even after a fresh install the stream is no longer working as before, for the 1st few minutes it works fine with a live video but once it detects a motion it plays that motion detection indefinitely. |
@Zeunas This new version of v0.4.0b0 should not affect the previous live stream without adding the custom attribute |
Every request to MiCloud goes with the cookie, as I can see in Fiddler from my mobile MiHome. Looks like there's some problem with this. |
I may have found a workaround using @qubourse suggestion. It's in a very draft form and has it's flaws, although with a failsafe option! I have worked on this based on some assumptions, not sure if they are right but it works. Follow these steps:
A few suggestions:
|
@Zeunas > Add a new Generic camera integration with the below options (note that the template for the stream source needs to be changed based on the above input_text name This doesn't work for me; step 2 return this error when trying to add the template in the "Stream Source URL" field: "Relative URLs are not allowed" |
You need to have an active stream address on your input_text helper to make it work, have you try adding just the stream address you get from the xuaomi_miot.call_acrion service?. If that doesn't work try adding it to your configuration.yaml as per below
Just to force HA to create the integration, it will then flag that the configuration yaml is deprecated but you will see the camera created on you integration section. Then you can remove it fr your configuration yaml. |
Hi, Could you prepare a simple instruction how to make Xiaomi camera to work with live stream? Step by step? :) As I see, I need to create dummy generic camera, pass via automation some stream URl.. but I don;t see any reference to my real camera entity, Could you explain used parameters in service call?
This is example state of my camera when it plays stream:
|
Replace the entity on the service call for your camera and the siid to 5, which seems to be your camera siid. Let me know if it works. |
Oo, so generic camera may have any entity. Ok tommorow inwill try, as in Poland there is midnight and smart home issues take roo much time :) morning need to go work with at least couple hours of sleep :) thanks for fast reply... |
Hmm...Stream was working live around 1:52 Now when I try to execute autmation even manually to get freshed stream Logger: homeassistant.components.automation.office_office_cam_url_ping Office - Office cam url ping: Error executing script. Unexpected error for call_service at pos 4: There were no matching config entries to reload |
Ok.. my mistake... i didn't change reload entity in automation... But still witohut any sucess - stream stopeed after 1:52 ... and also this reloading make problem. |
No, you have to disable the "real camera" (ie. the camera generated by the xioami miot integration), the generic camera will be your new camera, which will have a working stream address. I have explained this on my post below and that may be the reason why your stream stops at 1:52.
|
@mackbeth11 Btw, careful with the information you share. On this post you're sharing your camera's access token and stream address. Make sure you edit this post right away and remove such references. |
Yes, I change tokens :)
there is entity of generic camera, right? I thought that service call took stream form REAL camera this from MIOT auto) and later in last step of automtaion reload GENERIC camera to play "fresh stream" |
Hmm... you're right, something doesn't seem right although it was working for me... On the below service you should use the camera generated by this integration but on my post I used the Generic Camera which doesn't make sense... Give me a moment to look at this...
|
Yep, and if it will be done like that, I cannot delete/disable MIOT Auto "REAL" camera, as entity will be not available and I will be not able to fetch fresh stream |
Ok, try then replacing it with the real camera entity_id and disabling the "preload camera stream" on the real camera (you can have it enabled on the Generic camera). Just did it and it seems to be working (don't know what I did to make it work the first time with the real camera disabled...). |
Ok... now stream is playing until reload.. and after relood last 5 sec played in a loop. I think timning of get new stream is an issue, I"m not expert in HA,
What is logix of stream address change? Do you know? New one is available just before this expiration, 1 minute befor or just after? this is working immediately? In MI home app each 5 minutes I See that probably stream is changing (small timestamp lag) so probably new stream is prepared just after old one expire, so we need to find proper timing in HA to get new one and switch. What do you think? |
Ok.. finally looks like it works quite nice.. So what I did, I trigger this automation when generic camera became unavalaible - this mean, that it lost stream. |
What I observe, stera is broken sometimes after 5 minutes and sometimes after around @, see log picture when camera was unavailable and when I got new stream URL: |
Ah that's a good idea, didn't think of that because I thought it could take longer to load a new stream then having it generated every 4 minutes. Do you think it's smoother that way? Yes the stream address is only valid for 5 minutes, after that a new one needs to be generated. The real camera also generates links every 5 minutes, that's why everyone is complaining on this post that HA has issues dealing with the new stream addresses on the real camera. |
I already added this. I have some idea - create 2 generic cameras, use conditional card, in automation start timer to fetch new stream, push to second camera, later do the same but set to first generic.. on dashboard it will be impression, that this is continuous playing.. but here is issue with timing, I need to know when new stream dress is available : ) What do you think? |
How i can parsing link if i dont have parametr out?
But i have link here (little bottom): |
My Test with ffmpeg returns this:
Is this no longer supported? |
not getting stream_address
the state
|
Is this still working? Do you have better approach? |
This component supports Xiaomi cameras, but if you need to be able to play video streams in HA, the device needs to meet the following conditions:
camera-stream-for-google-home
needs to be defined in camera device miot-spec (find your camera spec here)stream_address
attribute in entity state)stream_http_status
andstream_http_reason
attributes in entity state)ffmpeg -v warning -y -protocol_whitelist file,http,https,rtp,udp,tcp,tls,crypto -i 'https://cn.livestreaming.io.mi.com/hlstranscoder/XXXXXX_H265transH264/playlist.m3u8' -an -c:v mjpeg -f mpjpeg xiaomi_camera_video
What information do you need to show me when report a bug for camera ?
brand.camera.abc
)Required
stream_address
stream_http_status
andstream_http_reason
attributes in entity state本组件支持小米摄像机,但是如果需要能在HA中播放视频流,需要设备满足以下条件:
stream_address
)stream_http_status
和stream_http_reason
)ffmpeg -v warning -y -protocol_whitelist file,http,https,rtp,udp,tcp,tls,crypto -i 'https://cn.livestreaming.io.mi.com/hlstranscoder/XXXXXX_H265transH264/playlist.m3u8' -an -c:v mjpeg -f mpjpeg xiaomi_camera_video
报告Bug时需要向我展示哪些信息?
brand.camera.abc
)必填
stream_http_status
和stream_http_reason
The text was updated successfully, but these errors were encountered: