Closed iamquirarte closed 3 years ago
I'm having a similar problem. I just tried the code from commit 356ccbd, but still getting the same error.
Same problem I have
Sorry, actually my camera (isa.camera.hlc6
) always returns code: -706010002
recently, so I can't debug this bug.
Sorry, actually my camera (
isa.camera.hlc6
) always returnscode: -706010002
recently, so I can't debug this bug.
I had this code before. Try to change camera region to Germany (de) and add again to hass-xiaomi-miot via account (cloud) Or re-install hass-xiaomi-miot
Try commit: https://github.com/al-one/hass-xiaomi-miot/commit/e62d5a057955e993a238f9c0fdcec9a6de6851d4
# customize.yaml (Configuration > Customize > Select Entity > Add Other Attribute)
camera.entity_id:
keep_streaming: true
Try commit: e62d5a0
# customize.yaml (Configuration > Customize > Select Entity > Add Other Attribute) camera.entity_id: keep_streaming: true
Gets the old stream_address
anyway
Is this working for anyone yet? I still can't get the stream to load.
Out of interest - my mihome app on my iphone keeps popping up alerts say "[video camera] user xxxxxxxx is watching a video stream of xx:xx on a smart display from Video camera on" - which would suggest that the stream is being accessed by HA, but I can't view it. Is it possible that Xiaomi cloud / camera generates a new stream URL each time a URL is accessed? i.e. each stream address is "single use"?
no, it is not working for me, the xiaomi app says that user xxx is watching but my lovelace card is empty. I tryed the fix for camera (#46 #56) but it did not fix... maybe a codec problem?
The lovelace preview works, as the static picture updates correctly every X time, thats why you can see "user xxxxxxxx is watching a video", because the preview triggers this, however the main streaming DOES NOT work, as it always points to an old URL, a bug in this component :(
no good news, i tried to unistal and instal again the integration and now my cam is in "idle" state and the switch is off. in the log i can see only this error: ERROR (MainThread) [homeassistant.components.camera] Error requesting stream: Camera is off :(
no, it is not working for me, the xiaomi app says that user xxx is watching but my lovelace card is empty. I tryed the fix for camera (#46 #56) but it did not fix... maybe a codec problem?
I have very similar issue. I receive notification, that user is watching stream, but on Home assistant I got empty preview
In log files I have following info:
_2021-04-28 19:37:02 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 255, in preload_stream 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][ATTRSTREAMS].append(stream) AttributeError: 'dict' object has no attribute 'append'
and
_2021-04-28 19:42:17 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**_
Hi everybody! did someone solved the issue? Can we do something to help? My isa.camer is still not working...
This error originated from a custom integration.
Logger: custom_components.xiaomi_miot Source: custom_components/xiaomi_miot/init.py:732 Integration: Xiaomi Miot Auto (documentation, issues) First occurred: 11:26:03 AM (1 occurrences) Last logged: 11:26:03 AM
Got MiioException while fetching the state for GiardinoIpcam Camera Control: {'code': -9999, 'message': 'user ack timeout'}.
with the latest component update the camera switch is back to "on" and the status of the camera is "streaming" but unfortunately i cannot see the live stream: ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream https://de01.livestreaming.io.mi.com/hlstranscoder/...._H265transH264/playlist.m3u8
Hi,
I subscribe to this issue. I have chuangmi.camera.ipc019 and it seems the URL Lovelace uses gets to be wrong after some time (compared to URL seen in Configuration->Customize->Camera_entity->Stream URL). Static preview works OK, it's the actual video stream that stops working.
I also tested the "keep_streaming: true" Customize setting and it does not help.
Thanks for all your great work otherwise!
Commit: https://github.com/al-one/hass-xiaomi-miot/commit/d8c4369d558a0265459a505b66906bc5907793cd
This update adds to check the HTTP status of the stream address after obtaining the it. I tested it many times, and my stream address is always 403 Forbidden
, which is also the reason for the BrokenPipeError
. At the same time, the problem of obtaining the old stream address is optimized.
Anyone else solved the problems?I have the same problems, there is an error "403 Forbidden" in my HA.
no way to solve, i still have got error 404 (Not Found) WARNING (MainThread) [custom_components.xiaomi_miot.camera] GiardinoIpcam Camera Control stream address status invalid: 404 (Not Found)
Like for most of you, sometimes it works and sometimes it doesn't. Also getting the ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream xxxxx
error most of the time.
keep_streaming: true
property, but no sigar.It seems like the preview works most of the time though (more stable than the actual stream itself).
I fixed error.
I created automation in HA for trigger Stream http status
403 and 404 and then restart hass-xiaomi-miot integration and after 30 seconds homekit integration.
I fixed error.
I created automation in HA for trigger
Stream http status
403 and 404 and then restart hass-xiaomi-miot integration and after 30 seconds homekit integration.
Can you please make a copy of your setup and paste it so I can copy so I can get it to work also
Is there any updates on this topic? I am having the same issues as described above. chuangmi.camera.ipc009 status says "streaming" but doesn't show anything.
I have applied the below customization as suggested but doesn't really help at this stage:
camera.my_camera:
friendly_name: My camera
keep_streaming: true
video_attribute: 1
check_lan: true
miot_cloud: true
So does the chuangmi.camera.ipc009 work for anyone in HA or not?
This is another way to check whether the stream address is available. If you see the stream_address
attribute in the entity state, you can check the stream address by the shell command:
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
Same problem also...
Is there any updates on this topic? I am having the same issues as described above. chuangmi.camera.ipc009 status says "streaming" but doesn't show anything.
I have applied the below customization as suggested but doesn't really help at this stage:
camera.my_camera: friendly_name: My camera keep_streaming: true video_attribute: 1 check_lan: true miot_cloud: true
@Zeunas, do you know what is the meaning of check_lan settings?
@Zeunas, do you know what is the meaning of check_lan settings?
I believe it checka if the device has local connection and forces it to work in lan vs cloud, however I don't believe these cameras work in lan at all. I have actually removed that option from customize and camera is still working...
My current customization is as per below:
camera.office_cam: motion_stream_slice: -1 sub_motion_stream: true keep_streaming: true video_attribute: 1
And it's working flawlessly.
Could you check the logs and see if there's any errors related with streaming the link under stream_address from camera attributes?
@Zeunas , from what I could see after the first stream URL has expired, the second one could not be acquired and I was getting an xiot error ( #183 ). I uninstalled version 4.2 and manually installed 3.8. I can see that there was substantial change of entity attributes between the versions. Here is my 4.2 dump:
ccess_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
brand: chuangmi
model: chuangmi.camera.ipc019
lan_ip: 192.168.x.y
mac_address: 5C:E5:0C:6A:53:D0
firmware_version: 4.0.9_0426
hardware_version: ''
entity_class: MiotCameraEntity
miot_type: urn:miot-spec-v2:device📷0000A01C:chuangmi-ipc019:1
camera_control.on: true
camera_control.image_rollover: 0
camera_control.night_shot: 0
camera_control.time_watermark: true
camera_control.wdr_mode: true
glimmer_full_color-2-6: true
camera_control.recording_mode: 3
camera_control.motion_tracking: false
stream_status-3-1: 1
state_updater: cloud
miot_action_result:
did: '311243068'
miid: 0
siid: 4
aiid: 1
code: -704220025
stream_address: ''
expire_at: '2021-09-14 15:30:37.272174'
miot_error: null
sub_entities:
- camera_control.on
- motion_event
miot_action_error: '-704220025 The number of action parameters does not match'
friendly_name: Sonya camera Camera Control
entity_picture: >-
/api/camera_proxy/camera.chuangmi_ipc019_53d0_camera_control?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
supported_features: 3
Here is my 3.8 dump:
access_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
brand: chuangmi
model: chuangmi.camera.ipc019
lan_ip: 192.168.X.Y
mac_address: 5C:E5:0C:6A:53:D0
firmware_version: 4.0.9_0426
hardware_version: ''
entity_class: MiotCameraEntity
miot_type: urn:miot-spec-v2:device:camera:0000A01C:chuangmi-ipc019:1
camera_control.on: true
camera_control.image_rollover: 0
camera_control.night_shot: 0
camera_control.time_watermark: true
camera_control.wdr_mode: true
camera_control.glimmer_full_color: true
camera_control.recording_mode: 3
camera_control.motion_tracking: 'true'
camera_stream_for_amazon_alexa.stream_status: 1
state_updater: cloud
miot_action_result:
did: '311243068'
miid: 0
siid: 4
aiid: 1
code: 0
out:
- >-
https://sg14.livestreaming.io.mi.com/hlstranscoder/<mask_63_characters>_H265transH264/playlist.m3u8
camera_stream_for_google_home.stream_address: >-
https://sg08.livestreaming.io.mi.com/hlstranscoder/<mask_63_characters>_H265transH264/playlist.m3u8
expire_at: '2021-09-14 16:55:02.042187'
miot_error: null
sub_entities:
- camera_control.on
friendly_name: Sonya camera Camera Control
entity_picture: >-
/api/camera_proxy/camera.sonya_camera_camera_control?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
supported_features: 3
It is the same camera, and it works just fine on 3.8. I've lost motion detection though :(
You 4.2 dump doesn't seem to have the customization options (you should have at least keep_streaming: true video_attribute: 1
), are your sure you've customized the right camera?
I'm afraid that only @al-one will be able to advise on the error.
3.8 version doesn't have motion detection option that came later on version 4.0 I think.
@Zeunas, yes. I have 3 cameras and did all of them. I did the same customisations as you did:
camera.chuangmi_ipc019_4c79_camera_control:
motion_stream_slice: -1
sub_motion_stream: true
keep_streaming: true
video_attribute: 1
and it seemed to fix the issue. One thing I noticed, if I do customisations via HA UI then they come across as:
camera.chuangmi_ipc019_4c79_camera_control:
motion_stream_slice: '-1'
sub_motion_stream: 'true'
keep_streaming: 'true'
video_attribute: '1'
I have changed it to boolean and numbers in customize.yaml
Do you know how you use motion detection? I would like to get an alert when my son starts moving in his crib (let's say for 5 mins) :). Thanks for your help
I normally do directly on customize.yaml to avoid formatting errors. I'm afraid that I won't be much help with the error then...
As for motion detection... This was quite tricky to set up but I found a solution that works for me (there may be a better solution thou).
I've created a binary_sensor as per below:
- binary_sensor:
- name: "Office Motion"
state: "{{ (as_timestamp(now()) | int - 60) | timestamp_custom('%D %H:%M') == as_timestamp(state_attr('camera.office_cam', 'motion_video_time')) | timestamp_custom('%D %H:%M') }}"
device_class: motion
auto_off: 30
The above basically uses the time stamp of the motion video to create the motion event for the binary sensor. Unfortunately this only creates the motion event but doesn't measure how long the motion event lasts for, I don't believe with the current attributes from the camera you are actually able to capture this...but at least you can create a binary sensor that you will be able to use in automations such as notifying you of motion events.
@new-kirte
I am having the same issue, what do you exactly mean by "I have changed it to boolean and numbers in customize.yaml" ? Thanks
@new-kirte
I am having the same issue, what do you exactly mean by "I have changed it to boolean and numbers in customize.yaml" ? Thanks
@Emilianno, I went to customize.yaml and removed quotes, so from: camera.chuangmi_ipc019_4c79_camera_control: motion_stream_slice: '-1' sub_motion_stream: 'true' keep_streaming: 'true' video_attribute: '1' to: camera.chuangmi_ipc019_4c79_camera_control: motion_stream_slice: -1 sub_motion_stream: true keep_streaming: true video_attribute: 1
It seems that the integration successfully updates de the stream_address
but the hass card can't keep up with the address, and keeps trying to pull the stream from the old address. Any update on this issue?
same problem hear. stram is active for few minutes (or a half) and then go to idle.
Seems like Miot connection updates stream_address every 6 mins. And this is a security issue Google stopped integrating its camera. And HA refuses to update the stream_address, emitting 403 forbidden access error. I don't know what would be a work around...
This means that you have to re-integrate the camera every 6 minutes ? No other solution found ?
Hi, ANy news in this topic? As I understand, currently there is no chance to have isa.hlc6 working with home assistant? Only Mi HOme Application ?
Sept 2023. I am still having this issue with chuangmi_ipc009_c41b. Live streaming is not working in HA. Anyone was able to resolve?
Hi, I have a camera camera chuangmi.camera.ipc009, I understand that by protocol, the streaming URL changes every X min, this is fine, But I'm having two problems:
Sometimes the stream URL is not refreshed yet when it becomes invalid (i.e. in entity state the url points to an invalid URL for some time until it is refreshed), I guess a workaround would be to decrease the interval scanning, is this correct? Could this have a definitive fix?
The HA UI components that show the stream lack behind with old URLs even when the entity state changed the URL already to a new one. This causes the streaming never showing becase HA is trying to open an old URL Error in log:
2021-04-12 10:38:46 ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream https://us11.livestreaming.io.mi.com/hlstranscoder/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_H265transH264/playlist.m3u8 where XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX is an old token URL, and not the new one in the entity state.
Any help? Thanks!