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

[Bug] EXTERNAL: Error opening camera streams due to X1 firmware issues #221

Open
bubbleytea opened this issue Sep 20, 2023 · 63 comments
Open
Labels
bug Something isn't working external Issue is related to functionality outside the integration wontfix This will not be worked on

Comments

@bubbleytea
Copy link

bubbleytea commented Sep 20, 2023

Describe the bug

Camera streams stopped working and I see this error in the logs:

2023-09-19 21:17:18.749 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.x1c_****_camera] Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error) rtsps://****:****@192.168.1.168/streaming/live/1

Camera streams time out:
image

They were working before when I first set up the integration.

To Reproduce

Install integration and add devices. Eventually the streams just stop loading.

Expected Behaviour

Camera stream loads

What device are you using?

X1C

Firmware Version

01.06.03.00

Home Assistant Version

2023.9.2

Component Version

1.5.0

Log Extracts

2023-09-19 21:17:18.749 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.x1c__camera] Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error) rtsps://:***@192.168.1.168/streaming/live/1

Other Information

I don't see any other errors in the logs. Is there anything else I can do to help debug?

@bubbleytea bubbleytea added the bug Something isn't working label Sep 20, 2023
@greghesp
Copy link
Owner

Has the IP of your printer changed by any chance?

@bubbleytea
Copy link
Author

Has the IP of your printer changed by any chance?

