greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
1.05k stars 94 forks source link

[Bug] X1C camera feed intermittent to not working #488

Closed capsel22 closed 7 months ago

capsel22 commented 8 months ago

Describe the bug

I've received new X1C and I am having issues with the camera feed. It's almost never working. Sometimes it works for 2-3sec and gets forever stuck, sometimes it just shows black screen. Reboot of the printer rarely fixes it. I have tried toggling the live view off/on and regenerating the access code and re-adding the integration.

I also have P1S and the camera feed is bullet-proof. Bambu handy and studio work as intended.

the debug log is flooded with ERROR (stream_worker) [homeassistant.components.stream.stream.camera.x1c_00m09a372901852_camera] Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error) rtsps://:@192.168.1.125:322/streaming/live/1

To Reproduce

  1. Got to the integration
  2. Open camera feed
  3. Black screen or stuck on a single frame

Expected Behaviour

Hopefully to work and show the feed.

What device are you using?

X1C

Diagnostic Output

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.3.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "6.6.20-haos",
    "supervisor": "2024.03.0",
    "host_os": "Home Assistant OS 12.1",
    "docker_version": "24.0.7",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "webrtc": {
      "version": "v3.5.1",
      "requirements": []
    },
    "hacs": {
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "bambu_lab": {
      "version": "2.0.15",
      "requirements": []
    },
    "nodered": {
      "version": "3.1.3",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "bambu_lab",
    "name": "Bambu Lab",
    "codeowners": [
      "@greghesp",
      "@AdrianGarside"
    ],
    "config_flow": true,
    "dependencies": [
      "device_automation",
      "ffmpeg",
      "mqtt"
    ],
    "documentation": "https://github.com/greghesp/ha-bambulab",
    "iot_class": "local_push",
    "issue_tracker": "https://github.com/greghesp/ha-bambulab/issues",
    "ssdp": [
      {
        "st": "urn:bambulab-com:device:3dprinter:1"
      }
    ],
    "version": "2.0.15",
    "is_built_in": false
  },
  "data": {
    "config_entry": {
      "entry_id": "2515ff4d4aca64c3cad5536a29d8e7e3",
      "version": 2,
      "minor_version": 1,
      "domain": "bambu_lab",
      "title": "**REDACTED**",
      "data": {
        "device_type": "X1C",
        "serial": "**REDACTED**"
      },
      "options": {
        "region": "Europe",
        "email": "**REDACTED**",
        "username": "**REDACTED**",
        "name": "X1C",
        "host": "192.168.1.125",
        "local_mqtt": false,
        "auth_token": "**REDACTED**",
        "access_code": "**REDACTED**",
        "usage_hours": 28.330000000000002
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": null,
      "disabled_by": null
    },
    "push_all": {
      "command": "gcode_line",
      "reason": "SUCCESS",
      "result": "SUCCESS",
      "return_code": "150",
      "sequence_id": "2122"
    },
    "get_version": {
      "command": "get_version",
      "module": [
        {
          "hw_ver": "",
          "name": "ota",
          "sn": "",
          "sw_ver": "01.07.02.00"
        },
        {
          "hw_ver": "AP05",
          "name": "rv1126",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.28.55"
        },
        {
          "hw_ver": "TH09",
          "name": "th",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.07.12"
        },
        {
          "hw_ver": "MC07",
          "name": "mc",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.22.37/00.00.22.37"
        },
        {
          "hw_ver": "",
          "name": "xm",
          "sn": "",
          "sw_ver": "00.01.02.02"
        },
        {
          "hw_ver": "AMS08",
          "name": "ams/0",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.06.40"
        }
      ],
      "sequence_id": "0"
    }
  }
}

Log Extracts

No response

Other Information

Screenshot_2024-03-21-20-47-40-14_c3a231c25ed346e59462e84656a70e50

ThomasLoeffel commented 8 months ago

I have the same issue. 1 week ago everything works well, but now the camera feed is not working anymore. I use the X1e. Thanks for your support.

copc commented 8 months ago

I just got this installed and both of my X1C's show "Camera Unavailable" even though camera works fine. image image

AdrianGarside commented 8 months ago

See https://github.com/greghesp/ha-bambulab/discussions/453 for suggestions how to make the extremely unreliable rtsp feed off the X1 somewhat reliable for use.

ThomasLoeffel commented 8 months ago

I switched 5 times my Bambulab on/off. Now it works, I dont know how long.....

tubalainen commented 8 months ago

For me, I think that Bambu Studio are messing the the "LAN mode LiveView" setting under Settings - General. I have found it to be ticked off several times. Might be a bug in firmware? I am using the latest X1C FW. Anyhow - The camera works great for me, after enabling the LAN Mode LiveView toggle. Ive made a PR to update the documentation with this instruction. I missed it and had to tinker quite a bit until I found that this setting needs to enabled for the video stream to be presented to the LAN.

GeorgeGedox commented 7 months ago

Indeed, enabling LAN mode LiveView in the printer settings made the camera work

polysa commented 7 months ago

What I found best to get the camera working for X1C is:

  1. Enable Lan Mode View
  2. Reset the Access Code
  3. Add HA Integration via cloud and add your Printer's IP and Access code after selecting connect to printer localy
  4. Restart Printer

Since following this steps the Camera is rock solid on my HA.

altjx commented 3 weeks ago

What I found best to get the camera working for X1C is:

  1. Enable Lan Mode View
  2. Reset the Access Code
  3. Add HA Integration via cloud and add your Printer's IP and Access code after selecting connect to printer localy
  4. Restart Printer

Since following this steps the Camera is rock solid on my HA.

@polysa If I'm understanding this correctly, this means the camera in HA will not work unless LAN mode is enabled, is this correct? Meaning you can't follow your steps and re-enable LAN mode and have the camera working?

I'm also a little confused by LAN mode (will research this on my own) as it stated the printer will be disconnected from Bambu Studio and Bambu Handy app. I don't quite understand how the printer would be useful anymore without this.

AdrianGarside commented 3 weeks ago

In my testing (admittedly a while back now), there was no difference in stability of the feed in lan mode. The very first rtsp connection is far more stable - but restarting your home assistant will drop that and request a new one and that's very likely (but not guaranteed) to fail until you restart the printer.

AdrianGarside commented 3 weeks ago

My setup is listed here: https://github.com/greghesp/ha-bambulab/discussions/453

I'm currently working on a way to turn off HA connecting to the RTSP feed since in the webrtc configuration I have above I don't any additional connections to the printer that could destabilize the video feed access due to the implementation fragility.