greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
693 stars 57 forks source link

[Feature] Toggle camera streams for each printer #496

Open clusterfunk777 opened 2 months ago

clusterfunk777 commented 2 months ago

Describe the feature

I have been using this integration and it has been great, but unfortunately the camera streams seem to bog down my 2.4 ghz wifi network significantly (I have 20 X1Cs) even when the cameras were not being viewed. I'm guessing this is because the streams keep running in the background. I've disabled the camera entity on each of them for now which fixed my network congestion problem but it would be nice if there was a toggle to enable / disable the streaming on demand, sort of like how the livestream works in bambu studio.

What device is this for?

X1C

Other Information

No response

AdrianGarside commented 2 months ago

Hmm. I didn’t think that was running unless you viewed it. Regardless the problem is that the X1 RTSP feed is extremely fragile. Only the very first connection after the printer is turned on is reliable. Subsequent connections have a high chance of failing and once falling it hardly ever recovers - you have to restart the printer. So if I did to provide an option to toggle the camera off if that’s necessary to prevent continuous bandwidth usage, it would pretty much guarantee the camera will stop working for you.

WolfwithSword commented 2 months ago

I recall that HA itself has some issues with this. If "preload" is enabled on any camera entity it will run it on HA bootup and keep it running in the background continuously. Additionally, homeassistant has a "bug" where if a camera entity is viewable on any screen via lovelace, it's loaded into the background. Had this happen once when I had it viewed on my phone - I even put the HA app to sleep but it kept the camera stream loaded and running in the background unless I completely terminated the HA app. Same will go for if it's in some recently opened but not active tab in a browser.

It's also possible Bambu might be doing some performance tweaking around the camera in future firmware which could fix it. Until then, since it's very unreliable for reconnecting to bambu's camera feed intermittently for some, probably would cause more issues for users if the toggle was in the integration.

On a per-individual/usecase basis it might be easier to disable the entity in HA, and if they want to risk the reliability, they could manually setup something like go2rtc with the connection info for the cameras of all printers and disable/enable through that. Can still have the camera feeds integrated into HA with go2rtc, but it offloads it to something else the user can manage and more easily control I think.

clusterfunk777 commented 2 months ago

I see, thanks for the explanations!

I did find https://github.com/bambulab/BambuStudio/issues/3571#issuecomment-1951615791 which does suggest that there is a new firmware version in the pipeline that might fix the camera issues (supposedly in ~1 month). Perhaps this feature request would be more relevant after that is fixed.

AdrianGarside commented 2 months ago

"Additionally, homeassistant has a "bug" where if a camera entity is viewable on any screen via lovelace" That's probably specific to the built-in card. I'm not seeing that with the webrtc card. The webrtc can be explicitly configured to keep the feed live when no longer being viewed (what I do to workaround the X1 firmware bug) but it doesn't by default.

There's a thread in the discussion section on how to configure the webrtc plugin to get the most reliable video feed. But since you want to turn it off, that's probably not going to be helpful until the printer bug gets addressed and you can reliably stop/start the RTSP feed.

github-actions[bot] commented 2 weeks ago

Stale issue message