No, I checked and the IPs of all the printers are still the same. All of the other sensors are working properly (I'm assuming those would be broken too, if the IP changed?).

@greghesp
Copy link
Owner

Ah yeah you're right. I got the logic mixed up with something else I did.

Can you access the stream via VLC?

@greghesp greghesp added the more info needed Waiting on additional information to validate error or fix label Sep 25, 2023
@IIDemoniaKII
Copy link

Hello,

I have the same problem.

Error from stream worker: Error opening stream (EXIT, Immediate exit requested) rtsps://:@us.mqtt.bambulab.com/streaming/live/1

@greghesp
Copy link
Owner

Ohhh ok, I know the cause of this now. The URL is populated from the config flow, not the MQTT. Will revert

@IIDemoniaKII
Copy link

Thank you for your work !

@greghesp
Copy link
Owner

Can you try the latest pre-release please: https://github.com/greghesp/ha-bambulab/releases/tag/v1.7.1-dev1

@IIDemoniaKII
Copy link

IIDemoniaKII commented Sep 29, 2023

Hello,

Still does not work.

Tried to install locally, without success.

I am attaching error logs, but I am not sure that they correspond to this problem.


Logger: aiohttp.server
Source: custom_components/bambu_lab/camera.py:64
Integration: Bambu Lab (documentation, issues)
First occurred: 18:10:13 (2 occurrences)
Last logged: 18:11:23

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 763, in get
return await self.handle(request, camera)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 803, in handle
stream = await camera.handle_async_mjpeg_stream(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 624, in handle_async_mjpeg_stream
return await self.handle_async_still_stream(request, self.frame_interval)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 612, in handle_async_still_stream
return await async_get_still_stream(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 280, in async_get_still_stream
img_bytes = await image_cb()
^^^^^^^^^^^^^^^^
File "/config/custom_components/bambu_lab/camera.py", line 76, in async_camera_image
stream_source = await self.stream_source()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bambu_lab/camera.py", line 64, in stream_source
url = URL(self.coordinator.get_model().camera.rtsp_url).with_user('bblp').with_password(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/yarl/_url.py", line 835, in with_user
raise ValueError("user replacement is not allowed for relative URLs")
ValueError: user replacement is not allowed for relative URLs

@greghesp
Copy link
Owner

Hello,

Still does not work.

Tried to install locally, without success.

I am attaching error logs, but I am not sure that they correspond to this problem.

Logger: aiohttp.server Source: custom_components/bambu_lab/camera.py:64 Integration: Bambu Lab (documentation, issues) First occurred: 18:10:13 (2 occurrences) Last logged: 18:11:23

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, **request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 763, in get return await self.handle(request, camera) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 803, in handle stream = await camera.handle_async_mjpeg_stream(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 624, in handle_async_mjpeg_stream return await self.handle_async_still_stream(request, self.frame_interval) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 612, in handle_async_still_stream return await async_get_still_stream( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 280, in async_get_still_stream img_bytes = await image_cb() ^^^^^^^^^^^^^^^^ File "/config/custom_components/bambu_lab/camera.py", line 76, in async_camera_image stream_source = await self.stream_source() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bambu_lab/camera.py", line 64, in stream_source url = URL(self.coordinator.get_model().camera.rtsp_url).with_user('bblp').with_password( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/yarl/_url.py", line 835, in with_user raise ValueError("user replacement is not allowed for relative URLs") ValueError: user replacement is not allowed for relative URLs

Oops, minor issue.
New dev release: https://github.com/greghesp/ha-bambulab/releases/tag/v1.7.1-dev2

You might need to reload the integration

@IIDemoniaKII
Copy link

Hello, I can't find the version on HACS.

@greghesp
Copy link
Owner

Hello, I can't find the version on HACS.

Have you go the Beta toggle ticked?

@IIDemoniaKII
Copy link

Yes, i see v1.7.1-dev1

@greghesp
Copy link
Owner

Yes, i see v1.7.1-dev1

Odd. I just checked my production instance and it's there. Maybe try toggling it? Sometimes its in the drop-down, but you have to select off if and then back into it for it to select

@IIDemoniaKII
Copy link

I will try to uninstall completely and download again

@IIDemoniaKII
Copy link

No, it doesn't appear
1
2

@IIDemoniaKII
Copy link

Capture d'écran 2023-09-30 210234

@greghesp
Copy link
Owner

greghesp commented Sep 30, 2023

Ahhhh, I'd created the tag but not the release. Oops! Try again now

@IIDemoniaKII
Copy link

Upload the file directly to home assistant, unfortunately it still doesn't work

Logger: homeassistant.components.stream.stream.camera.x1c_00m09a371200619_camera
Source: components/stream/init.py:434
Integration: Stream (documentation, issues)
First occurred: 21:30:52 (7 occurrences)
Last logged: 21:34:22

Error from stream worker: Error opening stream (PROTOCOL_NOT_FOUND, Protocol not found) ://bblp:edc1d6f5@disable

@IIDemoniaKII
Copy link

Now i see, i test

Capture d'écran 2023-09-30 213642

@greghesp
Copy link
Owner

Oh - you don't have RTSP enabled on your printer. After the @ sign in that URL should have the IP address, but its reporting disabled instead

@IIDemoniaKII
Copy link

My fault, I forgot to reactivate live. It works, thank you very much!
Beautiful evening

@greghesp greghesp closed this as completed Oct 1, 2023
@greghesp greghesp reopened this Oct 1, 2023
@greghesp
Copy link
Owner

greghesp commented Oct 1, 2023

Seems I've also got the same issue as OP
2023-10-01 11:19:06.584 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.x1c_00m00a280103660_camera] Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error) rtsps://****:****@192.168.1.64/streaming/live/1

I'm not sure this is an issue with the integration, as VLC cannot access the stream either.

@bubbleytea - Have you got Timelapse on? I've never had this issue before, and I've just turned timelapse on and now have this issue

@IIDemoniaKII
Copy link

IIDemoniaKII commented Oct 1, 2023

Hello,

New problem it seems, my timelaps is activate

Logger: homeassistant.components.stream.stream.camera.x1c_00m09a371200619_camera
Source: components/stream/init.py:434
Integration: Stream (documentation, issues)
First occurred: 12:39:31 (5 occurrences)
Last logged: 12:42:02

Error from stream worker: Error opening stream (INVALIDDATA, Invalid data found when processing input) rtsps://:@192.168.68.140/streaming/live/1
Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error) rtsps://:@192.168.68.140/streaming/live/1
Error from stream worker: Error opening stream (PROTOCOL_NOT_FOUND, Protocol not found) ://bblp:edc1d6f5@disable

@greghesp
Copy link
Owner

greghesp commented Oct 1, 2023

Error from stream worker: Error opening stream (PROTOCOL_NOT_FOUND, Protocol not found) ://bblp:edc1d6f5@disable

This looks like it's been disabled again

@IIDemoniaKII
Copy link

Reactivate..., this printer likes to play jokes on me...

Logger: homeassistant.components.stream.stream.camera.x1c_00m09a371200619_camera
Source: components/stream/init.py:434
Integration: Stream (documentation, issues)
First occurred: 12:46:29 (1 occurrences)
Last logged: 12:46:29

Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error) rtsps://:@192.168.68.140/streaming/live/1

@greghesp
Copy link
Owner

greghesp commented Oct 1, 2023

I'm also getting this issue as well. It's nothing to do with HA from what I can tell, as I'm also unable to access the stream from VLC. Must be a bug in the firmware

@anoblet
Copy link

anoblet commented Dec 28, 2023

I can get a camera stream after first boot on an X1C using HA. After that it drops off. I'm not sure when, or why, though diffing the i/o could provide a clue. Does the FW just drop multiple streams? Does it fallback on trusted domains?

Anyways please take some time for the holidays, we'll always be here :)

@AdrianGarside
Copy link
Collaborator

The RTSP support in the firmware is just very buggy unfortunately.

@anoblet
Copy link

anoblet commented Dec 28, 2023

It hasn't bothered me much, it seems like a finicky problem to solve. Everything else works great :)

@jmwaldrip
Copy link

I was having the same right after I upgraded to firmware 1.7.01.00. I played with it for a while, but after I hard rebooted the printer it started working.

I am having some timestamp differences errors but it seems to be working well.

image

I will add another comment if it stops working or has any issues. So far seems pretty stable.

I am also starting to play with WebRTC and streaming it through that to see if it makes a difference.

@AdrianGarside
Copy link
Collaborator

What I’m finding is that with webrtc and pointing both my production and test instance of home assistant at the same go2rtc instance then I have a reliable connection. But if I restart home assistant (and with my docker based setup that restarts go2rtc) then the connection is broken until I restart the printer.

@AdrianGarside
Copy link
Collaborator

While when I had two separate go2rtc instances the connection I think was not reliable even if I didn’t restart my production home assistant instance but I’m not certain.

@jmwaldrip
Copy link

Oh interesting, I haven't had time to try the a webrtc server yet. What are you using for the docker container? I was thinking of throwing it on my k8s cluster.

@jneilliii
Copy link

go2rtc is one I've used outside of HA before, but think it's actually bundled in HA too IIRC

@jmwaldrip
Copy link

Yeah, its bundled in HA. But I have HA running in my K8s cluster. I was going to put it on its own deployment etc so I didn't have to deal with the ingress complexity.

@AdrianGarside
Copy link
Collaborator

AdrianGarside commented Jan 5, 2024

It's part of the included webrtc integration I think - not sure if there's other copies of go2rtc but each of my HA instances starts it's own copy of go2rtc as part of the webrtc integration. Initially I had both my production and test instances webrtc pointing at their own go2rtc so each of those was separately connecting to the printer. And that seems to be the source of some of the reliability issues I was seeing. Only having one instance pointed at the printer seems to have made things much more reliable - as long as that instance never gets restarted.

@anoblet
Copy link

anoblet commented Feb 9, 2024

Is there a guide on how to setup WebRTC/go2rtc for this integration?

@AdrianGarside
Copy link
Collaborator

#453 (comment)

@mateuszdrab
Copy link

This is so annoying, is Bambu doing anything about this?
I was hoping last firmware release would fix it but it's still barely ever working.

Copy link

Stale issue message

@AdrianGarside AdrianGarside added the external Issue is related to functionality outside the integration label Apr 16, 2024
@lukbe
Copy link

lukbe commented Jul 3, 2024

Hello, I have with my X1C and Home Assistant integration same problem = in the log is error Error from stream worker: Error opening stream.
Integration version 2.0.21
Home assistant 2024.6.4

Exist a solution?

@miketarg
Copy link

miketarg commented Oct 4, 2024

Logger: homeassistant.components.stream.stream.camera.bambu_lab_x1c_camera
Source: components/stream/init.py:448
integration: Stream (documentation, issues)
First occurred: 10:27:08 PM (4 occurrences)
Last logged: 10:33:28 PM

Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error, rtsps://:@192.168.0.228:322/streaming/live/1)

I have this issue, is this being looked at by anyone I would really appreciate a response.

@undert03
Copy link

undert03 commented Nov 8, 2024

Having same issue with my X1C firmware version 01.08.02.00. Get a VLC stream error as well when i use the RTSPS url.

Log attached

home-assistant_bambu_lab_2024-11-08T16-29-25.016Z.log

@AdrianGarside
Copy link
Collaborator

Restarting your printer will help briefly. There is nothing this integration can do to make the video feed work reliably due to bugs in the printer implementation that have gone unfixed.

@undert03
Copy link

undert03 commented Nov 8, 2024

Thanks for the response. What specifically is the issue on the firmware side. Do you have any references to it?

@AdrianGarside
Copy link
Collaborator

If the issue was specifically understood Bambu would probably have fixed it by now. There’s a link above to the Bambu studio GitHub.

@undert03
Copy link

Ok so I don't know if its been discovered before but I am just going to throw it out here.

Since before and after posting my comment 5 days ago I have been really trying to get this working all the way to docker containers and elaborate command line. Nothing seemed to work even on reboot of the X1 I could not get the stream to ever show.

So i stumble onto this post and figure why not, I hope its that easy.
https://www.wolfwithsword.com/bambulabs-x1c-camera-in-home-assistant/

Upon configuring I get the Home Assistant error message _"The stream integration is not set up. Please ensure that you have 'default_config:' or 'stream:' in your configuration.yaml". First google result brought me here.
home-assistant/core#64675

With my configuration I just added stream: to me HA configuration.yaml and restarted. After reboot my camera on my X1 has been working as expected. The logs no long output the stream error. I have had my printer up for about 3 days now without a reboot and camera images are still working. I did notice it might take 2-5 seconds for the image to start streaming and there is some skipping in the frame rate but i will take it!

I have also removed the stream: in my configuration to see if it would go back to giving me the error and sure enough it went back to the camera not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external Issue is related to functionality outside the integration wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests